agentnetwork: drop dead MergedGuardrails token/budget/retention fields

These fields (and the MergedTokenLimits/MergedTokenWindow/MergedBudget/
MergedBudgetWindow/MergedRetention types) were never populated or read: the
wire shape sent to the proxy is guardrailConfig, and token/budget caps live on
Policy.Limits with retention on account Settings. Now that mergeGuardrails only
computes prompt capture, trim MergedGuardrails to that single field and delete
the orphaned types.
This commit is contained in:
mlsmaycon
2026-07-26 10:47:56 +00:00
parent 886d5a654b
commit 92664532c5

View File

@@ -1070,37 +1070,13 @@ func unionSourceGroups(policies []*types.Policy) []string {
return out
}
// MergedGuardrails is the JSON shape passed to the proxy via the
// guardrail middleware's config_json. Mirrors the proxy-side
// expectations and is intentionally distinct from
// types.GuardrailChecks so we can evolve either side independently.
// MergedGuardrails is the intermediate the synthesiser folds policy guardrails
// into. Only prompt capture is merged here — the model allowlist is emitted
// per-provider via buildProviderAllowlists, and token/budget/retention moved off
// guardrails onto Policy.Limits and account Settings — so this carries just the
// prompt-capture decision the capture parsers and guardrail config consume.
type MergedGuardrails struct {
TokenLimits MergedTokenLimits `json:"token_limits"`
Budget MergedBudget `json:"budget"`
PromptCapture MergedPromptCapture `json:"prompt_capture"`
Retention MergedRetention `json:"retention"`
}
type MergedTokenLimits struct {
Hourly *MergedTokenWindow `json:"hourly,omitempty"`
Daily *MergedTokenWindow `json:"daily,omitempty"`
Monthly *MergedTokenWindow `json:"monthly,omitempty"`
}
type MergedTokenWindow struct {
MaxInputTokens int `json:"max_input_tokens,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
}
type MergedBudget struct {
Hourly *MergedBudgetWindow `json:"hourly,omitempty"`
Daily *MergedBudgetWindow `json:"daily,omitempty"`
Monthly *MergedBudgetWindow `json:"monthly,omitempty"`
}
type MergedBudgetWindow struct {
SoftCapUSD float64 `json:"soft_cap_usd,omitempty"`
HardCapUSD float64 `json:"hard_cap_usd,omitempty"`
PromptCapture MergedPromptCapture
}
type MergedPromptCapture struct {
@@ -1108,11 +1084,6 @@ type MergedPromptCapture struct {
RedactPii bool `json:"redact_pii"`
}
type MergedRetention struct {
Enabled bool `json:"enabled"`
Days int `json:"days"`
}
// mergeGuardrails computes the prompt-capture portion of the effective
// guardrail spec, given the referencing policies and the account's guardrail
// catalogue. Policy enabled-ness is the caller's responsibility — only enabled