feat: add request-scoped context policies (#2914)

* feat: add request-scoped context policies

Add named turn profiles under agents.defaults so callers can opt into
per-request context and tool policies without changing default chat behavior.

Profiles can disable history, system context, skill prompts, or tools, and can
limit skills/tools with allow lists. Wire profile selection through Pico message
payloads, agent turn execution, Web chat selection, and Web visual config.

Reject invalid turn profiles before saving config through Web APIs and document
the new request context policy behavior.

* fix: address turn profile review blockers

* feat: simplify request context policy config

* fix: suppress tool prompt when turn tools are disabled

* fix: enforce turn profile tool restrictions
This commit is contained in:
lxowalle
2026-05-22 10:06:40 +08:00
committed by GitHub
parent 5bbebb5fc8
commit 2992eccbf0
39 changed files with 3150 additions and 162 deletions
+6
View File
@@ -481,6 +481,9 @@ func activeSkillNames(agent *AgentInstance, opts processOptions) []string {
if agent == nil {
return nil
}
if turnProfileSkillsOff(opts.TurnProfile) {
return nil
}
combined := make([]string, 0, len(agent.SkillsFilter)+len(opts.ForcedSkills))
combined = append(combined, agent.SkillsFilter...)
@@ -509,6 +512,9 @@ func activeSkillNames(agent *AgentInstance, opts processOptions) []string {
resolved = append(resolved, name)
}
if turnProfileCustomSkills(opts.TurnProfile) {
return filterNamesByTurnProfile(resolved, opts.TurnProfile.AllowedSkills)
}
return resolved
}