Repository navigation
feat(event): 新增 ob11 事件触发(#147) - #161
Merged
Merged
Conversation
- 回复分组新增「额外消息分隔符」模板配置:默认一个空字符串元素,可追加 \n\n / \n 等额外分隔符 - 内置 \f 仍是多消息分隔符(拆分与内部拼接不变),模板项只做追加;真实字符与转义写法都识别 - 提示词 Message markers 段按配置追加说明,段缓存随配置失效 - 补充单测与 README/docs 说明
- 新增「事件触发规则」配置(「消息触发」页更名「触发」,只新增 1 个 JSON 键): 事件先按「事件接收」开关/白名单/待机/去重进入上下文,再按规则匹配(顺序=优先级、首条命中) - 支持 notice / request 事件;poke 走现有消息管线(已转换为 poke 内容部分),命中即跳过普通触发 - 会话运行中命中触发时复用 pendingQueue 挂起(kind=trigger),轮末由 resumePending 续跑;不新增队列/续跑逻辑 - 双路径(原生 + ob11 依赖)用「已触发」标记保证同一事件只触发一次;无新增限流 - 触发提示不重复事件文本,事件字段先按用户输入口径清洗;配置解析失败整份回退且永不抛 - 文档:README / docs 02/03/05 / AGENT 同步;新增单测与跨仓库生成器联测(eventTrigger)
- 事件名扁平化:notify 子类型改用 poke / group_name / title / honor / lucky_king 等扁平名,
废弃 notify.*;事件触发去重键与硬排除同步
- 规则只绑一个事件:on 仅接受单个字符串(数组报错并提示建多条规则)
- 删除 name / toolChoice 字段:日志与触发提示不再带规则名,触发一律交给模型 auto
- match 增加对象糖:{"sub_type":"leave","is_target_bot":true} 自动展开为等值条件(生成器仍输出规范数组)
- 事件触发提示包装去掉规则名;配置项描述同步新形态
- 单测与跨仓库生成器联测更新(事件表一致性、无 name/toolChoice、on 单字符串、对象糖)
- 文档 README / docs/05 同步
- 适配器不下发原生 onPoke 时,ob11 notify/poke 直接评估事件触发(不再依赖「事件接收」白名单); 与原生 onPoke 路径共用 `poke|epId|sid|userId|targetId` 去重 key,双路径只触发一次 - ob11 poke 无背景事件条目,触发时把事件文本并入提示(injectEventText);原生路径仍按消息入库 - 事件触发统一在 maybeTriggerEvent 内做待机门禁(会话待机或全局待机),避免 ob11 路径绕过 - 规则 prompt 改为可留空:事件接收已把事件写入上下文,留空时只触发响应、不附加指令; 提示包装在空指令时只输出 "Event trigger matched the event above."(注入事件文本时输出 "Event trigger matched: ...") - 生成器/文档/单测/联测同步(生成器 prompt 默认空、不再自动填预设;两边拒绝非字符串 prompt)
- 关闭「日志简短打印」= 完整打印:移除单条 2000、请求上下文正文 300、思维链 500、响应内容 300、流式回复 200、识图响应 300、embedding 文本 200、工具审计 120、judge 日志 80 等所有预先截断,JSON 对象完整 stringify - 开启 = 整行超 1000 字只保留首尾各 500 字;logLong 分片在开启时 900/片(避免分片被二次截断)、关闭时 1500/片 - data URI 与 JSON base64 字段折叠为「[base64 已省略 N 字符]」占位(防止关闭截断后整段 base64 灌进日志,不算日志截断);密钥脱敏仍在截断之前执行 - exception() 与 model-error 在调试级别补打 ApiError.rawText 响应体原文 - 一并提交工作区已有的出厂默认值调整:「上下文预算」0→131072、「摘要水位」6000→8192、「心智模型刷新最小间隔」0→1440,并同步 README / docs 03、05、13 - 单测新增 logger 开/关截断、请求正文不预截断、base64 折叠用例;tsc --noEmit、lint、test:unit(672 通过)、build、smoke、deps:check 通过
- Setting 新增 eventTrigger(默认开启,随会话持久化),放在 regexTrigger 与 counter 之间 - `.ai on` 无参数同时开启非指令正则触发与事件触发;`--e/--event` 单独开启 - `.ai off` 全关时一并关闭事件触发;`--e/--event` 单独关闭;未知参数提示与帮助同步 - `.ai status` 在「非指令正则触发」和「计数器模式」之间显示「事件触发(e)」 - maybeTriggerEvent 增加本会话开关门禁:关闭后 notice/request/poke(含 ob11 poke)一律不触发 - 文档 README / docs05 同步;单测新增关闭开关不触发的用例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能
otify.*、on 数组、
ame、 oolChoice)。
esumePending 续跑;不新增队列/续跑逻辑、不新增限流。
配套生成器
�iplugin4-config main 8a89ae7:事件触发页改版——中文短名下拉(19 事件、一规则一事件、自定义事件输入)、提示词默认留空由用户自行填写(不再自动填英文预设)、条件可视化编辑器(等于/正则、行编辑 + JSON 双向同步)、删除规则名与工具限制、旧格式/草稿自动迁移。
验证
px tsc --noEmit /
pm run lint /
pm run test:unit(670 项)/
pm run test:ob11 /
pm run build && npm run smoke /
pm run deps:check /
pm run package:check /
pm run sim(13 项)/
pm run docs:manifest /
pm run changelog:check /
pm run version:check 全绿
pm run test:integration 259 通过(事件表一致、新 JSON 两端接受、空 prompt 接受、非法样例拒绝)
pm test 252+206+28 全绿;浏览器 e2e DONE 0
说明