@ai-setting/roy-agent-core 1.7.77 → 1.7.88

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 (155) hide show
  1. package/dist/config/config-protection.d.ts +89 -0
  2. package/dist/config/index.d.ts +1 -0
  3. package/dist/config/index.js +23 -7
  4. package/dist/env/agent/agent-component.d.ts +43 -22
  5. package/dist/env/agent/agent-component.js +13 -12
  6. package/dist/env/agent/index.js +13 -12
  7. package/dist/env/agent/types.d.ts +46 -12
  8. package/dist/env/commands/index.js +7 -7
  9. package/dist/env/context/index.js +3 -3
  10. package/dist/env/debug/index.js +7 -7
  11. package/dist/env/error-reply.d.ts +6 -0
  12. package/dist/env/error-reply.js +1 -1
  13. package/dist/env/event-source/bounty-im-handler.d.ts +8 -0
  14. package/dist/env/event-source/es-command.d.ts +39 -0
  15. package/dist/env/event-source/es-plugins.d.ts +68 -0
  16. package/dist/env/event-source/event-source-component.d.ts +15 -0
  17. package/dist/env/event-source/event-source-handlers.d.ts +84 -0
  18. package/dist/env/event-source/event-source-handlers.js +40 -23
  19. package/dist/env/event-source/event-store.js +2 -2
  20. package/dist/env/event-source/index.d.ts +5 -1
  21. package/dist/env/event-source/index.js +75 -23
  22. package/dist/env/event-source/timer-handler.d.ts +98 -0
  23. package/dist/env/event-source/types.d.ts +154 -2
  24. package/dist/env/event-source/wecom-card-action-handler.d.ts +373 -0
  25. package/dist/env/event-source/wecom-card-builder.d.ts +426 -0
  26. package/dist/env/event-source/wecom-cli-handler.d.ts +291 -0
  27. package/dist/env/event-source/wecom-cli-sender.d.ts +88 -0
  28. package/dist/env/event-source/wecom-media.d.ts +130 -0
  29. package/dist/env/event-source/wecom-respond-registry.d.ts +151 -0
  30. package/dist/env/event-source/wecom-respond-registry.js +33 -0
  31. package/dist/env/event-source/wecom-session-card-sender.d.ts +135 -0
  32. package/dist/env/event-source/wecom-session-card-sender.js +153 -0
  33. package/dist/env/event-source/wecom-ws-bridge.d.ts +213 -0
  34. package/dist/env/hook/index.js +5 -5
  35. package/dist/env/index.js +51 -45
  36. package/dist/env/llm/index.js +9 -8
  37. package/dist/env/log-trace/index.js +7 -7
  38. package/dist/env/log-trace/trace-filters.d.ts +6 -1
  39. package/dist/env/mcp/index.js +7 -7
  40. package/dist/env/memory/index.js +7 -7
  41. package/dist/env/plugin/index.js +7 -7
  42. package/dist/env/prompt/index.js +8 -8
  43. package/dist/env/prompt/prompts-index.d.ts +1 -1
  44. package/dist/env/session/group-session-link.d.ts +99 -0
  45. package/dist/env/session/index.js +11 -10
  46. package/dist/env/session/session-component.d.ts +89 -0
  47. package/dist/env/session/storage/index.js +5 -4
  48. package/dist/env/session/types.d.ts +10 -0
  49. package/dist/env/skill/index.js +7 -7
  50. package/dist/env/task/delegate/delegate-channel-hint.d.ts +39 -0
  51. package/dist/env/task/delegate/delegate-tool.d.ts +132 -7
  52. package/dist/env/task/delegate/delegate-tool.js +13 -9
  53. package/dist/env/task/delegate/index.js +8 -8
  54. package/dist/env/task/index.js +18 -18
  55. package/dist/env/task/mcp/index.js +4 -4
  56. package/dist/env/task/plugins/card-subject.d.ts +117 -0
  57. package/dist/env/task/plugins/index.d.ts +2 -0
  58. package/dist/env/task/plugins/index.js +39 -16
  59. package/dist/env/task/plugins/lark-card-action-handler.d.ts +261 -6
  60. package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +542 -2
  61. package/dist/env/task/plugins/lark-card-patch-notifier.js +12 -2
  62. package/dist/env/task/plugins/lark-card-state-store.d.ts +60 -0
  63. package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +61 -0
  64. package/dist/env/task/plugins/sub-session-activity.d.ts +415 -0
  65. package/dist/env/task/plugins/wecom-card-state-store.d.ts +121 -0
  66. package/dist/env/task/plugins/wecom-session-card-store.d.ts +134 -0
  67. package/dist/env/task/plugins/wecom-session-card-store.js +23 -0
  68. package/dist/env/task/plugins/wecom-task-notify-plugin.d.ts +264 -0
  69. package/dist/env/task/storage/index.js +3 -3
  70. package/dist/env/task/tools/index.js +4 -4
  71. package/dist/env/tool/built-in/index.d.ts +2 -0
  72. package/dist/env/tool/built-in/index.js +9 -2
  73. package/dist/env/tool/index.js +14 -9
  74. package/dist/env/tool/types.d.ts +25 -0
  75. package/dist/env/tool/validator.d.ts +8 -0
  76. package/dist/env/workflow/engine/index.js +12 -12
  77. package/dist/env/workflow/hooks/index.js +7 -7
  78. package/dist/env/workflow/index.js +24 -23
  79. package/dist/env/workflow/nodes/index.js +2 -2
  80. package/dist/env/workflow/plugins/index.js +10 -8
  81. package/dist/env/workflow/service/index.js +2 -2
  82. package/dist/env/workflow/storage/index.js +3 -3
  83. package/dist/env/workflow/tools/index.js +16 -15
  84. package/dist/env/workflow/utils/index.js +4 -4
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.js +118 -62
  87. package/dist/shared/@ai-setting/{roy-agent-core-dc9zq75z.js → roy-agent-core-0crmsc12.js} +3 -3
  88. package/dist/shared/@ai-setting/{roy-agent-core-aa2j7bk9.js → roy-agent-core-0sbmdz8d.js} +171 -36
  89. package/dist/shared/@ai-setting/{roy-agent-core-87942bw4.js → roy-agent-core-1mhyh4c5.js} +1 -1
  90. package/dist/shared/@ai-setting/{roy-agent-core-v6vr6za7.js → roy-agent-core-1vv4fx15.js} +4 -4
  91. package/dist/shared/@ai-setting/roy-agent-core-2stt4rp5.js +134 -0
  92. package/dist/shared/@ai-setting/{roy-agent-core-nwbfepba.js → roy-agent-core-3e040tc5.js} +1 -1
  93. package/dist/shared/@ai-setting/roy-agent-core-418zc9ha.js +288 -0
  94. package/dist/shared/@ai-setting/{roy-agent-core-r5wt1h3c.js → roy-agent-core-4fkxy2gv.js} +1 -1
  95. package/dist/shared/@ai-setting/{roy-agent-core-na18zwj0.js → roy-agent-core-4t3yskp8.js} +1 -1
  96. package/dist/shared/@ai-setting/{roy-agent-core-5pr4zp88.js → roy-agent-core-5kzhaap1.js} +1 -1
  97. package/dist/shared/@ai-setting/{roy-agent-core-qq96p0tj.js → roy-agent-core-5s2t8z00.js} +22 -1
  98. package/dist/shared/@ai-setting/{roy-agent-core-6rh8k6ba.js → roy-agent-core-6gj1hc5z.js} +7 -7
  99. package/dist/shared/@ai-setting/{roy-agent-core-ezvpreqz.js → roy-agent-core-6k8mb7zx.js} +1 -1
  100. package/dist/shared/@ai-setting/{roy-agent-core-g8htfwxj.js → roy-agent-core-7f10p7m2.js} +1 -1
  101. package/dist/shared/@ai-setting/roy-agent-core-7kvpc0w5.js +177 -0
  102. package/dist/shared/@ai-setting/{roy-agent-core-h21gngxf.js → roy-agent-core-7yh5wps0.js} +1 -1
  103. package/dist/shared/@ai-setting/{roy-agent-core-efkjyh69.js → roy-agent-core-9710zwwz.js} +1 -1
  104. package/dist/shared/@ai-setting/{roy-agent-core-6cy43nss.js → roy-agent-core-9c565frx.js} +49 -9
  105. package/dist/shared/@ai-setting/{roy-agent-core-fghc2m8z.js → roy-agent-core-aa8kv18f.js} +34 -2
  106. package/dist/shared/@ai-setting/{roy-agent-core-ew6qb5yx.js → roy-agent-core-an35dzbf.js} +6 -6
  107. package/dist/shared/@ai-setting/{roy-agent-core-mww0mnd9.js → roy-agent-core-azyz78ky.js} +7 -7
  108. package/dist/shared/@ai-setting/{roy-agent-core-264qexac.js → roy-agent-core-b7h39vrc.js} +4 -4
  109. package/dist/shared/@ai-setting/{roy-agent-core-dqxec05w.js → roy-agent-core-bjtc9d35.js} +2 -2
  110. package/dist/shared/@ai-setting/roy-agent-core-c4ec7k0p.js +426 -0
  111. package/dist/shared/@ai-setting/{roy-agent-core-ddyk1rc0.js → roy-agent-core-cre2y2ct.js} +160 -4
  112. package/dist/shared/@ai-setting/{roy-agent-core-tr3ep81v.js → roy-agent-core-d6zdbgtc.js} +1 -1
  113. package/dist/shared/@ai-setting/{roy-agent-core-0qyrk5k0.js → roy-agent-core-ds6qzmf8.js} +14 -5
  114. package/dist/shared/@ai-setting/{roy-agent-core-cgtq6427.js → roy-agent-core-e08bvpaq.js} +1 -1
  115. package/dist/shared/@ai-setting/{roy-agent-core-12n08pg5.js → roy-agent-core-e69qxdyy.js} +1 -1
  116. package/dist/shared/@ai-setting/{roy-agent-core-rhtdspx6.js → roy-agent-core-fan8g0z1.js} +10 -10
  117. package/dist/shared/@ai-setting/{roy-agent-core-xcp8vwax.js → roy-agent-core-fepm835e.js} +2 -2
  118. package/dist/shared/@ai-setting/{roy-agent-core-6j02sbee.js → roy-agent-core-fhg03v43.js} +1 -1
  119. package/dist/shared/@ai-setting/{roy-agent-core-99nwgj84.js → roy-agent-core-fzw9xzm1.js} +1 -1
  120. package/dist/shared/@ai-setting/{roy-agent-core-dvtg4sn0.js → roy-agent-core-g8yr733d.js} +1 -1
  121. package/dist/shared/@ai-setting/{roy-agent-core-3gpygqcx.js → roy-agent-core-gr5h1dyr.js} +2753 -358
  122. package/dist/shared/@ai-setting/roy-agent-core-h1e1fm9b.js +380 -0
  123. package/dist/shared/@ai-setting/{roy-agent-core-c2gbt68e.js → roy-agent-core-h83zdsrq.js} +2 -2
  124. package/dist/shared/@ai-setting/{roy-agent-core-8ez6mccb.js → roy-agent-core-k3gcvybs.js} +5 -1
  125. package/dist/shared/@ai-setting/{roy-agent-core-pgvcf91v.js → roy-agent-core-m39v7qpx.js} +2 -2
  126. package/dist/shared/@ai-setting/{roy-agent-core-tm1mxttk.js → roy-agent-core-mf5p38yf.js} +2 -2
  127. package/dist/shared/@ai-setting/{roy-agent-core-83bewqx8.js → roy-agent-core-mvh0td7p.js} +2 -2
  128. package/dist/shared/@ai-setting/{roy-agent-core-v85n42ve.js → roy-agent-core-mx855td4.js} +17 -38
  129. package/dist/shared/@ai-setting/{roy-agent-core-v87njmq7.js → roy-agent-core-n197medr.js} +13 -13
  130. package/dist/shared/@ai-setting/{roy-agent-core-cmprygrp.js → roy-agent-core-nqkfkpf4.js} +4 -4
  131. package/dist/shared/@ai-setting/{roy-agent-core-7cbpmk4q.js → roy-agent-core-p31ftgq9.js} +1 -1
  132. package/dist/shared/@ai-setting/{roy-agent-core-vffccgf6.js → roy-agent-core-qwd2dq5q.js} +10 -3
  133. package/dist/shared/@ai-setting/{roy-agent-core-rsn44n9y.js → roy-agent-core-ra66sf50.js} +2526 -942
  134. package/dist/shared/@ai-setting/{roy-agent-core-1v4g0d4x.js → roy-agent-core-rm7seqwb.js} +1 -1
  135. package/dist/shared/@ai-setting/{roy-agent-core-w0qjeq2v.js → roy-agent-core-shb1qsyg.js} +1041 -18
  136. package/dist/shared/@ai-setting/{roy-agent-core-ax9e9szb.js → roy-agent-core-smf94h73.js} +1 -1
  137. package/dist/shared/@ai-setting/{roy-agent-core-acj8ag08.js → roy-agent-core-tjnabyvq.js} +1 -1
  138. package/dist/shared/@ai-setting/{roy-agent-core-qqaak24r.js → roy-agent-core-tkpp1ba0.js} +1 -1
  139. package/dist/shared/@ai-setting/{roy-agent-core-9vhq7fvv.js → roy-agent-core-tpm1dd1g.js} +34 -88
  140. package/dist/shared/@ai-setting/{roy-agent-core-ed233k5z.js → roy-agent-core-v1n0106v.js} +1 -1
  141. package/dist/shared/@ai-setting/{roy-agent-core-zxz5fkwj.js → roy-agent-core-v6yshv0z.js} +1 -1
  142. package/dist/shared/@ai-setting/{roy-agent-core-mcy5apay.js → roy-agent-core-vf9sp6s3.js} +1 -1
  143. package/dist/shared/@ai-setting/{roy-agent-core-q813vafd.js → roy-agent-core-vpcxv1ty.js} +1 -1
  144. package/dist/shared/@ai-setting/{roy-agent-core-bxkjk7zx.js → roy-agent-core-vx8zc847.js} +4 -1
  145. package/dist/shared/@ai-setting/{roy-agent-core-xvt7kf7p.js → roy-agent-core-w9ryeg2p.js} +3 -3
  146. package/dist/shared/@ai-setting/{roy-agent-core-es203w7p.js → roy-agent-core-wqs6yypq.js} +1 -1
  147. package/dist/shared/@ai-setting/{roy-agent-core-hd3n57zs.js → roy-agent-core-wr1qexzq.js} +5 -5
  148. package/dist/shared/@ai-setting/roy-agent-core-wxrkcb17.js +56 -0
  149. package/dist/shared/@ai-setting/{roy-agent-core-0snm5hc5.js → roy-agent-core-y6shd91r.js} +1 -1
  150. package/dist/shared/@ai-setting/{roy-agent-core-9vxh6f8h.js → roy-agent-core-y7fqtzk2.js} +7 -7
  151. package/dist/shared/@ai-setting/{roy-agent-core-cpcd24n2.js → roy-agent-core-yet36q5k.js} +2 -2
  152. package/dist/shared/@ai-setting/{roy-agent-core-3fh1f7s7.js → roy-agent-core-yfpnkc4z.js} +5 -5
  153. package/dist/shared/@ai-setting/{roy-agent-core-0v27y99n.js → roy-agent-core-yh68z1bg.js} +65 -4
  154. package/package.json +18 -1
  155. /package/dist/shared/@ai-setting/{roy-agent-core-b4x6x4k2.js → roy-agent-core-m1fgtnrc.js} +0 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @fileoverview 关联建群:群 session 的初始化(Task #5403)
3
+ *
4
+ * ## 为什么不再用 alias / linkedTo
5
+ *
6
+ * #5369 的实现让「群 session」成为原 sub-session 的 **alias** —— 消息读写全部
7
+ * 透传到原会话,两个 session 看到同一份 history。用户实测(#5396)后否决:
8
+ *
9
+ * 1. **LLM prefix cache 失效**:群 session 由 **default agent** 的 system
10
+ * prompt 驱动,原 sub session 由 **sub agent** 驱动。system prompt 一变,
11
+ * prefix 就不一样,history 全部得重新 prefill。
12
+ * 2. **语义污染**:sub agent 的 delegate prompt 里有「不要发飞书消息(回复由
13
+ * 主 agent 负责)」这类硬约束。这些约束在新群的历史里被当成**当前生效
14
+ * 指令**,于是群里的 agent 真的不回复(#5396 实测 0 出站)。
15
+ *
16
+ * ## 新方案(用户定稿)
17
+ *
18
+ * 建群成功 ⇒ 群 session 是**完全独立的 session**,只注入 **1 条 user role
19
+ * 消息**(不是 system,不是 assistant —— 与 notify event / 飞书 event 的注入
20
+ * 方式一致),说明:
21
+ *
22
+ * - 本群由哪个 session 关联建群而来(溯源)
23
+ * - 需要背景时怎么读(`roy-agent sessions messages <id> -n 50`,按需拉取)
24
+ * - 明确「历史不在本群上下文中」——避免模型凭空脑补
25
+ *
26
+ * 关联关系本身写进群 session 的 metadata(`linkedFromSessionId` /
27
+ * `groupCreatedAt`),用于重复建群保护 / 卡片显示群链接 / 解绑。
28
+ *
29
+ * 本文件只放**纯函数**(无 IO),便于单测与复用。
30
+ */
31
+ /** 注入事件的内容里,建议模型按需读取的历史条数 */
32
+ export declare const GROUP_LINK_READ_HINT_LIMIT = 50;
33
+ /**
34
+ * 群 session metadata 里的溯源字段。
35
+ *
36
+ * 这些字段取代了已废弃的 `Session.linkedTo`:
37
+ * - `linkedFromSessionId` —— 本群由哪个 session 关联建群而来
38
+ * - `groupCreatedAt` —— 关联建群时间(ISO 8601)
39
+ * - `groupDisbandedAt` —— 解绑时间(ISO 8601);存在即视为「已解散」
40
+ */
41
+ export declare const GROUP_LINK_METADATA_KEYS: {
42
+ readonly linkedFromSessionId: "linkedFromSessionId";
43
+ readonly groupCreatedAt: "groupCreatedAt";
44
+ readonly groupDisbandedAt: "groupDisbandedAt";
45
+ };
46
+ /**
47
+ * 构造「关联建群」注入事件的消息体。
48
+ *
49
+ * 设计约束(用户明令):
50
+ * - **role = user**:与 notify event / 飞书 event 的注入方式保持一致,
51
+ * 不用 system(system prompt 有自己的组装链路,混进去会破坏 cache)。
52
+ * - **不复制历史**:只有这一条,模型要看细节自己去读。
53
+ * - **明确可执行路径**:给出 `sessions messages` 命令,让模型知道怎么取。
54
+ * - **明确边界**:告诉模型「历史上那些任务型约束(如不要发飞书消息)
55
+ * 只对当时那轮生效」,避免 #5396 的污染复发。
56
+ *
57
+ * @param originSessionId 原 session id(群是由它关联建出来的)
58
+ * @param chatId 飞书群 chat id(群 session 的 id)
59
+ * @param createdAt 建群时间(默认 now)
60
+ */
61
+ export declare function buildGroupLinkEventMessage(args: {
62
+ originSessionId: string;
63
+ chatId?: string;
64
+ createdAt?: Date | string;
65
+ }): {
66
+ role: "user";
67
+ content: string;
68
+ };
69
+ /**
70
+ * 构造群 session 的 metadata(合并到已有 metadata 上)。
71
+ *
72
+ * 保留已有的 `chatId` / `type` 等识别键 —— 事件层 `ensureChatSession` 靠
73
+ * `metadata.chatId + type:'lark-chat'` 找群 session,不能被覆盖掉。
74
+ */
75
+ export declare function buildGroupSessionMetadata(args: {
76
+ chatId: string;
77
+ originSessionId: string;
78
+ createdAt?: Date | string;
79
+ base?: Record<string, unknown>;
80
+ }): Record<string, unknown>;
81
+ /**
82
+ * 判断一个 session 的 metadata 是否标记为「群已解散」。
83
+ *
84
+ * 解绑后群在飞书侧已删,反查不该再把它当成「这个会话的群」(否则卡片永远
85
+ * 显示「解散该群」、下次建群幂等命中死群)。
86
+ */
87
+ export declare function isGroupDisbanded(metadata: Record<string, unknown> | undefined): boolean;
88
+ /**
89
+ * 判断一个 session 是否是「某个 session 的关联群 session」。
90
+ *
91
+ * 三个标记必须同时齐备(沿用 #5397 CV R2 的三条 marker 思路):
92
+ * 1. `metadata.type === 'lark-chat'`
93
+ * 2. `metadata.chatId` 非空
94
+ * 3. `metadata.linkedFromSessionId` 非空
95
+ *
96
+ * 缺一条就不认 —— 避免把普通的飞书 chat session / 别的写入方造的脏数据
97
+ * 误判成群 session。
98
+ */
99
+ export declare function isGroupSessionOf(metadata: Record<string, unknown> | undefined, originSessionId: string): boolean;
@@ -3,24 +3,25 @@ import {
3
3
  MIN_SESSION_ID_LENGTH,
4
4
  SessionComponent,
5
5
  isValidSessionId
6
- } from "../../shared/@ai-setting/roy-agent-core-ddyk1rc0.js";
6
+ } from "../../shared/@ai-setting/roy-agent-core-cre2y2ct.js";
7
7
  import {
8
8
  MemorySessionStore
9
- } from "../../shared/@ai-setting/roy-agent-core-0qyrk5k0.js";
9
+ } from "../../shared/@ai-setting/roy-agent-core-ds6qzmf8.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
11
11
  import {
12
12
  SessionMessageConverter
13
- } from "../../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
14
- import"../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
13
+ } from "../../shared/@ai-setting/roy-agent-core-y6shd91r.js";
14
+ import"../../shared/@ai-setting/roy-agent-core-aa8kv18f.js";
15
+ import"../../shared/@ai-setting/roy-agent-core-wxrkcb17.js";
15
16
  import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
16
17
  import"../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
17
18
  import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
18
- import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
19
- import"../../shared/@ai-setting/roy-agent-core-ax9e9szb.js";
20
- import"../../shared/@ai-setting/roy-agent-core-cpcd24n2.js";
21
- import"../../shared/@ai-setting/roy-agent-core-qqaak24r.js";
22
- import"../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
23
- import"../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-m39v7qpx.js";
20
+ import"../../shared/@ai-setting/roy-agent-core-smf94h73.js";
21
+ import"../../shared/@ai-setting/roy-agent-core-yet36q5k.js";
22
+ import"../../shared/@ai-setting/roy-agent-core-tkpp1ba0.js";
23
+ import"../../shared/@ai-setting/roy-agent-core-p31ftgq9.js";
24
+ import"../../shared/@ai-setting/roy-agent-core-5s2t8z00.js";
24
25
  import"../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
25
26
  import"../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
26
27
  import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
@@ -183,6 +183,95 @@ export declare class SessionComponent extends BaseComponent {
183
183
  * Delete a session
184
184
  */
185
185
  delete(id: string): Promise<boolean>;
186
+ /**
187
+ * ★ Task #5403:**会话 → 群** 反向查询(取代 #5397 的 alias 版)。
188
+ *
189
+ * ## 背景
190
+ *
191
+ * alias / linkedTo 能力已整体废弃(用户 2026-11-12 定稿)。建群后的群
192
+ * session 是**独立 session**,不再共享原会话的消息历史 —— 原因:
193
+ * 1. 群 session 由 default agent 的 system prompt 驱动,原 sub session 由
194
+ * sub agent 驱动,复用同一份 history 会让 LLM prefix cache 失效;
195
+ * 2. sub agent 的 delegate prompt(如「不要发飞书消息」)会污染群对话。
196
+ *
197
+ * 新方案:建群时向新 session 注入 **1 条 user role 事件**说明「本群由
198
+ * session X 关联建群,需要背景时用 `roy-agent sessions messages X` 按需读取」,
199
+ * 关联关系本身记在 metadata(`linkedFromSessionId` / `groupCreatedAt`)。
200
+ *
201
+ * ## 用途(三处,与 #5397 一致)
202
+ * 1. 重复建群保护(同 session 已有群 ⇒ 返回已有链接,不新建)
203
+ * 2. 卡片显示已有群链接(session 卡渲染 `perTaskChatId`)
204
+ * 3. 解绑时定位要解散哪个群
205
+ *
206
+ * ## 实现
207
+ *
208
+ * 扫 `metadata.linkedFromSessionId === sessionId` 的 session 行,取它的
209
+ * chatId(来自 `metadata.chatId`,群 session 的识别键)。
210
+ *
211
+ * 走 store 的 metadata filter(SQLite 侧是 JSON1 `json_extract`,不扫全表
212
+ * 之外的额外成本;无 schema 变更、无新索引)。
213
+ *
214
+ * **自称命中**:入参本身是群 session 时,它自己就带
215
+ * `linkedFromSessionId`,此时直接返回自身 —— 因为 `list` 用
216
+ * `linkedFromSessionId = sessionId` 过滤,那个群 session 的
217
+ * `linkedFromSessionId` 指向的是**原会话**而不是自己,所以需要额外一次
218
+ * `get(sessionId)` 自身检查(见下方逻辑)。
219
+ */
220
+ findGroupChatForSession(sessionId: string): Promise<{
221
+ chatId: string;
222
+ aliasSessionId?: string;
223
+ } | undefined>;
224
+ /**
225
+ * ★ Task #5403:**关联建群** —— 建群成功后初始化群 session。
226
+ *
227
+ * 取代 #5369/#5397 的 `linkSession(aliasId, target)`。区别是**不共享历史**:
228
+ *
229
+ * - 群 session 是独立 session(自己持有消息,读写不透明)
230
+ * - 只注入 **1 条 user role** 事件,说明「本群由 session X 关联建群
231
+ * 而来,需要背景时执行 `roy-agent sessions messages X -n 50` 按需读取」
232
+ * - 关联关系写进 metadata(`linkedFromSessionId` / `groupCreatedAt`),
233
+ * 供重复建群保护 / 卡片链接 / 解绑使用
234
+ *
235
+ * ## 幂等
236
+ *
237
+ * 若该 chatId 的 session 已存在且已登记 `linkedFromSessionId`,**不重复
238
+ * 注入**(只补齐缺失的 metadata),返回 `injected: false`。这让「重复点
239
+ * 建群」不会在群里堆一串说明消息。
240
+ *
241
+ * ## 失败语义
242
+ *
243
+ * 返回 `{ ok: false, reason }`,不抛。调用方(建群流程)拿到后只 warn ——
244
+ * 群已经建好了,不能因为初始化失败把结果翻成失败。
245
+ *
246
+ * @param chatId 飞书群 chat id(同时是群 session 的 id)
247
+ * @param originSessionId 原 session id(群是由它关联建出来的)
248
+ */
249
+ attachGroupSession(args: {
250
+ chatId: string;
251
+ originSessionId: string;
252
+ title?: string;
253
+ }): Promise<{
254
+ ok: true;
255
+ sessionId: string;
256
+ injected: boolean;
257
+ } | {
258
+ ok: false;
259
+ reason: "store_unavailable" | "invalid_args";
260
+ error?: string;
261
+ }>;
262
+ /**
263
+ * ★ Task #5403:**解绑关联群** —— 标记 metadata 为已解散。
264
+ *
265
+ * 取代 #5369 的 `unlinkSession(aliasId)`(原语义是把 linkedTo 置 null)。
266
+ * 新语义:群 session 本身是独立会话,解绑只是把「这个群还活着」的标记
267
+ * 打掉 —— 写入 `groupDisbandedAt`,让 `findGroupChatForSession` 不再命中它。
268
+ *
269
+ * 幂等:已经标记过直接返回 ok。
270
+ */
271
+ detachGroupSession(chatId: string): Promise<{
272
+ ok: boolean;
273
+ reason?: string;
274
+ }>;
186
275
  /**
187
276
  * 飞书 chat_id → task_id 反向绑定缓存(LRU + TTL)
188
277
  *
@@ -3,12 +3,13 @@ import {
3
3
  SQLiteSessionStore,
4
4
  getDefaultDataDir,
5
5
  getDefaultSessionDbPath
6
- } from "../../../shared/@ai-setting/roy-agent-core-0qyrk5k0.js";
7
- import"../../../shared/@ai-setting/roy-agent-core-0snm5hc5.js";
8
- import"../../../shared/@ai-setting/roy-agent-core-fghc2m8z.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-ds6qzmf8.js";
7
+ import"../../../shared/@ai-setting/roy-agent-core-y6shd91r.js";
8
+ import"../../../shared/@ai-setting/roy-agent-core-aa8kv18f.js";
9
+ import"../../../shared/@ai-setting/roy-agent-core-wxrkcb17.js";
9
10
  import"../../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
10
11
  import"../../../shared/@ai-setting/roy-agent-core-ntn32q7j.js";
11
- import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
12
+ import"../../../shared/@ai-setting/roy-agent-core-5s2t8z00.js";
12
13
  import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
13
14
  import"../../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
14
15
  import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
@@ -172,6 +172,16 @@ export interface SessionMetadata extends Record<string, unknown> {
172
172
  checkpoints?: SessionCheckpointsMeta;
173
173
  checkpointDetails?: Record<string, SessionCheckpoint>;
174
174
  larkChat?: ChatTaskBinding;
175
+ /**
176
+ * 建群时登记:这个群 session 是由哪个 session「关联建群」而来的。
177
+ *
178
+ * ⚠️ 语义仅作**溯源标注**,不代表消息透传 / 共享历史。群 session 自己的
179
+ * 消息就是群里的实际对话;原会话历史需按需通过
180
+ * `roy-agent sessions messages <linkedFromSessionId>` 读取。
181
+ */
182
+ linkedFromSessionId?: string;
183
+ /** 关联建群时间(ISO 8601) */
184
+ groupCreatedAt?: string;
175
185
  }
176
186
  /**
177
187
  * 飞书群聊 → task 绑定关系
@@ -6,19 +6,19 @@ import {
6
6
  getSourcePriority,
7
7
  parseFrontmatter,
8
8
  parseSkillFile
9
- } from "../../shared/@ai-setting/roy-agent-core-5pr4zp88.js";
9
+ } from "../../shared/@ai-setting/roy-agent-core-5kzhaap1.js";
10
10
  import {
11
11
  SkillToolSchema,
12
12
  buildSkillDescription,
13
13
  createSkillTool
14
14
  } from "../../shared/@ai-setting/roy-agent-core-psvxt4c9.js";
15
15
  import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
16
- import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
17
- import"../../shared/@ai-setting/roy-agent-core-ax9e9szb.js";
18
- import"../../shared/@ai-setting/roy-agent-core-cpcd24n2.js";
19
- import"../../shared/@ai-setting/roy-agent-core-qqaak24r.js";
20
- import"../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
21
- import"../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
16
+ import"../../shared/@ai-setting/roy-agent-core-m39v7qpx.js";
17
+ import"../../shared/@ai-setting/roy-agent-core-smf94h73.js";
18
+ import"../../shared/@ai-setting/roy-agent-core-yet36q5k.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-tkpp1ba0.js";
20
+ import"../../shared/@ai-setting/roy-agent-core-p31ftgq9.js";
21
+ import"../../shared/@ai-setting/roy-agent-core-5s2t8z00.js";
22
22
  import"../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
23
23
  import"../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
24
24
  import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @fileoverview Task #5423 — delegate_task sub-agent prompt 渠道特性提示。
3
+ *
4
+ * ## 背景(用户 2026-11-13 07:14 批准的方案)
5
+ *
6
+ * delegate_task 起的 sub-agent 的 prompt 里没有渠道特性提示:
7
+ * 用户在飞书发「帮我写调研文档」→ 主 agent delegate 给 sub-agent
8
+ * → sub-agent 不知道触发渠道 → 产出物落本地路径(`/tmp/x.md`)
9
+ * 而非飞书云盘,飞书用户根本打不开。
10
+ *
11
+ * 主 agent 的 system prompt 里**有**渠道规范(lark/wecom 渠道 prompt),
12
+ * 但那套 systemPrompt 只注入主 agent;sub-agent 走
13
+ * `ensureSubAgentRegistered(basePrompt)`,只拿到自己的 basePrompt,
14
+ * 拿不到任何渠道上下文。
15
+ *
16
+ * ## 方案
17
+ *
18
+ * 渠道信息来源:delegate 时刻的 `EnvContext.replyChannel.type`
19
+ * (`lark-cli` / `wecom-cli`),已由 `captureReplyChannelSnapshot()`
20
+ * 快照到 `task.replyChannel`(Task #4042 follow-up),
21
+ * 并在 `executeWithAbort` 里可从 sub-session metadata / EnvContext 取到。
22
+ *
23
+ * - 触发渠道是飞书 → 文档类产出用**飞书云盘**(`lark-cli docs +create`)
24
+ * - 触发渠道是企微 → 对应方式(`wecom-cli doc create` / `disk files upload`)
25
+ * - 无渠道(CLI / REPL / 定时器 / 未知渠道)→ 返回 undefined,**不注入**
26
+ *
27
+ * 纯函数叶子模块:不 import delegate-tool / event-source,
28
+ * 避免回向依赖(对标 sub-session-activity.ts 的叶子模块纪律)。
29
+ */
30
+ /** 渠道提示段的章节标题(同时作为「无渠道不注入」的探针串) */
31
+ export declare const DELEGATE_CHANNEL_HINT_TITLE = "## \u6E20\u9053\u4EA4\u4ED8\u63D0\u793A\uFF08\u5F53\u524D\u4F1A\u8BDD\u6765\u81EA\u5916\u90E8\u6E20\u9053\uFF09";
32
+ /**
33
+ * 从 replyChannel.type 派生渠道特性提示段。
34
+ *
35
+ * @param channelType delegate 时刻 EnvContext.replyChannel.type
36
+ * (`"lark-cli"` / `"wecom-cli"` / 其他 / undefined)
37
+ * @returns 提示段文本;无渠道或未知渠道返回 undefined(不注入)
38
+ */
39
+ export declare function buildDelegateChannelHint(channelType: string | undefined): string | undefined;
@@ -35,13 +35,31 @@ export declare const BackgroundTaskEventTypes: {
35
35
  * - EventMessageFormatter 渲染 payload(含 question + subSessionId + rule-based hints)
36
36
  * - handleEventMessageWithEnv → executeInternal 把消息喂给主 agent LLM
37
37
  * - 主 agent 用 ask_user tool 展示问题、等用户答复
38
- * - 拿到答复后用 delegate_task(subagentType=..., existingSubSessionId=payload.subSessionId, ...)
38
+ * - 拿到答复后用 delegate_task(subagent_type=..., sub_session_id=payload.subSessionId, ...)
39
39
  * 复用 sub-session 让 sub-agent 继承消息历史继续推进(无需 resume function)。
40
40
  *
41
41
  * 关键:hints 由 BackgroundTaskManager 在构造事件时 rule-based 填充(事件自带),
42
42
  * CLI 端 formatter 只渲染,handler 端零特殊化。
43
43
  */
44
44
  readonly ASK_USER: "task.background.ask_user";
45
+ /**
46
+ * ★ 补充需求(22:31):sub-agent 启动、**但尚未建 task**。
47
+ *
48
+ * ## 为什么需要独立一个事件(不能复用 STARTED)
49
+ *
50
+ * `STARTED` 在 `createTask()` 里就发,此刻 `associatedTaskId` 还是
51
+ * `undefined`(sub-agent 还没跑、当然还没建 task)—— 所以它**无法**告诉
52
+ * 卡片层「这是 task 卡还是 session 卡」。
53
+ *
54
+ * 而用户要的是:**只要跑起来了、且没建 task,就应该有卡片可点刷新**。
55
+ *
56
+ * ⇒ 在 sub-agent 完成「是否建了 task」的判定之后(即 `COMPLETED` 时
57
+ * 反查 `associatedTaskId` 之后),若仍无 task,才补发本事件。
58
+ *
59
+ * 语义:`STARTED` = 「有后台任务在跑」(task 视角);本事件 =
60
+ * 「这次执行挂不到 task 上」(session 视角)。两者互补,不重复。
61
+ */
62
+ readonly SESSION_STARTED: "task.background.session_started";
45
63
  };
46
64
  export interface BackgroundTaskStartedPayload {
47
65
  backgroundTaskId: string;
@@ -97,8 +115,8 @@ export interface BackgroundTaskCompletedPayload {
97
115
  * - EventMessageFormatter 渲染 payload(question + subSessionId + hints)成消息
98
116
  * - handleEventMessageWithEnv → executeInternal 把消息喂给主 agent LLM
99
117
  * - 主 agent 用 ask_user tool 把 question 展示给用户
100
- * - 拿到用户答复后用 delegate_task(subagentType=payload.subagentType,
101
- * existingSubSessionId=payload.subSessionId, prompt=<用户答复>)
118
+ * - 拿到用户答复后用 delegate_task(subagent_type=payload.subagentType,
119
+ * sub_session_id=payload.subSessionId, prompt=<用户答复>)
102
120
  * 复用 sub-session 让 sub-agent 继承之前消息历史继续推进(无需 resume function)。
103
121
  *
104
122
  * hints 是 rule-based 提示数组,BackgroundTaskManager 在构造事件时填充。
@@ -162,6 +180,33 @@ export interface SubAgentSpec {
162
180
  }
163
181
  export declare const builtInSubAgents: SubAgentSpec[];
164
182
  export declare function getSubAgentSpec(id: string): SubAgentSpec | undefined;
183
+ /**
184
+ * 确保 subAgent 已注册到 AgentComponent
185
+ *
186
+ * 对于 workflow type 的 agent,跳过注册(workflow agent 不需要 system prompt 和 runtime agent)。
187
+ *
188
+ * @param agentComponent AgentComponent 实例
189
+ * @param subagentType subAgent 类型(用作 agentName)
190
+ * @param basePrompt 基础 system prompt
191
+ * @param subAgent subAgent 配置(可能包含 allowedTools)
192
+ * @param deniedTools 拒绝的工具列表
193
+ * @returns 注册的 agent 实例,workflow agent 返回 null
194
+ */
195
+ /**
196
+ * ★ Task #5333(DS review 第 2 轮 MINOR-4)— 把松散来源的 extendTools 归一。
197
+ *
198
+ * `ToolContext.metadata` 是 `Record<string, unknown>`,从里面取出的值理论上
199
+ * 可能是任意类型。`filterToolsByAgent` 用 `extendTools.includes(name)` 判断,
200
+ * 若传进来一个对象或含非字符串的数组,既不报错也永不命中 —— 表现为
201
+ * 「名单写了却不生效」的诡异静默失败。这里做一次运行时收敛:
202
+ *
203
+ * - 非数组 → undefined(视为未放行)
204
+ * - 数组 → 只保留非空字符串(trim 后),全被过滤掉则返回 undefined
205
+ *
206
+ * @param raw 来自 ToolContext.metadata 的原始值
207
+ * @returns 干净的字符串数组或 undefined
208
+ */
209
+ export declare function normalizeExtendTools(raw: unknown): string[] | undefined;
165
210
  export declare const DelegateToolParameters: z.ZodObject<{
166
211
  description: z.ZodString;
167
212
  prompt: z.ZodString;
@@ -236,6 +281,24 @@ export interface BackgroundTask {
236
281
  * 顺序 = 优先级(主模型失败后逐个尝试)。
237
282
  */
238
283
  fallbackModels?: string[];
284
+ /**
285
+ * ★ Task #5217 fix 2 — 父 agent 本次 run 的 channel systemPrompt
286
+ * (context.metadata.systemPrompt,如 lean lark 渠道 prompt)。
287
+ * 透传给 sub-agent 的 AgentContext.metadata.systemPrompt,
288
+ * 使 AgentComponent._run 把它追加到 sub-agent 的 LLM system message。
289
+ *
290
+ * 注意:与 model 一样**不写进 sub-agent 的注册配置** —— per-run
291
+ * 透传天然每次都是最新值(channel prompt 是 per-event 的)。
292
+ */
293
+ systemPrompt?: string;
294
+ /**
295
+ * ★ Task #5333 — 父 run 的渠道专用工具放行名单(AgentContext.extendTools)。
296
+ *
297
+ * 企微事件驱动的父 agent 有 `["wecom_respond"]`;委派出去的 sub-agent
298
+ * 若拿不到这份名单,`wecom_respond`(channelOnly 工具)在 sub-agent 侧
299
+ * 不可见 → 子任务无法给企微用户回复。因此随 task 一起透传。
300
+ */
301
+ extendTools?: string[];
239
302
  /**
240
303
  * ★ Task #4552 (A1):本任务被允许的运行时长(毫秒,createTask 时确定)。
241
304
  *
@@ -280,6 +343,16 @@ export interface BackgroundTask {
280
343
  profile?: string;
281
344
  params?: Record<string, unknown>;
282
345
  };
346
+ /**
347
+ * ★ Task #5265 — delegate 时刻的 pluginEnabled 快照。
348
+ *
349
+ * 后台任务通知轮(task.background.* 合成 envEvent)此前
350
+ * pluginEnabled={}(空)→ WecomTaskNotifyPlugin 等 ES 插件的
351
+ * pluginEnabled 守卫拦截 → 不发卡(用户只见纯文本)。
352
+ * createTask 时快照 parent EnvContext.pluginEnabled,
353
+ * publishBackgroundEvent 时写进 event.metadata.pluginEnabled。
354
+ */
355
+ pluginEnabledSnapshot?: Record<string, boolean>;
283
356
  }
284
357
  /**
285
358
  * Task #4794 — BackgroundTaskManager.dispose() 的行为选项。
@@ -347,6 +420,18 @@ export interface CreateBackgroundTaskOptions {
347
420
  * Task #4724 — 父 agent 的兜底模型**有序列表**,透传给 sub-agent。
348
421
  */
349
422
  fallbackModels?: string[];
423
+ /**
424
+ * ★ Task #5217 fix 2 — 父 agent 本次 run 的 channel systemPrompt
425
+ * (context.metadata.systemPrompt,如 lean lark 渠道 prompt)。
426
+ * 透传给 sub-agent 的 AgentContext.metadata.systemPrompt。
427
+ */
428
+ systemPrompt?: string;
429
+ /**
430
+ * ★ Task #5333 — 父 run 的渠道专用工具放行名单(AgentContext.extendTools)。
431
+ * 透传给 sub-agent 的 AgentContext.extendTools,使子 agent 也能看到
432
+ * 本渠道的 channelOnly 工具(如 wecom_respond)。
433
+ */
434
+ extendTools?: string[];
350
435
  }
351
436
  /**
352
437
  * 构建 entry-agent 调度的 prompt 包装 (Task #2164 beta-compare divergence #2)
@@ -578,7 +663,7 @@ export declare class BackgroundTaskManager {
578
663
  *
579
664
  * @internal 测试 / 集成用,普通调用方走 publishBackgroundEvent 私有方法
580
665
  */
581
- publishBackgroundEventWithTrigger<T>(type: string, payload: T, parentSessionId: string | undefined, triggerEventId: string, replyChannel?: BackgroundTask["replyChannel"]): void;
666
+ publishBackgroundEventWithTrigger<T>(type: string, payload: T, parentSessionId: string | undefined, triggerEventId: string, replyChannel?: BackgroundTask["replyChannel"], pluginEnabledSnapshot?: Record<string, boolean>): void;
582
667
  /**
583
668
  * Task #3xxx — 解析 AskUserError 信息
584
669
  *
@@ -611,10 +696,10 @@ export declare class BackgroundTaskManager {
611
696
  * 保留 sub-session 并发布 `task.background.ask_user` 事件。
612
697
  * 2. CLI 收到事件后直接显示问题给用户(不送 LLM)。
613
698
  * 3. 用户答复后,主 agent(或用户命令)通过 `delegate_task` 工具调用
614
- * `subagentType=original.subagentType, existingSubSessionId=original.subSessionId`
699
+ * `subagent_type=original.subagentType, sub_session_id=original.subSessionId`
615
700
  * 即可复用 sub-session(保留 message history)继续推进 sub-agent。
616
701
  *
617
- * 因此本方法不再提供;续传是 delegate_task + existingSubSessionId 内建能力。
702
+ * 因此本方法不再提供;续传是 delegate_task + sub_session_id 参数内建能力。
618
703
  */
619
704
  private executeTask;
620
705
  /**
@@ -782,6 +867,34 @@ declare function _captureReplyChannelSnapshot(): BackgroundTask["replyChannel"]
782
867
  * traced 版 captureReplyChannelSnapshot(供 debug trace 观测 task 的回复目标快照)。
783
868
  */
784
869
  export declare const captureReplyChannelSnapshot: typeof _captureReplyChannelSnapshot;
870
+ /**
871
+ * ★ Task #5265 — 把当前 EnvContext.pluginEnabled 拍成不可变快照。
872
+ *
873
+ * ## 为什么需要(生产故障 2026-11-10 12:45)
874
+ *
875
+ * 后台任务完成通知链路(task.background.completed → 通知会话)的
876
+ * 合成 envEvent **pluginEnabled={}(空)** →
877
+ * WecomTaskNotifyPlugin.execute 的 pluginEnabled 守卫
878
+ * (key=wecom-bot-2:WecomTaskNotifyPlugin)不通过 → 插件直接 return
879
+ * 不发卡(用户只看到纯文本)。
880
+ *
881
+ * 主会话(事件轮直发)pluginEnabled 由 event-source-handlers 构建
882
+ * (有 key)→ 有卡。合成事件(publishBackgroundEvent)此前不携带
883
+ * pluginEnabled,dispatcher 的重建逻辑依赖 metadata.plugins(也为空)
884
+ * → 守卫拦截。
885
+ *
886
+ * 修复:delegate 时刻快照 pluginEnabled,随 task 存
887
+ * `BackgroundTask.pluginEnabledSnapshot`,publishBackgroundEvent 时
888
+ * 写进 event.metadata.pluginEnabled —— 通知轮合成 envEvent 自带,
889
+ * dispatcher / buildRunEnvContext 透传 → 守卫放行。
890
+ *
891
+ * 返回 undefined 当没有 EnvContext / 没有 pluginEnabled(向后兼容)。
892
+ */
893
+ declare function _capturePluginEnabledSnapshot(): Record<string, boolean> | undefined;
894
+ /**
895
+ * traced 版 capturePluginEnabledSnapshot(供 debug trace 观测快照结果)。
896
+ */
897
+ export declare const capturePluginEnabledSnapshot: typeof _capturePluginEnabledSnapshot;
785
898
  declare function handleBackgroundTask(backgroundTaskManager: BackgroundTaskManager, parentSessionId: string, description: string, prompt: string, subagentType: string, timeout?: number, similarTaskIds?: number[],
786
899
  /**
787
900
  * ★ 2026-07-10 新增(Task #1752 subSessionId 复用机制)
@@ -804,5 +917,17 @@ model?: string, fallbackModel?: string,
804
917
  * Task #4724 — 父 agent 本次 run 的兜底模型**有序列表**。
805
918
  * 透传给 createTask → sub-agent 的 AgentContext(顺序 = 优先级)。
806
919
  */
807
- fallbackModels?: string[]): Promise<ToolResult>;
920
+ fallbackModels?: string[],
921
+ /**
922
+ * ★ Task #5217 fix 2 — 父 agent 本次 run 的 channel systemPrompt
923
+ * (ToolContext.metadata.systemPrompt,per-event)。
924
+ * 透传给 createTask → sub-agent 的 AgentContext.metadata.systemPrompt。
925
+ */
926
+ systemPrompt?: string,
927
+ /**
928
+ * ★ Task #5333 — 父 run 的渠道专用工具放行名单(AgentContext.extendTools)。
929
+ * 透传给 createTask → sub-agent 的 AgentContext.extendTools,使委派出去的
930
+ * 子任务仍能调用本渠道的 channelOnly 工具(如 wecom_respond)。
931
+ */
932
+ extendTools?: string[]): Promise<ToolResult>;
808
933
  export { handleBackgroundTask };
@@ -7,34 +7,38 @@ import {
7
7
  WORKFLOW_COMPAT_ALIASES,
8
8
  buildEntryAgentPrompt,
9
9
  builtInSubAgents,
10
+ capturePluginEnabledSnapshot,
10
11
  captureReplyChannelSnapshot,
11
12
  createDelegateTool,
12
13
  deriveTriggerEventIdFromEnvContext,
13
14
  getSubAgentSpec,
14
- handleBackgroundTask
15
- } from "../../../shared/@ai-setting/roy-agent-core-aa2j7bk9.js";
15
+ handleBackgroundTask,
16
+ normalizeExtendTools
17
+ } from "../../../shared/@ai-setting/roy-agent-core-0sbmdz8d.js";
16
18
  import"../../../shared/@ai-setting/roy-agent-core-fttgm52a.js";
17
- import"../../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
18
- import"../../../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
19
+ import"../../../shared/@ai-setting/roy-agent-core-4t3yskp8.js";
20
+ import"../../../shared/@ai-setting/roy-agent-core-y7fqtzk2.js";
19
21
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
20
22
  import"../../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
21
23
  import"../../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
22
- import"../../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
24
+ import"../../../shared/@ai-setting/roy-agent-core-v1n0106v.js";
23
25
  import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
24
26
  import"../../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
25
- import"../../../shared/@ai-setting/roy-agent-core-cpcd24n2.js";
26
- import"../../../shared/@ai-setting/roy-agent-core-qqaak24r.js";
27
- import"../../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
28
- import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
27
+ import"../../../shared/@ai-setting/roy-agent-core-yet36q5k.js";
28
+ import"../../../shared/@ai-setting/roy-agent-core-tkpp1ba0.js";
29
+ import"../../../shared/@ai-setting/roy-agent-core-p31ftgq9.js";
30
+ import"../../../shared/@ai-setting/roy-agent-core-5s2t8z00.js";
29
31
  import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
30
32
  import"../../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
31
33
  import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
32
34
  export {
35
+ normalizeExtendTools,
33
36
  handleBackgroundTask,
34
37
  getSubAgentSpec,
35
38
  deriveTriggerEventIdFromEnvContext,
36
39
  createDelegateTool,
37
40
  captureReplyChannelSnapshot,
41
+ capturePluginEnabledSnapshot,
38
42
  builtInSubAgents,
39
43
  buildEntryAgentPrompt,
40
44
  WORKFLOW_COMPAT_ALIASES,
@@ -5,20 +5,20 @@ import {
5
5
  BackgroundTaskEventTypes,
6
6
  BackgroundTaskManager,
7
7
  createDelegateTool
8
- } from "../../../shared/@ai-setting/roy-agent-core-aa2j7bk9.js";
8
+ } from "../../../shared/@ai-setting/roy-agent-core-0sbmdz8d.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-fttgm52a.js";
10
- import"../../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
11
- import"../../../shared/@ai-setting/roy-agent-core-9vxh6f8h.js";
10
+ import"../../../shared/@ai-setting/roy-agent-core-4t3yskp8.js";
11
+ import"../../../shared/@ai-setting/roy-agent-core-y7fqtzk2.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-m46fe3x4.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-4rtg69cn.js";
15
- import"../../../shared/@ai-setting/roy-agent-core-ed233k5z.js";
15
+ import"../../../shared/@ai-setting/roy-agent-core-v1n0106v.js";
16
16
  import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
17
17
  import"../../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
18
- import"../../../shared/@ai-setting/roy-agent-core-cpcd24n2.js";
19
- import"../../../shared/@ai-setting/roy-agent-core-qqaak24r.js";
20
- import"../../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
21
- import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
18
+ import"../../../shared/@ai-setting/roy-agent-core-yet36q5k.js";
19
+ import"../../../shared/@ai-setting/roy-agent-core-tkpp1ba0.js";
20
+ import"../../../shared/@ai-setting/roy-agent-core-p31ftgq9.js";
21
+ import"../../../shared/@ai-setting/roy-agent-core-5s2t8z00.js";
22
22
  import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
23
23
  import"../../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
24
24
  import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";