// quota_provider.go declares the narrow QuotaProvider interface used by // kv_set and file_save to enforce per-skill byte quotas at write time. // // Why a narrow interface (vs importing pkg/logic/skills directly): same // cycle constraint as kv_storage.go and file_storage.go — pkg/logic/skills // already imports pkg/skilltools, so importing skills back here would // form an import cycle. Production wiring (pkg/logic/mort.go) supplies // *skills.System, which satisfies QuotaProvider via its EffectiveQuota // method. // // Why a separate interface vs adding the method to KVStorage/FileStorage: // quota resolution is a system-level policy (combining override + convar // + default), not a pure storage read. Keeping it separate lets a tool // constructor accept a nil QuotaProvider when an integrator wants to // skip enforcement (e.g. an admin-only skill that bypasses caps). package tools import "context" // QuotaProvider returns effective per-skill quotas for the storage // tools' write-path enforcement. Production wires *skills.System, which // satisfies this via its EffectiveQuota method. // // nil-safe: tools constructed against a nil QuotaProvider do NOT enforce // per-skill quotas. That mode is useful for tests and for environments // where quota enforcement is intentionally disabled. type QuotaProvider interface { // EffectiveQuota returns the effective KV and file byte caps for the // skill. The two values resolve admin overrides + convar defaults + // package constants in that order. EffectiveQuota(ctx context.Context, skillID string) (kvMax, filesMax int64, err error) }