@ai-setting/roy-agent-core 1.7.48 → 1.7.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +7 -7
- package/dist/env/agent/index.js +10 -10
- package/dist/env/commands/index.js +7 -7
- package/dist/env/context/index.js +3 -3
- package/dist/env/debug/index.js +7 -7
- package/dist/env/event-source/index.js +17 -14
- package/dist/env/hook/index.js +9 -6
- package/dist/env/index.js +39 -34
- package/dist/env/llm/index.js +7 -7
- package/dist/env/log-trace/index.js +7 -7
- package/dist/env/mcp/index.js +7 -7
- package/dist/env/memory/index.js +11 -11
- package/dist/env/plugin/index.js +7 -7
- package/dist/env/prompt/index.js +8 -8
- package/dist/env/session/index.js +8 -7
- package/dist/env/skill/index.js +7 -7
- package/dist/env/task/delegate/index.js +8 -8
- package/dist/env/task/index.js +17 -17
- package/dist/env/task/plugins/index.js +10 -9
- package/dist/env/task/storage/index.js +2 -2
- package/dist/env/task/tools/index.js +3 -3
- package/dist/env/tool/built-in/index.js +2 -2
- package/dist/env/tool/index.js +8 -8
- package/dist/env/workflow/engine/index.js +13 -9
- package/dist/env/workflow/hooks/index.js +25 -0
- package/dist/env/workflow/index.js +20 -17
- package/dist/env/workflow/nodes/index.js +2 -2
- package/dist/env/workflow/plugins/index.js +18 -0
- package/dist/env/workflow/service/index.js +2 -2
- package/dist/env/workflow/storage/index.js +3 -3
- package/dist/env/workflow/tools/index.js +12 -11
- package/dist/env/workflow/utils/index.js +4 -4
- package/dist/index.js +80 -70
- package/dist/shared/@ai-setting/{roy-agent-core-0r90298w.js → roy-agent-core-0cfaqnz9.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-5j4awbgc.js → roy-agent-core-1cv9j4dg.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-v5vs1jby.js → roy-agent-core-2gay3sjt.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9cqpdrnk.js → roy-agent-core-2k4xffaa.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-dabnevwe.js → roy-agent-core-35s1w7tc.js} +230 -96
- package/dist/shared/@ai-setting/{roy-agent-core-bjrtwfta.js → roy-agent-core-3tv1q6f2.js} +27 -11
- package/dist/shared/@ai-setting/{roy-agent-core-3j4by8rj.js → roy-agent-core-4z3rq5gw.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-zbb3sk72.js → roy-agent-core-5apmk4qw.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-jfptxs4f.js → roy-agent-core-6167phd4.js} +6 -2
- package/dist/shared/@ai-setting/{roy-agent-core-8nv07zgr.js → roy-agent-core-7evvpfwc.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-vsrfzaze.js → roy-agent-core-7g03zkkb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-tm57tmds.js → roy-agent-core-8s9jd2qy.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4kbvfnn1.js → roy-agent-core-978b6wfx.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-9csa89jx.js +46 -0
- package/dist/shared/@ai-setting/{roy-agent-core-y1n63tse.js → roy-agent-core-9jzysq50.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-4m02hnqf.js → roy-agent-core-ak4dc3kg.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-rgpkygbc.js → roy-agent-core-athdr2m0.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-83mk8wrn.js → roy-agent-core-avyd65je.js} +12 -6
- package/dist/shared/@ai-setting/{roy-agent-core-223v204d.js → roy-agent-core-cg9f4zch.js} +69 -4
- package/dist/shared/@ai-setting/{roy-agent-core-a9pbda78.js → roy-agent-core-dsevjbck.js} +38 -10
- package/dist/shared/@ai-setting/{roy-agent-core-4cj6hram.js → roy-agent-core-dv714bqh.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-amp8qckb.js → roy-agent-core-dwx9hjwx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-d94ddn0r.js → roy-agent-core-f28va833.js} +8 -7
- package/dist/shared/@ai-setting/roy-agent-core-fs36xgcs.js +13 -0
- package/dist/shared/@ai-setting/{roy-agent-core-55hkeft7.js → roy-agent-core-fvs48d38.js} +26 -6
- package/dist/shared/@ai-setting/{roy-agent-core-nvcqp6p9.js → roy-agent-core-gpf2059p.js} +17 -13
- package/dist/shared/@ai-setting/{roy-agent-core-wn59p0zw.js → roy-agent-core-k8b440n3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pd0exvnq.js → roy-agent-core-nde5gzta.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9qn92jhf.js → roy-agent-core-ne2t1pay.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-y1fp2mgf.js → roy-agent-core-p8ak03s0.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-6vbgswjw.js → roy-agent-core-q6twb0df.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-zrgaemma.js → roy-agent-core-q9gnnv6v.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-hxazjj4p.js → roy-agent-core-qamktze3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-54wzmvnb.js → roy-agent-core-qcspfszy.js} +11 -4
- package/dist/shared/@ai-setting/{roy-agent-core-p1p9mr8f.js → roy-agent-core-qm9jda8p.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4nnv0dze.js → roy-agent-core-rnwr39b0.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-3b2ceffs.js → roy-agent-core-rpnjzztt.js} +51 -76
- package/dist/shared/@ai-setting/{roy-agent-core-yjqj3taz.js → roy-agent-core-rpwn590p.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-za09t5g3.js → roy-agent-core-rx16h2m1.js} +12 -6
- package/dist/shared/@ai-setting/{roy-agent-core-ajtsk20z.js → roy-agent-core-s7jpkfm1.js} +75 -754
- package/dist/shared/@ai-setting/{roy-agent-core-ygnva439.js → roy-agent-core-skzjs973.js} +6 -5
- package/dist/shared/@ai-setting/{roy-agent-core-1rm32m5t.js → roy-agent-core-t37wbysj.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-ead21w5c.js → roy-agent-core-tdbv7ff4.js} +5 -3
- package/dist/shared/@ai-setting/{roy-agent-core-333apxaa.js → roy-agent-core-tjg71zqp.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hkj5v9xq.js → roy-agent-core-vrsxhw9e.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7p5zf8ay.js → roy-agent-core-vy69rpxy.js} +13 -13
- package/dist/shared/@ai-setting/roy-agent-core-wxsgay02.js +302 -0
- package/dist/shared/@ai-setting/{roy-agent-core-yjjqm4ww.js → roy-agent-core-x8n1r7h4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-gy1zfe0d.js → roy-agent-core-yd21n6c7.js} +76 -13
- package/dist/shared/@ai-setting/{roy-agent-core-xyys5m1a.js → roy-agent-core-yhsssn86.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-zd077w51.js +1037 -0
- package/dist/shared/@ai-setting/{roy-agent-core-qvaqmj3f.js → roy-agent-core-zd3ddm4k.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-ze068vc9.js +37 -0
- package/package.json +1 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_global_hook_manager,
|
|
3
3
|
init_hook_manager
|
|
4
|
-
} from "./roy-agent-core-
|
|
4
|
+
} from "./roy-agent-core-4z3rq5gw.js";
|
|
5
|
+
import {
|
|
6
|
+
__esm
|
|
7
|
+
} from "./roy-agent-core-fs0mn2jk.js";
|
|
5
8
|
|
|
6
9
|
// src/env/hook/types.ts
|
|
7
10
|
function createHook(meta, fn) {
|
|
@@ -13,9 +16,13 @@ function createHook(meta, fn) {
|
|
|
13
16
|
function createPriorityHook(name, fn, priority) {
|
|
14
17
|
return createHook({ name, priority }, fn);
|
|
15
18
|
}
|
|
19
|
+
var init_types = () => {};
|
|
16
20
|
|
|
17
21
|
// src/env/hook/index.ts
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
var init_hook = __esm(() => {
|
|
23
|
+
init_types();
|
|
24
|
+
init_hook_manager();
|
|
25
|
+
init_global_hook_manager();
|
|
26
|
+
});
|
|
20
27
|
|
|
21
|
-
export { createHook, createPriorityHook };
|
|
28
|
+
export { createHook, createPriorityHook, init_hook };
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseComponent
|
|
6
|
-
} from "./roy-agent-core-
|
|
6
|
+
} from "./roy-agent-core-tdbv7ff4.js";
|
|
7
7
|
import {
|
|
8
8
|
init_decorator
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-dsevjbck.js";
|
|
10
10
|
import {
|
|
11
11
|
createLogger,
|
|
12
12
|
getTracerProvider,
|
|
@@ -6,10 +6,13 @@ import {
|
|
|
6
6
|
createLarkCliTaskNotifyHook,
|
|
7
7
|
createPerTaskGroupChatPlugin,
|
|
8
8
|
mergeChatOwnership
|
|
9
|
-
} from "./roy-agent-core-
|
|
9
|
+
} from "./roy-agent-core-s7jpkfm1.js";
|
|
10
10
|
import {
|
|
11
11
|
getSharedEventStore
|
|
12
|
-
} from "./roy-agent-core-
|
|
12
|
+
} from "./roy-agent-core-yhsssn86.js";
|
|
13
|
+
import {
|
|
14
|
+
createLarkCliWorkflowNotifyHook
|
|
15
|
+
} from "./roy-agent-core-wxsgay02.js";
|
|
13
16
|
import {
|
|
14
17
|
normalizeLarkAtMentions
|
|
15
18
|
} from "./roy-agent-core-64f22h1g.js";
|
|
@@ -18,24 +21,24 @@ import {
|
|
|
18
21
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
19
22
|
import {
|
|
20
23
|
BaseComponent
|
|
21
|
-
} from "./roy-agent-core-
|
|
24
|
+
} from "./roy-agent-core-tdbv7ff4.js";
|
|
22
25
|
import {
|
|
23
26
|
globalHookManager,
|
|
24
27
|
init_global_hook_manager
|
|
25
|
-
} from "./roy-agent-core-
|
|
28
|
+
} from "./roy-agent-core-4z3rq5gw.js";
|
|
26
29
|
import {
|
|
27
30
|
init_context
|
|
28
|
-
} from "./roy-agent-core-
|
|
31
|
+
} from "./roy-agent-core-k8b440n3.js";
|
|
29
32
|
import {
|
|
30
33
|
createEnvContext,
|
|
31
34
|
normalizeParentTaskId,
|
|
32
35
|
runWithEnvContext
|
|
33
|
-
} from "./roy-agent-core-
|
|
36
|
+
} from "./roy-agent-core-5apmk4qw.js";
|
|
34
37
|
import {
|
|
35
38
|
TracedAs,
|
|
36
39
|
init_decorator,
|
|
37
40
|
wrapFunction
|
|
38
|
-
} from "./roy-agent-core-
|
|
41
|
+
} from "./roy-agent-core-dsevjbck.js";
|
|
39
42
|
import {
|
|
40
43
|
createLogger,
|
|
41
44
|
getTracerProvider,
|
|
@@ -846,6 +849,7 @@ function isPluginDebugEnabled() {
|
|
|
846
849
|
}
|
|
847
850
|
var BUILT_IN_PLUGIN_FACTORIES = {
|
|
848
851
|
LarkCliTaskNotifyPlugin: (cfg) => createLarkCliTaskNotifyHook(cfg),
|
|
852
|
+
LarkCliWorkflowNotifyPlugin: (cfg) => createLarkCliWorkflowNotifyHook(cfg),
|
|
849
853
|
PerTaskGroupChatPlugin: (cfg) => createPerTaskGroupChatPlugin(cfg),
|
|
850
854
|
"task-tag": () => new TaskTagPlugin
|
|
851
855
|
};
|
|
@@ -882,41 +886,50 @@ function buildLarkRecommendedAction(opts) {
|
|
|
882
886
|
`处理飞书 ${scopeWord}消息并以机器人身份回复${profileWarn}。`,
|
|
883
887
|
`scope: ${scopeHint}。`,
|
|
884
888
|
``,
|
|
885
|
-
`## ⭐ 关键 0
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
`\`+messages-reply\`,发完即结束。`,
|
|
889
|
+
`## ⭐ 关键 0:整次回复只发一条结构化 post(禁分段)`,
|
|
890
|
+
`> 指令优先级:本 prompt 与 lark-* skill 文档冲突时**以本 prompt 为准**`,
|
|
891
|
+
`> (例:lark-im skill 建议 --markdown / ANSI-C 引号,本项目一律走下面模板)。`,
|
|
892
|
+
``,
|
|
893
|
+
`把全部**正文**写进**同一份** post content 的**单个** md 节点里(超长内容另挂附件区,`,
|
|
894
|
+
`见「关键 2」),写完整条即结束。`,
|
|
892
895
|
``,
|
|
893
|
-
`-
|
|
894
|
-
|
|
895
|
-
`
|
|
896
|
-
`-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
`
|
|
900
|
-
|
|
896
|
+
`- **发送动作只调一次**:整次回复只调一次「发送类」命令(+messages-reply / +messages-send)`,
|
|
897
|
+
` - 上传 / 查询等**非发送类**命令不受此限`,
|
|
898
|
+
` (例:先 \`im files create\` 拿 file_key,再发一条带附件的 post,发送仍然只有一次)`,
|
|
899
|
+
`- "只 send 一次" = 只 send **一条回复内容**;失败时用同一 idempotency-key 重发同一内容`,
|
|
900
|
+
` 仍算"只 send 一次"(飞书层面幂等去重,key 最长 50 字符),不是分段、不是拆段`,
|
|
901
|
+
`- **禁止分段**:不要把回复拆成多条消息循环 send(2 / 3 / 5 / 若干条都不行),`,
|
|
902
|
+
` 禁止在 for / while 循环里多次调发送命令,禁止每条只发一部分"待续"`,
|
|
903
|
+
`- **禁止"陆续更新"**:子任务结束后不要再补发第 2 条更新;禁止先发占位帖再发完整版`,
|
|
904
|
+
` - 违规识别口径:同一 sub-agent 在群里连续刷 5 条以上消息,即为违规`,
|
|
905
|
+
`- 单条上限是飞书的**远端硬限制**:post 请求体 ≤ **30 KB**(UTF-8 字节,含 JSON 转义开销,`,
|
|
906
|
+
` 量级参考:约 1 万汉字)。**它不是你的分段阈值**——不要为了"卡上限"去数字数/算字节,`,
|
|
907
|
+
` 正常回复远低于它;真触发会报 **230025**(消息体长度超出限制,别当成路径错去换 flag),`,
|
|
908
|
+
` 处理方式是**压缩正文**或改用附件区(见「关键 2」)——**绝不拆成多条**`,
|
|
909
|
+
`- 拆段循环 send 的代价(历史故障,不要重演):webhook 重复通知(#4137)/`,
|
|
910
|
+
` 消息进 thread 后主聊天流丢失(#4171)/sub-agent 自拼 flag 偏移(#4241)`,
|
|
911
|
+
`- **绝不能加 --reply-in-thread**:会被路由进 thread,主聊天流看不到(#4171)`,
|
|
901
912
|
``,
|
|
902
|
-
`## ⭐ 关键 1
|
|
913
|
+
`## ⭐ 关键 1:飞书回复必须用结构化 post content(--msg-type post --content)`,
|
|
903
914
|
`lark-cli 默认把消息当 plain text;而 @mention 只有在**结构化 at 节点**里才会被`,
|
|
904
915
|
`飞书识别为真实 @。所以回复统一走 post 的 --content JSON:`,
|
|
905
916
|
``,
|
|
906
917
|
` {"zh_cn":{"content":[`,
|
|
907
918
|
` [ {"tag":"at","user_id":"ou_xxx"} ], // @某人:结构化节点(可多个/多段)`,
|
|
908
|
-
` [ {"tag":"md","text":"正文 Markdown
|
|
919
|
+
` [ {"tag":"md","text":"正文 Markdown"} ] // 正文:单个 md 节点(整条回复的正文都放这里)`,
|
|
909
920
|
` ]}}`,
|
|
910
921
|
``,
|
|
911
922
|
`- @mention:用 {"tag":"at","user_id":"ou_xxx"}(user_id 填对方 open_id;@所有人填 "all")`,
|
|
912
923
|
`- 正文:全部放进 {"tag":"md","text":"..."} 这一个节点里`,
|
|
913
924
|
`- 不需要 @ 时,content 里只放 md 节点:{"zh_cn":{"content":[[{"tag":"md","text":"..."}]]}}`,
|
|
925
|
+
`- md 节点支持 CommonMark 0.31 + GFM:ATX 标题(#~######)/ 表格 / 任务列表 / 加粗 / 围栏代码块 / 超链接`,
|
|
926
|
+
`- 表格**前后**、引用块**之后**接其他内容,都**必须空一行**(只写一个换行会被当成表格续行)`,
|
|
914
927
|
`**严禁**: 用 --text(plain text,Markdown 全部失效)`,
|
|
915
928
|
` 用 --markdown(无法携带结构化 at 节点,@ 会退化成普通文本)`,
|
|
916
929
|
` 在正文里写 <at user_id="ou_xxx"/> 或 <at user_id="ou_xxx"></at> 文本标签`,
|
|
917
930
|
` (飞书不识别文本标签,只认结构化 at 节点;写文本标签会显示成原始字符)`,
|
|
918
931
|
``,
|
|
919
|
-
`## 关键 2
|
|
932
|
+
`## ⭐ 关键 2:安全构造 content(照抄,避免 JSON 转义地狱)`,
|
|
920
933
|
`把 Markdown 正文写进临时文件,再用 jq 组装(jq 会自动把换行转义为反斜杠+n):`,
|
|
921
934
|
``,
|
|
922
935
|
` body_file="$(mktemp /tmp/lark-reply.XXXXXX.md)"`,
|
|
@@ -929,6 +942,15 @@ function buildLarkRecommendedAction(opts) {
|
|
|
929
942
|
``,
|
|
930
943
|
`不需要 @ 某人时,把 jq 表达式换成 '{zh_cn:{content:[[{tag:"md",text:$md}]]}}'。`,
|
|
931
944
|
``,
|
|
945
|
+
`**长内容怎么放(仍然是单条消息)**:`,
|
|
946
|
+
`- 首选压缩正文;上限见「关键 0」(30 KB 请求体 = 单条消息,不是分段总和)`,
|
|
947
|
+
`- 要带完整日志 / trace 时用 post 的**附件区**(发送仍然只有一次):`,
|
|
948
|
+
` lark-cli ${profileFlag}im files create --file <path> --as bot --data '{"file_name":"<报告名>.md","file_type":"stream"}'`,
|
|
949
|
+
` 拿到 file_key 后在发送命令末尾加 --attachment <file_key>(.md/.log/.txt 用 file_type=stream)`,
|
|
950
|
+
`- \`--attachment\` 不能与已含 files 数组的 --content 同用(附件区只能声明一次)`,
|
|
951
|
+
`- 不要用 HTML 折叠标签往单条里"塞"长内容:飞书 post 的 md 节点**不支持** raw HTML,`,
|
|
952
|
+
` 写了只会让用户看到原始标签`,
|
|
953
|
+
``,
|
|
932
954
|
`## 禁止`,
|
|
933
955
|
`- 禁止 --text / --msg-type text(plain text,Markdown 全部失效)`,
|
|
934
956
|
`- 禁止 --markdown(无法携带结构化 at 节点)`,
|
|
@@ -936,11 +958,6 @@ function buildLarkRecommendedAction(opts) {
|
|
|
936
958
|
`- 禁止把多行 Markdown 直接拼进 --content 参数(必须走上面的 jq --rawfile)`,
|
|
937
959
|
`- 禁止字面反斜杠+n(即 \\n 两个字符,不是 0x0A 控制字符)`,
|
|
938
960
|
`- 禁止 bash ANSI-C 引号语法(dollar 符号紧跟单引号)`,
|
|
939
|
-
`- 禁止分段发送:禁止把单条回复拆成多条 ≤4096 字符的子段循环 send,`,
|
|
940
|
-
` 禁止用 for / while 循环多次调 lark-cli 拼多 send,`,
|
|
941
|
-
` 禁止每次只发一部分"待续"。整次响应只调一次 lark-cli 命令(只 send 一次 / 只发一条 / 单次调用)。`,
|
|
942
|
-
`- 禁止 --reply-in-thread(消息会路由进 thread,主聊天流折叠预览看不到后续消息,`,
|
|
943
|
-
` 实测导致 msg-5/6/7 丢失,详见 #4171)`,
|
|
944
961
|
``,
|
|
945
962
|
`## ⭐ 关键 3:出站必须显式 --as bot,禁止走 api POST`,
|
|
946
963
|
`所有出站命令**照抄下面模板**(--as bot 已写死在命令里,不要自己重写、不要省 flag):`,
|
|
@@ -963,52 +980,7 @@ function buildLarkRecommendedAction(opts) {
|
|
|
963
980
|
`- 禁止用 \`python json.load\` / \`python json.tool\` / \`jq\` 解析 lark-cli 发送响应`,
|
|
964
981
|
` - 飞书消息正文里常含裸 \`"\`、\`|\`、Markdown 表格分隔符 → json.load 会报 \`Expecting ',' delimiter\` 假失败`,
|
|
965
982
|
` - 假失败 → 重发 → 形成 3 份相同消息`,
|
|
966
|
-
`- 重试建议:固定 idempotency-key
|
|
967
|
-
``,
|
|
968
|
-
`## ⭐ 关键 4:禁止分段响应——单条结构化消息足够`,
|
|
969
|
-
`飞书单条消息支持最长 **4096 字符**,足够放下任何调研/修复/长报告。`,
|
|
970
|
-
`把全部内容写进一条 post 里一次性发完;不要再用多条 send/reply 拼成分段响应。`,
|
|
971
|
-
``,
|
|
972
|
-
`**绝对禁止(sub-agent 自己拼 bash 做 send 循环的 4 类陷阱)**:`,
|
|
973
|
-
`- **禁止用多个 \`im +messages-send\` / \`im +messages-reply\` 拼接成 5-10 条分段响应**`,
|
|
974
|
-
` - 群里如果出现 7-13 条由同一 sub-agent 发出的"陆续更新",就是这条违规`,
|
|
975
|
-
`- **禁止把一份长报告拆成 N 条"陆续发"**(哪怕每条都未超限)`,
|
|
976
|
-
` - 用户体验混乱:消息流被淹没,跟读成本指数级上升`,
|
|
977
|
-
` - 部分消息还会被折叠/丢失(thread、超长截断、幂等 hash)`,
|
|
978
|
-
`- **禁止在子任务结束后再发第 2 条 "更新"**(一条就够了,不要"补一句")`,
|
|
979
|
-
`- **禁止在写到一半时先发一条占位回复,再发完整版**(直接发完整版)`,
|
|
980
|
-
``,
|
|
981
|
-
`**正确做法——一次性写进一条结构化 post JSON**:`,
|
|
982
|
-
` body_file="$(mktemp /tmp/lark-reply.XXXXXX.md)"`,
|
|
983
|
-
` trap 'rm -f "$body_file"' EXIT`,
|
|
984
|
-
` cat > "$body_file" <<'LARK_REPLY_EOF'`,
|
|
985
|
-
`# 任务报告标题`,
|
|
986
|
-
``,
|
|
987
|
-
`## 关键发现`,
|
|
988
|
-
`- 要点 1(含图表、表格、代码块、引用都可放)`,
|
|
989
|
-
`- 要点 2`,
|
|
990
|
-
``,
|
|
991
|
-
`## 操作步骤`,
|
|
992
|
-
`1. 步骤一`,
|
|
993
|
-
`2. 步骤二`,
|
|
994
|
-
``,
|
|
995
|
-
`<!-- 极长内容用 Markdown 折叠让用户自己展开 --> `,
|
|
996
|
-
`<details>`,
|
|
997
|
-
`<summary>展开完整日志/trace/参考链接</summary>`,
|
|
998
|
-
``,
|
|
999
|
-
`很长的内容放这里(单条最多接近 4096 字符),用户需要时点 summary 展开`,
|
|
1000
|
-
``,
|
|
1001
|
-
`</details>`,
|
|
1002
|
-
`LARK_REPLY_EOF`,
|
|
1003
|
-
` content="$(jq -nc --rawfile md "$body_file" '{zh_cn:{content:[[{tag:"md",text:$md}]]}}')"`,
|
|
1004
|
-
` lark-cli ${profileFlag}im +messages-send --chat-id <取自 replyTo.chatId> --as bot --msg-type post --content "$content"`,
|
|
1005
|
-
``,
|
|
1006
|
-
`要点:`,
|
|
1007
|
-
`- **一条 post 消息** = 一个 mktemp + 一个 jq 组装 + **一个** lark-cli send 调用`,
|
|
1008
|
-
`- 长内容用 Markdown \`<details>/<summary>\` 折叠(飞书 md 节点支持)`,
|
|
1009
|
-
`- 表格/列表/代码块/标题在单条 md 节点里全部可用,不需要分条`,
|
|
1010
|
-
`- **绝不能加 \`--reply-in-thread\`**(会把消息路由进 thread,主聊天流看不到——见 #4171 教训)`,
|
|
1011
|
-
`- 如果你觉得自己想发第 2 条 "更新",停下来:第 1 条已经够了,再发就是违规`,
|
|
983
|
+
`- 重试建议:固定 idempotency-key(飞书层面去重,**最长 50 字符**),不要靠内容 hash 自检`,
|
|
1012
984
|
``,
|
|
1013
985
|
`## 必须使用 replyTo 里给定的值`,
|
|
1014
986
|
`profile / chatId / messageId / --as bot 必须原样取自 recommendedAction.replyTo;不要凭印象自己拼接。`
|
|
@@ -1240,6 +1212,9 @@ class LarkCliInstance {
|
|
|
1240
1212
|
if (Array.isArray(plugin.hooks)) {
|
|
1241
1213
|
return plugin.hooks.map((h) => h.point || h);
|
|
1242
1214
|
}
|
|
1215
|
+
if (Array.isArray(plugin.hookPoints)) {
|
|
1216
|
+
return plugin.hookPoints.map((h) => h.point || h);
|
|
1217
|
+
}
|
|
1243
1218
|
if (typeof plugin.execute === "function" && plugin.hookPoint) {
|
|
1244
1219
|
return [plugin.hookPoint];
|
|
1245
1220
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createQueryBackgroundProcessTool
|
|
3
|
+
} from "./roy-agent-core-amkqnyzy.js";
|
|
4
|
+
import {
|
|
5
|
+
SQLiteTaskStore,
|
|
6
|
+
getDefaultTaskDbPath
|
|
7
|
+
} from "./roy-agent-core-qm9jda8p.js";
|
|
1
8
|
import {
|
|
2
9
|
batchArchiveTaskTool,
|
|
3
10
|
batchDeleteTaskTool,
|
|
@@ -9,7 +16,7 @@ import {
|
|
|
9
16
|
searchTasksTool,
|
|
10
17
|
treeTasksTool,
|
|
11
18
|
updateTaskTool
|
|
12
|
-
} from "./roy-agent-core-
|
|
19
|
+
} from "./roy-agent-core-7g03zkkb.js";
|
|
13
20
|
import {
|
|
14
21
|
createOperationTool,
|
|
15
22
|
deleteOperationTool,
|
|
@@ -17,9 +24,6 @@ import {
|
|
|
17
24
|
listOperationsTool,
|
|
18
25
|
updateOperationTool
|
|
19
26
|
} from "./roy-agent-core-rn57psp0.js";
|
|
20
|
-
import {
|
|
21
|
-
createQueryBackgroundProcessTool
|
|
22
|
-
} from "./roy-agent-core-amkqnyzy.js";
|
|
23
27
|
import {
|
|
24
28
|
TaskEntityEventTypes
|
|
25
29
|
} from "./roy-agent-core-8gxth0eh.js";
|
|
@@ -27,11 +31,7 @@ import {
|
|
|
27
31
|
BackgroundTaskManager,
|
|
28
32
|
createDelegateTool,
|
|
29
33
|
createStopTool
|
|
30
|
-
} from "./roy-agent-core-
|
|
31
|
-
import {
|
|
32
|
-
SQLiteTaskStore,
|
|
33
|
-
getDefaultTaskDbPath
|
|
34
|
-
} from "./roy-agent-core-p1p9mr8f.js";
|
|
34
|
+
} from "./roy-agent-core-gpf2059p.js";
|
|
35
35
|
import {
|
|
36
36
|
TaskHookPoints
|
|
37
37
|
} from "./roy-agent-core-1pg0fepg.js";
|
|
@@ -40,19 +40,19 @@ import {
|
|
|
40
40
|
} from "./roy-agent-core-7hh0brvs.js";
|
|
41
41
|
import {
|
|
42
42
|
BaseComponent
|
|
43
|
-
} from "./roy-agent-core-
|
|
43
|
+
} from "./roy-agent-core-tdbv7ff4.js";
|
|
44
44
|
import {
|
|
45
45
|
globalHookManager,
|
|
46
46
|
init_global_hook_manager
|
|
47
|
-
} from "./roy-agent-core-
|
|
47
|
+
} from "./roy-agent-core-4z3rq5gw.js";
|
|
48
48
|
import {
|
|
49
49
|
getEnvContextOrEmpty,
|
|
50
50
|
init_env_context
|
|
51
|
-
} from "./roy-agent-core-
|
|
51
|
+
} from "./roy-agent-core-5apmk4qw.js";
|
|
52
52
|
import {
|
|
53
53
|
TracedAs,
|
|
54
54
|
init_decorator
|
|
55
|
-
} from "./roy-agent-core-
|
|
55
|
+
} from "./roy-agent-core-dsevjbck.js";
|
|
56
56
|
import {
|
|
57
57
|
createLogger,
|
|
58
58
|
init_logger
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
TracedAs,
|
|
6
6
|
init_decorator
|
|
7
|
-
} from "./roy-agent-core-
|
|
7
|
+
} from "./roy-agent-core-dsevjbck.js";
|
|
8
8
|
import {
|
|
9
9
|
createLogger,
|
|
10
10
|
init_logger
|
|
@@ -111,7 +111,9 @@ class AgentRegistry {
|
|
|
111
111
|
if (agent.systemPromptRef) {
|
|
112
112
|
try {
|
|
113
113
|
if (promptComponent?.getPrompt) {
|
|
114
|
-
const rendered = await promptComponent.getPrompt(agent.systemPromptRef
|
|
114
|
+
const rendered = await promptComponent.getPrompt(agent.systemPromptRef, {}, {
|
|
115
|
+
agentType: agent.type
|
|
116
|
+
});
|
|
115
117
|
if (rendered) {
|
|
116
118
|
logger.debug(`[AgentRegistry] Resolved systemPromptRef via getPrompt: ${agent.systemPromptRef}`);
|
|
117
119
|
return rendered;
|
|
@@ -255,10 +257,14 @@ class AgentRegistry {
|
|
|
255
257
|
"workflow_search",
|
|
256
258
|
"workflow_tag_list",
|
|
257
259
|
"workflow_validate",
|
|
258
|
-
"workflow_add"
|
|
260
|
+
"workflow_add",
|
|
261
|
+
"bash",
|
|
262
|
+
"read_file",
|
|
263
|
+
"workflow_run",
|
|
264
|
+
"workflow_run_status"
|
|
259
265
|
],
|
|
260
266
|
deniedTools: ["delegate_task", "stop_task"],
|
|
261
|
-
maxIterations:
|
|
267
|
+
maxIterations: 60
|
|
262
268
|
};
|
|
263
269
|
this.agents.set(name, agent);
|
|
264
270
|
}
|
|
@@ -273,7 +279,7 @@ class AgentRegistry {
|
|
|
273
279
|
systemPromptRef: "compact",
|
|
274
280
|
allowedTools: ["workflow_submit_output"],
|
|
275
281
|
deniedTools: [],
|
|
276
|
-
maxIterations:
|
|
282
|
+
maxIterations: 3,
|
|
277
283
|
filterHistory: false
|
|
278
284
|
};
|
|
279
285
|
this.agents.set(name, agent);
|
|
@@ -289,7 +295,7 @@ class AgentRegistry {
|
|
|
289
295
|
systemPromptRef: "compact-hint",
|
|
290
296
|
allowedTools: ["workflow_submit_output"],
|
|
291
297
|
deniedTools: [],
|
|
292
|
-
maxIterations:
|
|
298
|
+
maxIterations: 3,
|
|
293
299
|
filterHistory: false
|
|
294
300
|
};
|
|
295
301
|
this.agents.set(name, agent);
|