Documentation
¶
Index ¶
- type CreateRuleRequest
- type DeleteRuleResponse
- type FlagRegistryResponse
- type Handler
- func (h *Handler) CreateRule(c *gin.Context)
- func (h *Handler) DeleteRule(c *gin.Context)
- func (h *Handler) GetFlagRegistry(c *gin.Context)
- func (h *Handler) GetRule(c *gin.Context)
- func (h *Handler) GetRules(c *gin.Context)
- func (h *Handler) RegisterRoutes(rt *module.Routes)
- func (h *Handler) ReorderRules(c *gin.Context)
- func (h *Handler) UpdateRule(c *gin.Context)
- type ReorderRulesRequest
- type RuleResponse
- type RulesResponse
- type UpdateRuleRequest
- type UpdateRuleResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRuleRequest ¶
CreateRuleRequest represents the request to create a rule
type DeleteRuleResponse ¶
type DeleteRuleResponse struct {
Success bool `json:"success" example:"true"`
Message string `json:"message" example:"Rule deleted successfully"`
}
DeleteRuleResponse represents the response for deleting a rule
type FlagRegistryResponse ¶ added in v0.260531.1
type FlagRegistryResponse struct {
Success bool `json:"success" example:"true"`
Data []typ.FlagSpec `json:"data"`
}
FlagRegistryResponse exposes the catalog of supported rule-level flags so the UI can render an extension catalog without hard-coding the list.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles rule HTTP requests
func NewHandler ¶
NewHandler creates a new rule handler
func (*Handler) CreateRule ¶
CreateRule creates a new rule
func (*Handler) GetFlagRegistry ¶ added in v0.260531.1
GetFlagRegistry returns the catalog of supported rule-level flags.
func (*Handler) RegisterRoutes ¶ added in v1.261002.1
func (*Handler) ReorderRules ¶ added in v1.261109.0
ReorderRules applies a new list order to one scenario's rules. The order is hard state — it reaches /v1/models, match priority and client config generation — and is persisted through the same Save() choke point as every other rule mutation. Unknown UUIDs and UUIDs from another scenario are rejected; rules the caller has not named keep their relative order and follow the named ones, so a stale client never drops a concurrent creation.
func (*Handler) UpdateRule ¶
UpdateRule creates or updates a rule
type ReorderRulesRequest ¶ added in v1.261109.0
type ReorderRulesRequest struct {
Scenario string `json:"scenario" example:"openai"`
OrderedUUIDs []string `json:"ordered_uuids"`
}
ReorderRulesRequest represents the request to apply a new list order to one scenario's rules. ordered_uuids names that scenario's rules in their new order; rules of the scenario missing from the list keep their current relative order and follow the named ones. The order is hard state: it drives /v1/models listing, same-tier match priority and client config generation.
type RuleResponse ¶
type RuleResponse struct {
Success bool `json:"success" example:"true"`
Data *typ.Rule `json:"data"`
}
RuleResponse represents a rule configuration response
type RulesResponse ¶
type RulesResponse struct {
Success bool `json:"success" example:"true"`
Data interface{} `json:"data"`
}
RulesResponse represents the response for getting all rules
type UpdateRuleRequest ¶
UpdateRuleRequest represents the request to set/update a rule
type UpdateRuleResponse ¶
type UpdateRuleResponse struct {
Success bool `json:"success" example:"true"`
Message string `json:"message" example:"Rule saved successfully"`
Data struct {
UUID string `json:"uuid"`
Scenario string `json:"scenario" example:"openai"`
RequestModel string `json:"request_model" example:"gpt-3.5-turbo"`
ResponseModel string `json:"response_model" example:"gpt-3.5-turbo"`
Description string `json:"description" example:"My rule description"`
Provider string `json:"provider" example:"openai"`
DefaultModel string `json:"default_model" example:"gpt-3.5-turbo"`
Active bool `json:"active" example:"true"`
SmartEnabled bool `json:"smart_enabled" example:"false"`
SmartRouting []smartrouting.SmartRouting `json:"smart_routing,omitempty"`
// Flags echoes the rule's persisted feature flags. Creation seeds
// per-scenario defaults (e.g. team rules get claude_code_compat +
// clean_header), so the client must read them back from here to reflect
// the true stored state without a follow-up refresh.
Flags typ.RuleFlags `json:"flags,omitempty"`
} `json:"data"`
}
UpdateRuleResponse represents the response for setting/updating a rule