scenario

package
v1.261126.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MPL-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeCodeModelTier added in v1.261001.1

type ClaudeCodeModelTier struct {
	Alias         string `json:"alias"`
	Model         string `json:"model"`
	ProviderName  string `json:"provider_name,omitempty"`
	ProviderModel string `json:"provider_model,omitempty"`
}

ClaudeCodeModelTier is one model Claude Code can be asked for: the alias passed as --model ("" for the default), the gateway model id it requests, and where the rules currently route that.

type ClaudeCodeModelsData added in v1.261001.1

type ClaudeCodeModelsData struct {
	Unified bool                  `json:"unified"`
	Tiers   []ClaudeCodeModelTier `json:"tiers"`
}

ClaudeCodeModelsData: Unified means every tier requests one model, so Tiers holds just the default and the model can only change through the rules.

type ClaudeCodeModelsResponse added in v1.261001.1

type ClaudeCodeModelsResponse struct {
	Success bool                 `json:"success"`
	Data    ClaudeCodeModelsData `json:"data"`
}

ClaudeCodeModelsResponse lists the model tiers a Claude Code routing offers.

type ClaudeCodeRouteResponse added in v1.261022.1

type ClaudeCodeRouteResponse struct {
	// Scenario is "claude_code" or "claude_code:<profile id>".
	Scenario string `json:"scenario"`
	// RequestedModel is the gateway model the chosen tier asks for, else the
	// model given; empty if neither is known, and then nothing below is set.
	RequestedModel string              `json:"requested_model,omitempty"`
	ProviderName   string              `json:"provider_name,omitempty"`
	ProviderModel  string              `json:"provider_model,omitempty"`
	Quota          []RouteQuotaSegment `json:"quota"`
}

ClaudeCodeRouteResponse is where a Claude Code session's requests go and the quota they draw on: the Tingly Box half of a session's status line (the token half comes from the transcript's usage entries).

type ClaudeCodeSlotRequest added in v1.261023.0

type ClaudeCodeSlotRequest struct {
	Enabled bool `json:"enabled"`
}

ClaudeCodeSlotRequest gives a Claude Code model slot a rule of its own (enabled) or hands it back to the main rule.

type ClaudeCodeSlotsData added in v1.261023.0

type ClaudeCodeSlotsData struct {
	Slots []string  `json:"slots"`
	Rule  *typ.Rule `json:"rule,omitempty"`
}

ClaudeCodeSlotsData lists the slots that have a rule of their own in a unified-mode Claude Code scenario; Rule is the toggled slot's rule.

type ClaudeCodeSlotsResponse added in v1.261023.0

type ClaudeCodeSlotsResponse struct {
	Success bool                `json:"success"`
	Data    ClaudeCodeSlotsData `json:"data"`
}

type ClaudeCodeUseProfileRequest added in v1.261105.1

type ClaudeCodeUseProfileRequest struct {
	Profile string `json:"profile" binding:"required" example:"p1"`
}

ClaudeCodeUseProfileRequest names the profile (ID or name) whose routing the default Claude Code config is overwritten with.

type ClaudeCodeUseProfileResponse added in v1.261105.1

type ClaudeCodeUseProfileResponse struct {
	Success bool `json:"success"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles scenario HTTP requests

func NewHandler

func NewHandler(cfg *config.Config, rcControl RemoteControlController) *Handler

NewHandler creates a new scenario handler

func (*Handler) CreateProfile

func (h *Handler) CreateProfile(c *gin.Context)

CreateProfile creates a new profile for a base scenario

func (*Handler) DeleteProfile

func (h *Handler) DeleteProfile(c *gin.Context)

DeleteProfile deletes a profile by ID

func (*Handler) DeleteProfileClaudeConfig added in v0.260723.1

func (h *Handler) DeleteProfileClaudeConfig(c *gin.Context)

DeleteProfileClaudeConfig clears only the profile-specific delta, preserving the profile, its rules, and the main configuration it inherits.

func (*Handler) DuplicateProfile added in v1.261105.1

func (h *Handler) DuplicateProfile(c *gin.Context)

DuplicateProfile copies a profile (":id" = "default" is the main configuration) into a new one; the source is untouched.

func (*Handler) GetClaudeCodeModels added in v1.261001.1

func (h *Handler) GetClaudeCodeModels(c *gin.Context)

GetClaudeCodeModels lists the tiers of the main claude_code routing, or of a profile (query: profile), read from the env Claude Code is given. Nothing is written: a profile's env is resolved, not materialized.

func (*Handler) GetClaudeCodeRoute added in v1.261022.1

func (h *Handler) GetClaudeCodeRoute(c *gin.Context)

GetClaudeCodeRoute resolves where a Claude Code session's next request goes: under profile, the gateway model of tier (the default tier when empty), falling back to model (what the latest turn asked for).

func (*Handler) GetClaudeCodeSlots added in v1.261023.0

func (h *Handler) GetClaudeCodeSlots(c *gin.Context)

GetClaudeCodeSlots lists the slots with a rule of their own.

func (*Handler) GetProfileClaudeConfig added in v0.260723.1

func (h *Handler) GetProfileClaudeConfig(c *gin.Context)

GetProfileClaudeConfig returns the profile's concrete effective values and its inherited base so the UI can explain and reset overrides accurately.

func (*Handler) GetProfiles

func (h *Handler) GetProfiles(c *gin.Context)

GetProfiles returns all profiles for a base scenario

func (*Handler) GetScenarioConfig

func (h *Handler) GetScenarioConfig(c *gin.Context)

GetScenarioConfig returns configuration for a specific scenario

func (*Handler) GetScenarioDescriptors added in v0.260611.1

func (h *Handler) GetScenarioDescriptors(c *gin.Context)

GetScenarios returns all scenario configurations GetScenarioDescriptors returns all registered scenario descriptors from the registry.

func (*Handler) GetScenarioFlag

func (h *Handler) GetScenarioFlag(c *gin.Context)

GetScenarioFlag returns a specific flag value for a scenario

func (*Handler) GetScenarioIntFlag added in v0.260611.1

func (h *Handler) GetScenarioIntFlag(c *gin.Context)

GetScenarioIntFlag returns a specific integer flag value for a scenario

func (*Handler) GetScenarioStringFlag

func (h *Handler) GetScenarioStringFlag(c *gin.Context)

GetScenarioStringFlag returns a specific string flag value for a scenario

func (*Handler) GetScenarios

func (h *Handler) GetScenarios(c *gin.Context)

func (*Handler) RegisterRoutes added in v1.261002.1

func (h *Handler) RegisterRoutes(rt *module.Routes)

func (*Handler) SetClaudeCodeSlot added in v1.261023.0

func (h *Handler) SetClaudeCodeSlot(c *gin.Context)

SetClaudeCodeSlot gives a slot a rule of its own, or hands it back to the main rule.

func (*Handler) SetScenarioConfig

func (h *Handler) SetScenarioConfig(c *gin.Context)

SetScenarioConfig creates or updates scenario configuration

func (*Handler) SetScenarioFlag

func (h *Handler) SetScenarioFlag(c *gin.Context)

SetScenarioFlag sets a specific flag value for a scenario

func (*Handler) SetScenarioIntFlag added in v0.260611.1

func (h *Handler) SetScenarioIntFlag(c *gin.Context)

SetScenarioIntFlag sets a specific integer flag value for a scenario

func (*Handler) SetScenarioStringFlag

func (h *Handler) SetScenarioStringFlag(c *gin.Context)

SetScenarioStringFlag sets a specific string flag value for a scenario

func (*Handler) UpdateProfile

func (h *Handler) UpdateProfile(c *gin.Context)

UpdateProfile updates a profile's name and/or mode

func (*Handler) UpdateProfileClaudeConfig added in v0.260723.1

func (h *Handler) UpdateProfileClaudeConfig(c *gin.Context)

UpdateProfileClaudeConfig persists profile overrides and materializes them immediately. CLI launch uses the same resolver and will reproduce the file.

func (*Handler) UseClaudeCodeProfile added in v1.261105.1

func (h *Handler) UseClaudeCodeProfile(c *gin.Context)

UseClaudeCodeProfile overwrites the default Claude Code routing with a copy of a profile's. Only the main claude_code scenario can be switched.

func (*Handler) WithRoutePreview added in v1.261001.1

func (h *Handler) WithRoutePreview(routes RoutePreviewer) *Handler

WithRoutePreview lets GetClaudeCodeModels name each tier's provider and GetClaudeCodeRoute resolve one; without it the tiers are listed with their gateway model ids only.

type ProfileClaudeConfigData added in v0.260723.1

type ProfileClaudeConfigData struct {
	BasePreferences      agent.ClaudeCodePrefs `json:"basePreferences"`
	Preferences          agent.ClaudeCodePrefs `json:"preferences"`
	InheritedDefaultMode string                `json:"inheritedDefaultMode"`
	DefaultMode          string                `json:"defaultMode"`
	OverrideKeys         []string              `json:"overrideKeys"`
	HasOverrides         bool                  `json:"hasOverrides"`
	SettingsPath         string                `json:"settingsPath"`
	SettingsExists       bool                  `json:"settingsExists"`
}

type ProfileClaudeConfigRequest added in v0.260723.1

type ProfileClaudeConfigRequest struct {
	Preferences  *agent.ClaudeCodePrefs `json:"preferences" binding:"required"`
	DefaultMode  string                 `json:"defaultMode,omitempty"`
	OverrideKeys *[]string              `` /* 175-byte string literal not displayed */
}

ProfileClaudeConfigRequest updates the selected overrides for one Claude Code profile.

type ProfileClaudeConfigResponse added in v0.260723.1

type ProfileClaudeConfigResponse struct {
	Success bool                    `json:"success"`
	Data    ProfileClaudeConfigData `json:"data"`
}

type ProfileCreateRequest

type ProfileCreateRequest struct {
	Name    string `json:"name" binding:"required"`
	Unified bool   `json:"unified,omitempty"` // Deprecated and ignored: Claude Code has no modes (TEP-2197)
}

ProfileCreateRequest represents the request to create or rename a profile

type ProfileDuplicateRequest added in v1.261105.1

type ProfileDuplicateRequest struct {
	Name string `json:"name,omitempty" example:"work-copy"` // Optional; empty picks a free "<source>-copy" name
}

ProfileDuplicateRequest represents the request to copy a profile

type ProfileUpdateRequest added in v0.260414.2000

type ProfileUpdateRequest struct {
	Name    string `json:"name,omitempty"`
	Unified *bool  `json:"unified,omitempty"` // Pointer to distinguish zero from unset; nil = no change
	// MCPProfile is the MCP profile a Claude Code profile's launches connect
	// to ("" = none); nil = no change.
	MCPProfile *string `json:"mcp_profile,omitempty"`
}

ProfileUpdateRequest represents the request to update a profile

type RemoteControlController

type RemoteControlController interface {
	StartRemoteCoder() error
	StopRemoteCoder()
	SyncRemoteCoderBots(ctx context.Context) error
}

RemoteControlController defines the interface for controlling remote coder service

type RoutePreviewer added in v1.261001.1

type RoutePreviewer interface {
	PreviewRoute(scenario, modelID string) *statusline.Route
	ResolveRoute(ctx context.Context, scenario, modelID string) *statusline.Route
}

RoutePreviewer predicts where a scenario routes a model, without claiming a load-balancer probe slot (statusline.Handler.PreviewRoute), and resolves it with the provider's quota for a status line (ResolveRoute).

type RouteQuotaSegment added in v1.261022.1

type RouteQuotaSegment struct {
	Type    string `json:"type"`
	Balance bool   `json:"balance"`
	// Text is the value as the terminal status line renders it:
	// "60% left", "12K/100K left", "$12.40".
	Text         string     `json:"text"`
	UsedPercent  float64    `json:"used_percent"`
	ResetsAt     *time.Time `json:"resets_at,omitempty"`
	LimitReached bool       `json:"limit_reached"`
}

RouteQuotaSegment is one quota window of the routed provider.

type ScenarioDescriptorsResponse added in v0.260611.1

type ScenarioDescriptorsResponse struct {
	Success bool                     `json:"success" example:"true"`
	Data    []typ.ScenarioDescriptor `json:"data"`
}

ScenarioDescriptorsResponse represents the response for listing scenario descriptors

type ScenarioFlagResponse

type ScenarioFlagResponse struct {
	Success bool `json:"success" example:"true"`
	Data    struct {
		Scenario typ.RuleScenario `json:"scenario" example:"claude_code"`
		Flag     string           `json:"flag" example:"unified"`
		Value    bool             `json:"value" example:"true"`
	} `json:"data"`
}

ScenarioFlagResponse represents the response for a scenario flag

type ScenarioFlagUpdateRequest

type ScenarioFlagUpdateRequest struct {
	Value bool `json:"value"`
}

ScenarioFlagUpdateRequest represents the request to update a boolean flag

type ScenarioIntFlagUpdateRequest added in v0.260611.1

type ScenarioIntFlagUpdateRequest struct {
	Value int `json:"value"`
}

ScenarioIntFlagUpdateRequest represents the request to update an integer flag

type ScenarioResponse

type ScenarioResponse struct {
	Success bool               `json:"success" example:"true"`
	Data    typ.ScenarioConfig `json:"data"`
}

ScenarioResponse represents the response for a single scenario

type ScenarioStringFlagUpdateRequest

type ScenarioStringFlagUpdateRequest struct {
	Value string `json:"value"`
}

ScenarioStringFlagUpdateRequest represents the request to update a string flag

type ScenarioUpdateRequest

type ScenarioUpdateRequest struct {
	Scenario typ.RuleScenario  `json:"scenario" binding:"required" example:"claude_code"`
	Flags    typ.ScenarioFlags `json:"flags" binding:"required"`
}

ScenarioUpdateRequest represents the request to update a scenario

type ScenarioUpdateResponse

type ScenarioUpdateResponse struct {
	Success bool               `json:"success" example:"true"`
	Message string             `json:"message" example:"Scenario config saved successfully"`
	Data    typ.ScenarioConfig `json:"data"`
}

ScenarioUpdateResponse represents the response for updating scenario

type ScenariosResponse

type ScenariosResponse struct {
	Success bool                 `json:"success" example:"true"`
	Data    []typ.ScenarioConfig `json:"data"`
}

ScenariosResponse represents the response for getting all scenarios

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL