feat: 权限档位体系(三档 plan/workspace/full + 四桥 from_session_id)
L2 核心改动:sessions 表补 permission_mode / permission_enforcement 两列 (sqlite + pg 同步),三桥 lib/permission-mode.js 翻译档位到平台原生配置, homeagent advisory 模式提示词告知模型实际强制力。四桥全部携带 from_session_id 供 relay 去重与会话回溯。 FromHuman / ToHuman 判据已加入心跳 payload 与 notify/mail.go。
This commit is contained in:
@ -260,6 +260,22 @@ func SendCalendarMail(ctx context.Context, eventID, toAddr, subject, body, creat
|
||||
return err
|
||||
}
|
||||
|
||||
// 人建的日程 → 把他设为会话 owner。
|
||||
//
|
||||
// 为什么必须设:权限询问的决策人解析是「会话 owner → 线索里最近的人类 → 409」。
|
||||
// 日历提醒的发件人是 `calendar`(不是人也不是 Agent),所以一旦 Agent 在
|
||||
// 这条会话里要跑需要授权的命令,线索上根本找不到人类 —— 而那个日程
|
||||
// 就是人自己在界面上设的,他当然是合理的决策人。
|
||||
//
|
||||
// 不设的后果(删掉管理员兜底之后暴露):人建的提醒触发后,Agent 的权限询问
|
||||
// 直接得 409「这条链上没有人类」。
|
||||
//
|
||||
// created_by 是 Agent(Agent 自己建的日程)时 owner 保持为空 ——
|
||||
// 那条链上确实没有人类,409 是对的。
|
||||
if u, uErr := repo.GetUserByName(ctx, createdBy); uErr == nil && u != nil {
|
||||
_ = repo.SetSessionOwner(ctx, sessionID, u.ID)
|
||||
}
|
||||
|
||||
// 发件人固定为 calendar:它不是任何一个 Agent,也不是人。
|
||||
// 用创建者的名字会让 Agent 以为人在实时找它,而人此刻可能在睡觉 ——
|
||||
// 模型据此判断「要不要马上追问」,来源写错会让它问一个不在线的人。
|
||||
|
||||
Reference in New Issue
Block a user