chatstructs

package
v1.7.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHAT_MODEL_CONFIGURATION_OPTION_TYPE_STRING  ChatModelConfigurationOptionType = "string"
	CHAT_MODEL_CONFIGURATION_OPTION_TYPE_NUMBER                                   = "number"
	CHAT_MODEL_CONFIGURATION_OPTION_TYPE_CHOICE                                   = "choice"
	CHAT_MODEL_CONFIGURATION_OPTION_TYPE_BOOLEAN                                  = "boolean"
	CHAT_MODEL_CONFIGURATION_OPTION_TYPE_JSON                                     = "json"
)

Variables

View Source
var (
	AllChatData containerChatData
)

Functions

This section is empty.

Types

type ChatCancelMessage

type ChatCancelMessage struct {
	ContainerName     string `json:"container_name"`
	OperationID       int    `json:"operation_id"`
	ChannelID         int    `json:"channel_id"`
	RequestID         int    `json:"request_id"`
	ResponseMessageID int    `json:"response_message_id"`
	Reason            string `json:"reason"`
	CancelledBy       int    `json:"cancelled_by"`
}

type ChatContextMessage

type ChatContextMessage struct {
	ID                int                    `json:"id"`
	AuthorType        string                 `json:"author_type"`
	SenderDisplayName string                 `json:"sender_display_name"`
	Message           string                 `json:"message"`
	Metadata          map[string]interface{} `json:"metadata"`
	CreatedAt         time.Time              `json:"created_at"`
}

type ChatDefinition

type ChatDefinition struct {
	Name          string `json:"name"`
	Description   string `json:"description"`
	SemVer        string `json:"semver"`
	Models        []ChatModelDefinition
	Subscriptions []string `json:"subscriptions"`
	// ChatFunction receives a context that is cancelled when Mythic sends a chat_cancel message for the request.
	ChatFunction             func(context.Context, ChatRequestMessage)
	OnContainerStartFunction func(context.Context, sharedStructs.ContainerOnStartMessage) sharedStructs.ContainerOnStartMessageResponse `json:"-"`
}

type ChatModelConfigurationOption

type ChatModelConfigurationOption struct {
	// Name - the config key sent to the chat container in ChatRequestMessage.Config.
	Name string `json:"name"`
	// DisplayName - the human-readable label shown for this option in the Mythic UI.
	DisplayName string `json:"display_name"`
	// Type - how the UI should render the option, such as string, number, choice, boolean, or json.
	Type ChatModelConfigurationOptionType `json:"type"`
	// Description - helper text that explains what the operator should supply.
	Description string `json:"description"`
	// Required - indicates whether operators must provide a value before using the model.
	Required bool `json:"required"`
	// DefaultValue - the value shown before operators configure this option. The type should match Type.
	DefaultValue interface{} `json:"default_value"`
	// Choices - selectable values when Type is choice.
	Choices []ChatModelConfigurationOptionChoice `json:"choices,omitempty"`
	// JSONSchema - optional JSON schema shown beside json config editors.
	JSONSchema map[string]interface{} `json:"json_schema,omitempty"`
	// Examples - optional named examples operators can load into json config editors.
	Examples []map[string]interface{} `json:"examples,omitempty"`
	// HelpText - longer operator-facing help for complex config fields.
	HelpText string `json:"help_text,omitempty"`
	// MinRows - preferred minimum visible rows for multiline/json config editors.
	MinRows int `json:"min_rows,omitempty"`
}

type ChatModelConfigurationOptionChoice

type ChatModelConfigurationOptionChoice struct {
	// Label - the human-readable option shown to operators in the Mythic UI.
	Label string `json:"label"`
	// Value - the value written into ChatRequestMessage.Config when the option is selected.
	Value string `json:"value"`
	// Description - optional helper text describing this choice.
	Description string `json:"description,omitempty"`
}

type ChatModelConfigurationOptionType

type ChatModelConfigurationOptionType string

type ChatModelDefinition

type ChatModelDefinition struct {
	// Name - the model name operators select when sending a prompt to this chat container.
	Name string `json:"name"`
	// Description - human-readable summary of what this model does and when operators should use it.
	Description string `json:"description"`
	// Metadata - typed details about provider configuration, user secrets, UI config fields, defaults, and required scopes.
	Metadata ChatModelMetadata `json:"metadata"`
}

type ChatModelMetadata

type ChatModelMetadata struct {
	// Provider - the backing service or model provider, such as litellm, openai, anthropic, or a local engine name.
	Provider string `json:"provider,omitempty"`
	// ConfigurationOptions - per-chat configuration fields Mythic can render for operators and send in ChatRequestMessage.Config.
	ConfigurationOptions []ChatModelConfigurationOption `json:"configuration_options,omitempty"`
	// RequiredUserSecrets - Mythic user secret names required before this model can be used.
	RequiredUserSecrets []string `json:"required_user_secrets,omitempty"`
	// OptionalUserSecrets - Mythic user secret names this model can use when present.
	OptionalUserSecrets []string `json:"optional_user_secrets,omitempty"`
	// RequiredChannelAPITokenScopes - API token scopes required on the AI chat channel for this model's tool access.
	RequiredChannelAPITokenScopes []string `json:"required_channel_api_token_scopes,omitempty"`
	// AdditionalItems - model-specific metadata not covered by the typed fields above. Prefer typed fields when one applies.
	AdditionalItems map[string]interface{} `json:"-"`
}

func (ChatModelMetadata) MarshalJSON

func (c ChatModelMetadata) MarshalJSON() ([]byte, error)

type ChatRequestMessage

type ChatRequestMessage struct {
	ContainerName     string                 `json:"container_name"`
	OperationID       int                    `json:"operation_id"`
	ChannelID         int                    `json:"channel_id"`
	APITokenID        int                    `json:"apitokens_id"`
	ChannelName       string                 `json:"channel_name"`
	ChannelSlug       string                 `json:"channel_slug"`
	RequestID         int                    `json:"request_id"`
	RequestMessageID  int                    `json:"request_message_id"`
	ResponseMessageID int                    `json:"response_message_id"`
	Model             string                 `json:"model"`
	Prompt            string                 `json:"prompt"`
	Config            map[string]interface{} `json:"config"`
	Context           []ChatContextMessage   `json:"context"`
	Secrets           map[string]interface{} `json:"secrets"`
	ConfirmedToolCall map[string]interface{} `json:"confirmed_tool_call,omitempty"`
}

type ChatResponseMessage

type ChatResponseMessage struct {
	OperationID       int                    `json:"operation_id"`
	RequestID         int                    `json:"request_id"`
	ResponseMessageID int                    `json:"response_message_id"`
	Content           string                 `json:"content"`
	IsDelta           bool                   `json:"is_delta"`
	Complete          bool                   `json:"complete"`
	Status            string                 `json:"status"`
	Error             string                 `json:"error"`
	Metadata          map[string]interface{} `json:"metadata"`
}

Jump to

Keyboard shortcuts

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