@ai-setting/roy-agent-core 1.7.47 → 1.7.48
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.
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
larkCliHandler,
|
|
12
12
|
resolveBountyIMSystemPrompt,
|
|
13
13
|
timerHandler
|
|
14
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
14
|
+
} from "../../shared/@ai-setting/roy-agent-core-3b2ceffs.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-4nnv0dze.js";
|
|
16
16
|
import {
|
|
17
17
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
package/dist/env/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
EventSourceComponent,
|
|
16
16
|
builtInHandlers,
|
|
17
17
|
larkCliHandler
|
|
18
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
18
|
+
} from "../shared/@ai-setting/roy-agent-core-3b2ceffs.js";
|
|
19
19
|
import"../shared/@ai-setting/roy-agent-core-4nnv0dze.js";
|
|
20
20
|
import {
|
|
21
21
|
EventSourceInitHooks,
|
package/dist/index.js
CHANGED
|
@@ -882,6 +882,23 @@ function buildLarkRecommendedAction(opts) {
|
|
|
882
882
|
`处理飞书 ${scopeWord}消息并以机器人身份回复${profileWarn}。`,
|
|
883
883
|
`scope: ${scopeHint}。`,
|
|
884
884
|
``,
|
|
885
|
+
`## ⭐ 关键 0:单条结构化 post(一次 send / 单条 ≤4096 字符 / 禁分段)`,
|
|
886
|
+
`**整次回复只能发一条**结构化 post 消息——把全部内容写进单个 md 节点的 text 里`,
|
|
887
|
+
`(飞书单条 post 文本上限 4096 字符,指**单条消息**而非分段总和)。`,
|
|
888
|
+
`**禁止分段**——不要把回复拆成多条消息循环 send(不要分 2 条 / 3 条 / 5 条 / 若干条、`,
|
|
889
|
+
`不要 for 循环多次 send、不要每次只发一部分"待续")。`,
|
|
890
|
+
`**禁止拆成多次 send**——单条回复就**只调一次**\`lark-cli ... +messages-send\` / `,
|
|
891
|
+
`\`+messages-reply\`,发完即结束。`,
|
|
892
|
+
``,
|
|
893
|
+
`- 整次响应**只调一次** lark-cli 命令(单次调用 / 只 send 一次 / 只发一条)`,
|
|
894
|
+
`- "只 send 一次" 指"只 send 一条回复内容"——失败时用同一 idempotency-key 重发同一内容`,
|
|
895
|
+
` 仍算"只 send 一次"(飞书层面幂等去重),不是分段、不是拆段`,
|
|
896
|
+
`- 单条 post 内容上限 4096 字符(指单条消息),内容超长就压缩正文、不要拆段`,
|
|
897
|
+
`- 不需要"先把单条回复切成若干段 ≤4096 字符分别 send"——这条路径是**禁用模式**`,
|
|
898
|
+
` - 拆段发送会导致:① webhook 重复通知(#4137)② msg 进 thread 折叠丢失(#4171)`,
|
|
899
|
+
` ③ review 暴露多个 sub-agent 自行拼接 flag 的偏移指令语义(#4241)`,
|
|
900
|
+
` - 触发根因:sub-agent 自行循环 send + 各自拼 flag,与主会话不一致`,
|
|
901
|
+
``,
|
|
885
902
|
`## ⭐ 关键 1: 飞书回复必须用结构化 post content(--msg-type post --content)`,
|
|
886
903
|
`lark-cli 默认把消息当 plain text;而 @mention 只有在**结构化 at 节点**里才会被`,
|
|
887
904
|
`飞书识别为真实 @。所以回复统一走 post 的 --content JSON:`,
|
|
@@ -919,6 +936,11 @@ function buildLarkRecommendedAction(opts) {
|
|
|
919
936
|
`- 禁止把多行 Markdown 直接拼进 --content 参数(必须走上面的 jq --rawfile)`,
|
|
920
937
|
`- 禁止字面反斜杠+n(即 \\n 两个字符,不是 0x0A 控制字符)`,
|
|
921
938
|
`- 禁止 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)`,
|
|
922
944
|
``,
|
|
923
945
|
`## ⭐ 关键 3:出站必须显式 --as bot,禁止走 api POST`,
|
|
924
946
|
`所有出站命令**照抄下面模板**(--as bot 已写死在命令里,不要自己重写、不要省 flag):`,
|
|
@@ -943,6 +965,51 @@ function buildLarkRecommendedAction(opts) {
|
|
|
943
965
|
` - 假失败 → 重发 → 形成 3 份相同消息`,
|
|
944
966
|
`- 重试建议:固定 idempotency-key(飞书层面去重),不要靠内容 hash 自检`,
|
|
945
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 条已经够了,再发就是违规`,
|
|
1012
|
+
``,
|
|
946
1013
|
`## 必须使用 replyTo 里给定的值`,
|
|
947
1014
|
`profile / chatId / messageId / --as bot 必须原样取自 recommendedAction.replyTo;不要凭印象自己拼接。`
|
|
948
1015
|
].join(`
|