@ai-setting/roy-agent-core 1.7.70 → 1.7.71

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 (36) hide show
  1. package/dist/env/event-source/event-source-handlers.js +6 -6
  2. package/dist/env/event-source/index.js +7 -7
  3. package/dist/env/event-source/reset-command.d.ts +41 -0
  4. package/dist/env/index.js +11 -11
  5. package/dist/env/prompt/index.js +3 -3
  6. package/dist/env/prompt/prompts-index.d.ts +339 -1
  7. package/dist/env/task/delegate/delegate-tool.js +3 -3
  8. package/dist/env/task/delegate/index.js +3 -3
  9. package/dist/env/task/index.js +5 -5
  10. package/dist/env/task/mcp/index.js +2 -2
  11. package/dist/env/task/plugins/index.js +4 -4
  12. package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +50 -0
  13. package/dist/env/task/plugins/lark-card-patch-notifier.js +3 -1
  14. package/dist/env/task/prompt/index.d.ts +11 -0
  15. package/dist/env/task/prompt/index.js +16 -0
  16. package/dist/env/task/prompt/task-discipline.d.ts +32 -0
  17. package/dist/env/task/tools/index.js +2 -2
  18. package/dist/env/workflow/plugins/index.js +2 -2
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +30 -18
  21. package/dist/shared/@ai-setting/{roy-agent-core-0j94tj1z.js → roy-agent-core-101qtkyc.js} +3 -3
  22. package/dist/shared/@ai-setting/{roy-agent-core-bk8kyzv8.js → roy-agent-core-1gsbqesr.js} +1 -1
  23. package/dist/shared/@ai-setting/{roy-agent-core-8bjj3d1b.js → roy-agent-core-1w9y7mxj.js} +1 -1
  24. package/dist/shared/@ai-setting/{roy-agent-core-tadj19vp.js → roy-agent-core-46rv4d7d.js} +71 -49
  25. package/dist/shared/@ai-setting/roy-agent-core-4jjwewvw.js +182 -0
  26. package/dist/shared/@ai-setting/{roy-agent-core-x3xpkx84.js → roy-agent-core-5repth1n.js} +1 -1
  27. package/dist/shared/@ai-setting/{roy-agent-core-h5vmff8w.js → roy-agent-core-7sj9xs9c.js} +7 -33
  28. package/dist/shared/@ai-setting/{roy-agent-core-27f59kjv.js → roy-agent-core-9geem94g.js} +1 -1
  29. package/dist/shared/@ai-setting/{roy-agent-core-hx46nhh1.js → roy-agent-core-k13pxrpk.js} +4 -4
  30. package/dist/shared/@ai-setting/{roy-agent-core-nersksh1.js → roy-agent-core-mwa6apzx.js} +2 -2
  31. package/dist/shared/@ai-setting/roy-agent-core-qkdegdvc.js +0 -0
  32. package/dist/shared/@ai-setting/{roy-agent-core-npvejsg8.js → roy-agent-core-zsbh9bfv.js} +83 -3
  33. package/dist/shared/@ai-setting/{roy-agent-core-vaz9350j.js → roy-agent-core-zv8bswpw.js} +4 -159
  34. package/dist/test-utils/ipc-test-server.d.ts +10 -0
  35. package/package.json +6 -1
  36. package/dist/shared/@ai-setting/roy-agent-core-6m4bw8jy.js +0 -6
@@ -103,6 +103,43 @@ export interface ProcessStep {
103
103
  description?: string;
104
104
  /** 步骤分类(如 research / code / test),有值时追加到标题括号内 */
105
105
  category?: string;
106
+ /**
107
+ * ★ Task #4889 —— 这条过程步骤的**语义来源**。
108
+ *
109
+ * ## 为什么需要这个字段
110
+ *
111
+ * 「过程信息」区历史上混装了两种**语义完全不同**的东西:
112
+ *
113
+ * 1. **operation** —— 真正的任务操作记录(`task_operation_create` 写的)。
114
+ * core 自己派生(`deriveTimelineFromOperation`),title 是人写的
115
+ * 里程碑标题,形如「勘查反转:manifest 并非残废」。
116
+ * 2. **tool-trace** —— 工具调用轨迹。插件派生(`describeToolUse`),
117
+ * title 是**动作名**,形如「执行命令」「记录进展」。
118
+ *
119
+ * 两者在卡片上同属一个「🔧 过程信息」区块、底部统一计「N 个过程」,
120
+ * 用户读起来就等同于「**每个工具调用都记了一条操作记录**」
121
+ * —— 这正是 Task #4889 用户反馈的核心不满。
122
+ *
123
+ * 所以:卡片按 source **分区呈现**,让两种语义在 UI 上泾渭分明。
124
+ *
125
+ * - `"tool-trace"` → 渲染进「🔧 执行轨迹(工具调用)」区
126
+ * - `"operation"` / 缺省 → 渲染进「📝 操作记录」区
127
+ *
128
+ * 缺省视为 operation:**旧数据(没有这个字段)必须继续渲染在操作记录区**,
129
+ * 不能因为新增字段就丢掉历史内容。
130
+ */
131
+ source?: "operation" | "tool-trace";
132
+ /**
133
+ * ★ Task #4889 —— 该步骤的**唯一标识**(可选)。
134
+ *
135
+ * 有 id 时,去重完全按 id 进行 —— 于是「同一个工具被连续调用两次」
136
+ * (title 相同、timestamp 可能同毫秒)不会撞成同一条而被**静默吞掉**。
137
+ *
138
+ * 缺省时退化为「内容 key」去重(同 title+timestamp+description+category+source
139
+ * 视为同一条)—— 对 operation 记录是对的(同一 operation 重复上报就是同一条),
140
+ * 对 tool-trace 则要求生产方补 id(插件已补)。
141
+ */
142
+ id?: string;
106
143
  }
107
144
  /**
108
145
  * 任务元信息(卡片顶部"任务栏位"区块的数据源)
@@ -454,6 +491,19 @@ export declare function renderMilestones(milestones: Milestone[]): string;
454
491
  * 样式:`- **HH:mm:ss → 现在** <title>` + 可选缩进说明行
455
492
  */
456
493
  export declare function renderProcessSteps(steps: ProcessStep[]): string;
494
+ /**
495
+ * ★ Task #4889 —— 按语义来源把过程步骤分成两组。
496
+ *
497
+ * - `operations` —— 真正的 task operation 记录(缺省 source 也归这里)
498
+ * - `toolTraces` —— 工具调用轨迹
499
+ *
500
+ * 分区是**呈现层**的职责:语义(这条到底是不是一条操作记录)在生产方决定,
501
+ * core 只负责不把两者混在一个区块里。
502
+ */
503
+ export declare function partitionProcessSteps(steps: ProcessStep[]): {
504
+ operations: ProcessStep[];
505
+ toolTraces: ProcessStep[];
506
+ };
457
507
  /**
458
508
  * 构造 card JSON payload(Card 2.0 schema,用户验收样式 Task #4230 v2)
459
509
  *
@@ -11,6 +11,7 @@ import {
11
11
  humanizeValue,
12
12
  isTerminalStatusForTimeline,
13
13
  isTerminalStatusForWorkflowTimeline,
14
+ partitionProcessSteps,
14
15
  renderContextAsLines,
15
16
  renderMilestones,
16
17
  renderProcessSteps,
@@ -19,7 +20,7 @@ import {
19
20
  renderWorkflowInfoLines,
20
21
  resolveTaskTitleForDisplay,
21
22
  sanitizeInlineText
22
- } from "../../../shared/@ai-setting/roy-agent-core-tadj19vp.js";
23
+ } from "../../../shared/@ai-setting/roy-agent-core-46rv4d7d.js";
23
24
  import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
24
25
  import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
25
26
  import"../../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
@@ -33,6 +34,7 @@ export {
33
34
  renderProcessSteps,
34
35
  renderMilestones,
35
36
  renderContextAsLines,
37
+ partitionProcessSteps,
36
38
  isTerminalStatusForWorkflowTimeline,
37
39
  isTerminalStatusForTimeline,
38
40
  humanizeValue,
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @fileoverview Task #4889 — 任务纪律子路径公开导出面
3
+ *
4
+ * 消费方式:
5
+ * import { TASK_DISCIPLINE_PROMPT } from "@ai-setting/roy-agent-core/env/task/prompt";
6
+ *
7
+ * 设计(/tmp/4889-phase1-design.md §1.3-1.6):
8
+ * TASK_DISCIPLINE_PROMPT 是唯一真相源;4 个分片供
9
+ * 「部分缺失」的 runtime 只补自己缺的那块。
10
+ */
11
+ export { TASK_DISCIPLINE_PROMPT, TASK_DISCIPLINE_LIFECYCLE, TASK_DISCIPLINE_OPERATION, TASK_DISCIPLINE_GOALS, TASK_DISCIPLINE_COMPLETE, } from "./task-discipline";
@@ -0,0 +1,16 @@
1
+ import"../../../shared/@ai-setting/roy-agent-core-qkdegdvc.js";
2
+ import {
3
+ TASK_DISCIPLINE_COMPLETE,
4
+ TASK_DISCIPLINE_GOALS,
5
+ TASK_DISCIPLINE_LIFECYCLE,
6
+ TASK_DISCIPLINE_OPERATION,
7
+ TASK_DISCIPLINE_PROMPT
8
+ } from "../../../shared/@ai-setting/roy-agent-core-4jjwewvw.js";
9
+ import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
10
+ export {
11
+ TASK_DISCIPLINE_PROMPT,
12
+ TASK_DISCIPLINE_OPERATION,
13
+ TASK_DISCIPLINE_LIFECYCLE,
14
+ TASK_DISCIPLINE_GOALS,
15
+ TASK_DISCIPLINE_COMPLETE
16
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @fileoverview Task #4889 — 任务纪律单一真相源(runtime 无关)
3
+ *
4
+ * 单一真相源:core 内 roy prompt 与所有外部 runtime
5
+ * (opencode / claude / codex / CLI daemon / …)的 agent
6
+ * prompt 都从这一个常量派生,不许各抄一份。
7
+ *
8
+ * 内容来源(报告 A /tmp/4889-phase0-roy-prompt-mechanisms.md):
9
+ * - 主体机制:prompts-index.ts roy prompt Task 章节(M1-M16)
10
+ * - goals 编号子项:create-tool.ts L144 起(M7/M8/M9)
11
+ * - complete 核实义务:complete-tool.ts L32-45(M10/M11/M12)
12
+ *
13
+ * 改写原则:
14
+ * 1. 剥离 Roy 专属内容(CLI 命令表 / {{memory}} / deniedTools 工具表)
15
+ * 2. 补齐 M14/M15/M16
16
+ * 3. 不含防退化纪律(属 Roy 全局操作纪律,不属 task 语义)
17
+ * 4. 共享锚点直接 import completion-copy.ts,不重打一遍
18
+ *
19
+ * ⚠️ 本模块必须保持**零依赖**:唯一允许的 import 是
20
+ * completion-copy.ts(同为零依赖锚点模块),以便
21
+ * prompts-index(超大模板串)与外部 npm 消费方安全引用。
22
+ */
23
+ /** 分片 1:生命周期契约(M1/M2/M13/M14/M15) */
24
+ export declare const TASK_DISCIPLINE_LIFECYCLE = "### Task Lifecycle (7 steps, 0-6)\n\n> Tasks are the **first-class citizen**. Follow this lifecycle for every task:\n\n0. CHECK TASK CONTEXT OR SEARCH\n - If `[\u5F53\u524D Task #N]` is in the context \u2192 use `task_get #N` directly, skip searching.\n - Otherwise use `task_list` / `task_search` to find related tasks.\n - If found \u2192 reuse, extend, and update (see the reuse rules in step 1).\n If not found \u2192 proceed to step 1.\n - **Orient before creating**: read the existing tree with\n `task_tree(depth=1)` (`depth=2` for bigger trees) and decide whether the\n work belongs to an existing root (attach via `parent_task_id`) or is\n genuinely new. Keep **root tasks \u2264 10**; prefer attaching to an existing\n thematic root over spawning a new root. Never hardcode ids \u2014 read them\n from `task_tree`.\n\n1. CREATE or REUSE\n - No existing task \u2192 create a new one with title, description, goals.\n - Existing task \u2192 reuse via `task_get`, then `task_update`:\n * Append new context to description and goals (preserve the old content)\n * Add / extend `goals_and_expected_deliverables`\n * Create an operation record documenting the continuation\n * Set priority and due date if any\n * If the original task was completed \u2192 reset status to `active`\n and reset progress to a reasonable value\n\n2. GATHER CONTEXT (never skip)\n - Read description, goals, current_status\n - Check `parent_task_id` for sub-tasks\n - Read the operation history: `task_operation_list` (~20 recent records)\n - Review recent operations for history and decisions\n - Working without context risks: outdated goals, missed decisions,\n duplicated work, misalignment with the parent task\n\n3. EXECUTE\n - Use the available tools, skills and workflows to satisfy the task\n description and goals.\n - Long-running work: for work longer than 5 minutes, record a milestone\n with `task_operation_create` as you go, so the user can see progress.\n - Several independent sub-tasks may run in parallel (background `bash &`\n or parallel ReAct steps).\n - **\u8FB9\u5E72\u8FB9\u8BB0** \u2014 milestones are recorded **while working**;\n **\u7981\u6B62\u4E8B\u540E\u6279\u91CF\u8865**\uFF08do not defer them to one batch at the end\uFF09.\n - Note: `task_create` / `task_update` already create operation records\n automatically \u2014 do not create duplicates by hand.\n\n4. TRACK\n - Update progress (0-100%) as the work advances\n - Update status: todo \u2192 active \u2192 completed\n - Record `current_status` with human-readable progress\n\n5. RECORD \u2014 operation records (see Operation Discipline below)\n\n6. COMPLETE \u2014 `task_complete` after item-by-item verification\n (see Complete Discipline below)";
25
+ /** 分片 2:操作记录双维度规范(M3/M4/M5/M6/M16) */
26
+ export declare const TASK_DISCIPLINE_OPERATION = "### Operation Record \u2014 \u53CC\u7EF4\u5EA6\u5206\u5DE5\u89C4\u8303\n\n**Record milestones as you work** \u2014 call `task_operation_create` the moment a\nstage is reached, **not after the fact** (not in a batch at the end).\n\n**\u64CD\u4F5C\u8BB0\u5F55\u5FC5\u987B\u4E25\u683C\u533A\u5206\u4E24\u4E2A\u7EF4\u5EA6\uFF0C\u4E8C\u8005\u914D\u5957\u8BB0\u5F55\u3001\u5404\u53F8\u5176\u804C**\uFF1A\n\n#### \u7EF4\u5EA6 1\uFF1A\u72B6\u6001/\u91CC\u7A0B\u7891\uFF08\"\u8FBE\u5230\u4EC0\u4E48\"\uFF09\u2014 \u5FC5\u586B\u7EF4\u5EA6\n\u4F7F\u7528 `task_operation_create` \u7684 milestone_* \u4E3B\u5B57\u6BB5\uFF1A\n- **milestone_type**\uFF1A\u91CC\u7A0B\u7891\u7C7B\u578B\uFF08create / progress / milestone / problem / solution / decision / review / completed / workflow_extracted\uFF09\n- **milestone_title**\uFF1A\u91CC\u7A0B\u7891\u6807\u9898\uFF08\u4E00\u884C\uFF09\n- **milestone_description**\uFF1A\u8FBE\u6210\u7684\u72B6\u6001/\u7ED3\u679C\u63CF\u8FF0\uFF08\u53EF\u957F\u53EF\u77ED\uFF09\n\n#### \u7EF4\u5EA6 2\uFF1A\u8FC7\u7A0B\uFF08\"\u5982\u4F55\u8FBE\u5230\"\uFF09\u2014 \u53EF\u9009\u4F46\u63A8\u8350\u7EF4\u5EA6\n\u4F7F\u7528 `task_operation_create` \u7684 `process_description` \u5B57\u6BB5\uFF1A\n- \u5B57\u7B26\u8303\u56F4\u786C\u7EA6\u675F 100-500 \u5B57\u7B26 (100\u2013500 characters)\n- \u5185\u5BB9\uFF1A\u91C7\u53D6\u7684\u7B56\u7565 + \u5DE5\u5177\u6B65\u9AA4\u6982\u8981\n- \u5B8C\u6574\u8FC7\u7A0B\u901A\u8FC7 sessionId \u56DE\u67E5 session\n\n#### \u53CC\u7EF4\u5EA6\u914D\u5408\u94C1\u5F8B\n- \u274C **\u4E0D\u8981\u628A action \u5F53\u72B6\u6001**\uFF1A\u65E7 `action_*` \u547D\u540D\u504F\u52A8\u4F5C/\u884C\u4E3A\u5C42\uFF0C\u4E0D\u80FD\u8868\u8FBE\"\u6B64\u523B\u8FBE\u5230\u4EC0\u4E48\"\uFF1B\u73B0\u5728\u7EDF\u4E00\u6539\u7528 `milestone_*`\u3002\n- \u274C **\u4E0D\u8981\u8BA9 process_description \u4E0E milestone_description \u91CD\u590D**\uFF1Aprocess \u662F\"\u5982\u4F55\u8FBE\u5230\"\uFF0Cmilestone \u662F\"\u8FBE\u5230\u4EC0\u4E48\u72B6\u6001\"\u3002\n- \u2705 **\u914D\u5957\u8BB0\u5F55**\uFF1A\u6BCF\u4E2A\u6709\u610F\u4E49\u7684 operation \u90FD\u5E94\u540C\u65F6\u5305\u542B\u4E24\u8005\uFF1B\u4E0D\u5199 process \u65F6\uFF0Cdetail \u5E94\u901A\u8FC7 sessionId \u56DE\u67E5\u3002\n- \u26A0\uFE0F **\u517C\u5BB9\u7A97\u53E3\u671F**\uFF1A\u65E7 `action_type` / `action_title` / `action_description` \u4ECD\u88AB tool \u63A5\u53D7\uFF08\u6807\u8BB0 @deprecated\uFF09\uFF0C\u4F1A\u81EA\u52A8\u6620\u5C04\u5230 milestone_* \u5E76\u8FD4\u56DE deprecation warning\u3002\n\n#### \u8303\u4F8B\uFF08\u53CC\u7EF4\u5EA6\u9F50\u5168\u7684 operation \u8BB0\u5F55\uFF09\n```json\n{\n \"task_id\": 123,\n \"milestone_type\": \"milestone\",\n \"milestone_title\": \"GREEN \u901A\u8FC7\uFF1Amilestone_* schema/storage/tool \u5168\u94FE\u8DEF\",\n \"milestone_description\": \"21/21 \u6D4B\u8BD5\u901A\u8FC7\uFF0C\u5305\u542B 4 \u4E2A action_* alias \u517C\u5BB9\u6D4B\u8BD5\",\n \"process_description\": \"TDD RED \u5199 4 \u4E2A\u5931\u8D25\u6D4B\u8BD5\u8986\u76D6 storage/tool\uFF1B\u8FC1\u79FB 004 rename \u5217\uFF1BrowToOperation \u540C\u65F6\u8F93\u51FA\u53CC\u5B57\u6BB5\u517C\u5BB9\uFF1Btool zod preprocess \u81EA\u52A8\u6620\u5C04 action_*\"\n}\n```";
27
+ /** 分片 3:goals 编号子项规则(M7/M8/M9) */
28
+ export declare const TASK_DISCIPLINE_GOALS = "### Goals \u5B50\u9879\u62C6\u5206\u89C4\u5219\n\n`goals_and_expected_deliverables` **MUST** be written as\n**numbered sub-items** (\u7F16\u53F7\u5B50\u9879) that can each be verified\none by one (\u9010\u6761\u9A8C\u6536) \u2014 for `type=normal` tasks:\n\n1. \u5B9E\u73B0 X\uFF08\u542B\u6587\u4EF6\u8DEF\u5F84\uFF09\n2. \u6D4B\u8BD5 Y \u8986\u76D6 Z \u573A\u666F\uFF08pass/fail \u8BA1\u6570\uFF09\n3. \u6587\u6863 W \u843D\u76D8\u5230 <path>\n\n\u26A0\uFE0F For `type=longterm` / `type=cycle` tasks there is no\nper-item completion acceptance\uFF08\u4E0D\u8D70\u9010\u6761 complete \u9A8C\u6536\uFF09, so the\nMUST above does not apply; for those, it is **strongly recommended**\n(\u5EFA\u8BAE) to split goals into staged, individually checkable sub-items\n(\u9636\u6BB5\u6027\u53EF\u5224\u5B50\u9879) instead of one vague sentence.\n\nWhy: when the task is completed, the completion hook\n(task:after.complete) judges the whole goal against the\noperation-record chain, using each sub-item as fine-grained\nevidence (\u9010\u6761\u5BF9\u7167\u7684\u4F9D\u636E). Vague one-line goals (\u4E00\u53E5\u8BDD\u6A21\u7CCA\u76EE\u6807\uFF0C\n\u5982\u300C\u505A\u597D X\u300D\u300C\u5B8C\u6210\u8C03\u7814\u300D) give the judge nothing to check\nand make a completion hint much more likely.\n\nReference the four atomic assertion forms (Task #4768\n\u56DB\u539F\u5B50\u5F62\u6001) when writing each sub-item:\n\n- \u6587\u4EF6\u65AD\u8A00 (file assertion): file exists / size / content grep\n- \u8FDB\u7A0B\u65AD\u8A00 (process assertion): command exit code / stdout match\n- \u6D4B\u8BD5\u65AD\u8A00 (test assertion): pass/fail counts, no NEW fail\n- \u72B6\u6001\u65AD\u8A00 (state assertion): version number / HTTP 200 / status field";
29
+ /** 分片 4:complete 逐条验收 + HINT 核实义务(M10/M11/M12) */
30
+ export declare const TASK_DISCIPLINE_COMPLETE = "### Task Complete \u2014 \u6838\u5B9E\u4E49\u52A1\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 `task_update(task_id=<id>, status=todo)` to **reopen**\n the task and continue the work; or\n (b) \u786E\u8BA4\u5DF2\u5B8C\u6210 \u2192 `task_operation_create` (milestone_type=decision,\n milestone_title=<\u4E00\u884C\u7ED3\u8BBA>) **state why** the sub-items are actually\n met (\u8BF4\u660E\u7406\u7531).\n Never ignore it (\u4E0D\u5141\u8BB8\u65E0\u89C6).\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.";
31
+ /** 完整纪律正文(主出口):4 分片拼装 */
32
+ export declare const TASK_DISCIPLINE_PROMPT: string;
@@ -9,9 +9,9 @@ import {
9
9
  searchTasksTool,
10
10
  treeTasksTool,
11
11
  updateTaskTool
12
- } from "../../../shared/@ai-setting/roy-agent-core-h5vmff8w.js";
12
+ } from "../../../shared/@ai-setting/roy-agent-core-7sj9xs9c.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
14
- import"../../../shared/@ai-setting/roy-agent-core-6m4bw8jy.js";
14
+ import"../../../shared/@ai-setting/roy-agent-core-4jjwewvw.js";
15
15
  import"../../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
16
16
  import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
17
17
  import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  LarkCliWorkflowNotifyHook,
3
3
  createLarkCliWorkflowNotifyHook
4
- } from "../../../shared/@ai-setting/roy-agent-core-8bjj3d1b.js";
5
- import"../../../shared/@ai-setting/roy-agent-core-tadj19vp.js";
4
+ } from "../../../shared/@ai-setting/roy-agent-core-1w9y7mxj.js";
5
+ import"../../../shared/@ai-setting/roy-agent-core-46rv4d7d.js";
6
6
  import"../../../shared/@ai-setting/roy-agent-core-c2gbt68e.js";
7
7
  import"../../../shared/@ai-setting/roy-agent-core-ax9e9szb.js";
8
8
  import"../../../shared/@ai-setting/roy-agent-core-cpcd24n2.js";
package/dist/index.d.ts CHANGED
@@ -35,6 +35,7 @@ export { TaskComponent, SQLiteTaskStore, getDefaultTaskDbPath, } from "./env/tas
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";
38
+ export { TASK_DISCIPLINE_PROMPT, TASK_DISCIPLINE_LIFECYCLE, TASK_DISCIPLINE_OPERATION, TASK_DISCIPLINE_GOALS, TASK_DISCIPLINE_COMPLETE, } from "./env/task/prompt";
38
39
  export { SkillComponent, } from "./env/skill";
39
40
  export type { SkillEntry, SkillListItem, SkillConfig, SkillPath, SkillSource, SkillToolParams, } from "./env/skill/types";
40
41
  export { McpComponent, } from "./env/mcp";
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ PromptComponent,
3
+ PromptStore
4
+ } from "./shared/@ai-setting/roy-agent-core-9geem94g.js";
1
5
  import {
2
6
  LLMComponent,
3
7
  LLMConfigSchema,
@@ -28,10 +32,7 @@ import {
28
32
  ConfigComponent
29
33
  } from "./shared/@ai-setting/roy-agent-core-zxz5fkwj.js";
30
34
  import"./shared/@ai-setting/roy-agent-core-adg9ghbt.js";
31
- import {
32
- PromptComponent,
33
- PromptStore
34
- } from "./shared/@ai-setting/roy-agent-core-27f59kjv.js";
35
+ import"./shared/@ai-setting/roy-agent-core-qkdegdvc.js";
35
36
  import {
36
37
  MemoryComponent
37
38
  } from "./shared/@ai-setting/roy-agent-core-nwbfepba.js";
@@ -61,21 +62,21 @@ import {
61
62
  BaseEnvironment,
62
63
  generateDescendingId,
63
64
  generateId
64
- } from "./shared/@ai-setting/roy-agent-core-bk8kyzv8.js";
65
+ } from "./shared/@ai-setting/roy-agent-core-1gsbqesr.js";
65
66
  import {
66
67
  TaskComponent
67
- } from "./shared/@ai-setting/roy-agent-core-nersksh1.js";
68
+ } from "./shared/@ai-setting/roy-agent-core-mwa6apzx.js";
68
69
  import"./shared/@ai-setting/roy-agent-core-58804s3j.js";
69
70
  import"./shared/@ai-setting/roy-agent-core-jm136jzh.js";
70
- import"./shared/@ai-setting/roy-agent-core-0j94tj1z.js";
71
+ import"./shared/@ai-setting/roy-agent-core-101qtkyc.js";
71
72
  import"./shared/@ai-setting/roy-agent-core-fttgm52a.js";
72
73
  import"./shared/@ai-setting/roy-agent-core-ntq0gz7q.js";
73
74
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
74
- import"./shared/@ai-setting/roy-agent-core-h5vmff8w.js";
75
+ import"./shared/@ai-setting/roy-agent-core-7sj9xs9c.js";
75
76
  import"./shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
76
77
  import {
77
78
  EventSourceComponent
78
- } from "./shared/@ai-setting/roy-agent-core-x3xpkx84.js";
79
+ } from "./shared/@ai-setting/roy-agent-core-5repth1n.js";
79
80
  import {
80
81
  BountyIMInstance,
81
82
  COMMAND_PREFIX,
@@ -107,7 +108,7 @@ import {
107
108
  timerHandler,
108
109
  translateCardActionToCommand,
109
110
  writeFallbackModelList
110
- } from "./shared/@ai-setting/roy-agent-core-npvejsg8.js";
111
+ } from "./shared/@ai-setting/roy-agent-core-zsbh9bfv.js";
111
112
  import {
112
113
  BUILT_IN_EVENT_SOURCE_TYPES,
113
114
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -132,13 +133,17 @@ import {
132
133
  import {
133
134
  TaskTagPlugin,
134
135
  createAutoTaskPlugin
135
- } from "./shared/@ai-setting/roy-agent-core-hx46nhh1.js";
136
+ } from "./shared/@ai-setting/roy-agent-core-k13pxrpk.js";
136
137
  import {
137
138
  EventStoreImpl,
138
139
  getSharedEventStore,
139
140
  resetSharedEventStore,
140
141
  setSharedEventStore
141
142
  } from "./shared/@ai-setting/roy-agent-core-na18zwj0.js";
143
+ import {
144
+ getBuiltInPrompt,
145
+ getBuiltInPromptNames
146
+ } from "./shared/@ai-setting/roy-agent-core-zv8bswpw.js";
142
147
  import {
143
148
  SQLiteTaskStore,
144
149
  getDefaultTaskDbPath
@@ -146,14 +151,16 @@ import {
146
151
  import {
147
152
  TaskHookPoints
148
153
  } from "./shared/@ai-setting/roy-agent-core-1pg0fepg.js";
149
- import {
150
- getBuiltInPrompt,
151
- getBuiltInPromptNames
152
- } from "./shared/@ai-setting/roy-agent-core-vaz9350j.js";
153
154
  import"./shared/@ai-setting/roy-agent-core-tr3ep81v.js";
154
- import"./shared/@ai-setting/roy-agent-core-6m4bw8jy.js";
155
- import"./shared/@ai-setting/roy-agent-core-8bjj3d1b.js";
156
- import"./shared/@ai-setting/roy-agent-core-tadj19vp.js";
155
+ import {
156
+ TASK_DISCIPLINE_COMPLETE,
157
+ TASK_DISCIPLINE_GOALS,
158
+ TASK_DISCIPLINE_LIFECYCLE,
159
+ TASK_DISCIPLINE_OPERATION,
160
+ TASK_DISCIPLINE_PROMPT
161
+ } from "./shared/@ai-setting/roy-agent-core-4jjwewvw.js";
162
+ import"./shared/@ai-setting/roy-agent-core-1w9y7mxj.js";
163
+ import"./shared/@ai-setting/roy-agent-core-46rv4d7d.js";
157
164
  import {
158
165
  WorkflowComponent
159
166
  } from "./shared/@ai-setting/roy-agent-core-37tj4y6a.js";
@@ -666,6 +673,11 @@ export {
666
673
  TaskTagPlugin,
667
674
  TaskHookPoints,
668
675
  TaskComponent,
676
+ TASK_DISCIPLINE_PROMPT,
677
+ TASK_DISCIPLINE_OPERATION,
678
+ TASK_DISCIPLINE_LIFECYCLE,
679
+ TASK_DISCIPLINE_GOALS,
680
+ TASK_DISCIPLINE_COMPLETE,
669
681
  SpanStatus,
670
682
  SpanKind,
671
683
  SkillComponent,
@@ -5,12 +5,12 @@ import {
5
5
  import {
6
6
  getSharedEventStore
7
7
  } from "./roy-agent-core-na18zwj0.js";
8
+ import {
9
+ builtInPrompts
10
+ } from "./roy-agent-core-zv8bswpw.js";
8
11
  import {
9
12
  TaskHookPoints
10
13
  } from "./roy-agent-core-1pg0fepg.js";
11
- import {
12
- builtInPrompts
13
- } from "./roy-agent-core-vaz9350j.js";
14
14
  import {
15
15
  DEFAULT_SUBAGENT_PROMPT
16
16
  } from "./roy-agent-core-07fvy74y.js";
@@ -4,7 +4,7 @@ import {
4
4
  createLayaDecisionPlugin,
5
5
  loadLayaAuthForPurpose,
6
6
  pickGateConfidence
7
- } from "./roy-agent-core-hx46nhh1.js";
7
+ } from "./roy-agent-core-k13pxrpk.js";
8
8
  import {
9
9
  TaskHookPoints
10
10
  } from "./roy-agent-core-1pg0fepg.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LarkCardPatchNotifier,
3
3
  formatDurationMs
4
- } from "./roy-agent-core-tadj19vp.js";
4
+ } from "./roy-agent-core-46rv4d7d.js";
5
5
  import {
6
6
  WorkflowHookPoints,
7
7
  init_workflow_hook_points
@@ -271,7 +271,68 @@ function milestoneKey(m) {
271
271
  return `${m.title}|${m.timestamp ?? ""}|${m.description ?? ""}`;
272
272
  }
273
273
  function processStepKey(s) {
274
- return `${s.title}|${s.timestamp ?? ""}|${s.endTimestamp ?? ""}|${s.description ?? ""}`;
274
+ if (s.id)
275
+ return `id:${s.id}`;
276
+ return [
277
+ s.title,
278
+ s.timestamp ?? "",
279
+ s.endTimestamp ?? "",
280
+ s.description ?? "",
281
+ s.category ?? "",
282
+ s.source ?? ""
283
+ ].join("|");
284
+ }
285
+ function partitionProcessSteps(steps) {
286
+ const operations = [];
287
+ const toolTraces = [];
288
+ for (const s of steps) {
289
+ if (s.source === "tool-trace")
290
+ toolTraces.push(s);
291
+ else
292
+ operations.push(s);
293
+ }
294
+ return { operations, toolTraces };
295
+ }
296
+ function buildTimelineElements(milestones, processSteps) {
297
+ const elements = [];
298
+ const { operations, toolTraces } = partitionProcessSteps(processSteps);
299
+ if (milestones.length > 0) {
300
+ elements.push({ tag: "markdown", content: `## \uD83C\uDFAF 里程碑序列` });
301
+ elements.push({ tag: "markdown", content: renderMilestones(milestones) });
302
+ }
303
+ if (operations.length > 0) {
304
+ if (elements.length > 0)
305
+ elements.push({ tag: "hr" });
306
+ elements.push({ tag: "markdown", content: `## \uD83D\uDCDD 操作记录` });
307
+ elements.push({ tag: "markdown", content: renderProcessSteps(operations) });
308
+ }
309
+ if (toolTraces.length > 0) {
310
+ if (elements.length > 0)
311
+ elements.push({ tag: "hr" });
312
+ elements.push({
313
+ tag: "markdown",
314
+ content: `## \uD83D\uDD27 执行轨迹(工具调用)`
315
+ });
316
+ elements.push({
317
+ tag: "markdown",
318
+ content: renderProcessSteps(toolTraces)
319
+ });
320
+ }
321
+ return {
322
+ elements,
323
+ opCount: operations.length,
324
+ toolCount: toolTraces.length
325
+ };
326
+ }
327
+ function buildTimelinePanelTitle(milestoneCount, opCount, toolCount) {
328
+ const parts = [];
329
+ if (milestoneCount > 0)
330
+ parts.push(`${milestoneCount} 里程碑`);
331
+ if (opCount > 0)
332
+ parts.push(`${opCount} 操作记录`);
333
+ if (toolCount > 0)
334
+ parts.push(`${toolCount} 工具调用`);
335
+ return `⏱️ 执行动态${parts.length > 0 ? `(${parts.join(" / ")})` : ""}`;
275
336
  }
276
337
  function buildTaskCard(opts) {
277
338
  const status = opts.status ?? "running";
@@ -313,36 +374,13 @@ function buildTaskCard(opts) {
313
374
  }));
314
375
  appendHr(elements);
315
376
  }
316
- const timelineElements = [];
317
- if (milestones.length > 0) {
318
- timelineElements.push({
319
- tag: "markdown",
320
- content: `## \uD83C\uDFAF 里程碑序列`
321
- });
322
- timelineElements.push({
323
- tag: "markdown",
324
- content: renderMilestones(milestones)
325
- });
326
- }
327
- if (processSteps.length > 0) {
328
- if (timelineElements.length > 0)
329
- timelineElements.push({ tag: "hr" });
330
- timelineElements.push({
331
- tag: "markdown",
332
- content: `## \uD83D\uDD27 过程信息`
333
- });
334
- timelineElements.push({
335
- tag: "markdown",
336
- content: renderProcessSteps(processSteps)
337
- });
338
- }
339
- if (timelineElements.length > 0) {
340
- const timelineTitle = `⏱️ 执行动态(${milestones.length} 里程碑 / ${processSteps.length} 过程)`;
377
+ const timeline = buildTimelineElements(milestones, processSteps);
378
+ if (timeline.elements.length > 0) {
341
379
  elements.push(buildCollapsiblePanel({
342
- title: timelineTitle,
380
+ title: buildTimelinePanelTitle(milestones.length, timeline.opCount, timeline.toolCount),
343
381
  elementId: "task_timeline",
344
382
  expanded: opts.expandTimeline ?? isTerminalStatusForTimeline(status),
345
- elements: timelineElements
383
+ elements: timeline.elements
346
384
  }));
347
385
  }
348
386
  appendHr(elements);
@@ -468,29 +506,13 @@ function buildWorkflowCard(opts) {
468
506
  }));
469
507
  appendHr(elements);
470
508
  }
471
- const timelineElements = [];
472
- if (milestones.length > 0) {
473
- timelineElements.push({ tag: "markdown", content: `## \uD83C\uDFAF 里程碑序列` });
474
- timelineElements.push({
475
- tag: "markdown",
476
- content: renderMilestones(milestones)
477
- });
478
- }
479
- if (processSteps.length > 0) {
480
- if (timelineElements.length > 0)
481
- timelineElements.push({ tag: "hr" });
482
- timelineElements.push({ tag: "markdown", content: `## \uD83D\uDD27 过程信息` });
483
- timelineElements.push({
484
- tag: "markdown",
485
- content: renderProcessSteps(processSteps)
486
- });
487
- }
488
- if (timelineElements.length > 0) {
509
+ const timeline = buildTimelineElements(milestones, processSteps);
510
+ if (timeline.elements.length > 0) {
489
511
  elements.push(buildCollapsiblePanel({
490
- title: `⏱️ 执行动态(${milestones.length} 里程碑 / ${processSteps.length} 过程)`,
512
+ title: buildTimelinePanelTitle(milestones.length, timeline.opCount, timeline.toolCount),
491
513
  elementId: "workflow_timeline",
492
514
  expanded: opts.expandTimeline ?? isTerminalStatusForWorkflowTimeline(status),
493
- elements: timelineElements
515
+ elements: timeline.elements
494
516
  }));
495
517
  }
496
518
  const effectiveProgress = status === "completed" ? 100 : deriveProgress({
@@ -1251,4 +1273,4 @@ function sanitize(text) {
1251
1273
  return `${trimmed.slice(0, 500)}…`;
1252
1274
  }
1253
1275
 
1254
- export { formatTimestampForDisplay, sanitizeInlineText, formatDateTimeForDisplay, renderProgressBar, resolveTaskTitleForDisplay, humanizeValue, isTerminalStatusForTimeline, isTerminalStatusForWorkflowTimeline, buildCollapsiblePanel, renderTaskInfoLines, renderContextAsLines, renderMilestones, renderProcessSteps, buildTaskCard, buildChatAppLink, DEFAULT_APP_LINK_BASE, formatDurationMs, renderWorkflowInfoLines, buildWorkflowCard, LarkCardPatchNotifier };
1276
+ export { formatTimestampForDisplay, sanitizeInlineText, formatDateTimeForDisplay, renderProgressBar, resolveTaskTitleForDisplay, humanizeValue, isTerminalStatusForTimeline, isTerminalStatusForWorkflowTimeline, buildCollapsiblePanel, renderTaskInfoLines, renderContextAsLines, renderMilestones, renderProcessSteps, partitionProcessSteps, buildTaskCard, buildChatAppLink, DEFAULT_APP_LINK_BASE, formatDurationMs, renderWorkflowInfoLines, buildWorkflowCard, LarkCardPatchNotifier };