feat(urgency): 通用紧急度通道(Declarer/Level + 只抬不压折算)+ IoT 首个生产者 + 她自己的结论走结构化标记穿透安静时段
This commit is contained in:
1 parent
4a2d276881
commit
f91a83ff81
14 files changed
+917
-15
No files matched your search
@@ -367,6 +367,7 @@ func (b *Backthink) think(parent context.Context, tr Trigger) {
|
||||
// 以及发到哪个渠道。parseProactive 稳健地恢复该决策,
|
||||
// 并失败安全(格式错乱/含糊 → 不推送)。
|
||||
message, channelHint, push := parseProactive(conclusion)
|
||||
roundImport := b.escalatedImport(tr, conclusion)
|
||||
|
||||
state := b.currentState(cctx)
|
||||
lastActivity, hasActivity := b.lastUserActivity(cctx)
|
||||
@@ -376,7 +377,7 @@ func (b *Backthink) think(parent context.Context, tr Trigger) {
|
||||
// 频率门(PushGate)仍在推送器内部单独生效。
|
||||
decision := b.Decide(DecisionInput{
|
||||
Trigger: tr.Source,
|
||||
Import: tr.Import,
|
||||
Import: roundImport,
|
||||
At: at,
|
||||
UserState: state,
|
||||
LastActivity: lastActivity,
|
||||
@@ -422,6 +423,25 @@ func (b *Backthink) think(parent context.Context, tr Trigger) {
|
||||
}
|
||||
}
|
||||
|
||||
// escalatedImport 解出本轮打扰决策所用的重要度:触发自带的重要度,叠上她自己结论里
|
||||
// 声明的紧急度(结构化标记 [紧急:...],见 parseProactiveUrgency)。这让她在主动思考轮
|
||||
// 里读完外围插件数据、调过工具后,能声明「我认为这条紧急、要突破安静时段发出去」
|
||||
// (design/12 §6 安全域豁免 + design/20 §2 P2)。
|
||||
//
|
||||
// 上抬会记一条日志,使这次穿透可追溯(谁、从哪档抬到哪档);声明只能上抬不能下压,
|
||||
// 因此安全域事件既得的档位不会被一句 routine 抹掉。她自报不是无限通行证:频率门
|
||||
// (PushGate)仍独立在推送器内部生效,心跳类轮次的推送照旧受限频约束。
|
||||
func (b *Backthink) escalatedImport(tr Trigger, conclusion string) Importance {
|
||||
declared := parseProactiveUrgency(conclusion)
|
||||
escalated := escalateImport(tr.Import, declared)
|
||||
if escalated != tr.Import {
|
||||
b.log.Info("backthink declared urgency escalated round",
|
||||
"source", tr.Source, "declared", declared.String(),
|
||||
"from", tr.Import.String(), "to", escalated.String())
|
||||
}
|
||||
return escalated
|
||||
}
|
||||
|
||||
// currentState 读取用户当前状况用于打扰决策,
|
||||
// 提供者报错时退回中性状态(并记一条 warn 日志)。
|
||||
func (b *Backthink) currentState(ctx context.Context) UserState {
|
||||
|
||||
Reference in new issue
Block a user