analyzer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 33 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

Overview

Package analyzer receives signed watch alerts and investigates them through a read-only MCP connection and a function-calling model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Report struct {
		Language       string `yaml:"language"`
		SuggestActions bool   `yaml:"suggest_actions"`
		ApprovalURL    string `yaml:"approval_url"`
	} `yaml:"report"`
	Listen     string `yaml:"listen"`
	SecretFile string `yaml:"secret_file"`
	MCP        struct {
		Endpoint  string `yaml:"endpoint"`
		TokenFile string `yaml:"token_file"`
	} `yaml:"mcp"`
	Model struct {
		Backend string `yaml:"backend"`
		Codex   struct {
			Binary    string `yaml:"binary"`
			ConfigDir string `yaml:"config_dir"`
		} `yaml:"codex"`
		Claude struct {
			Binary       string  `yaml:"binary"`
			ConfigDir    string  `yaml:"config_dir"`
			MaxTurns     int     `yaml:"max_turns"`
			MaxBudgetUSD float64 `yaml:"max_budget_usd"`
		} `yaml:"claude"`
		Endpoint   string `yaml:"endpoint"`
		Name       string `yaml:"name"`
		APIKeyFile string `yaml:"api_key_file"`
	} `yaml:"model"`
	Forward struct {
		URL              string `yaml:"url"`
		SecretFile       string `yaml:"secret_file"`
		AllowPrivateHTTP bool   `yaml:"allow_private_http"`
	} `yaml:"forward"`
	DiscordURLFile      string        `yaml:"discord_url_file"`
	WarningsOnly        bool          `yaml:"warnings_only"`
	BatchWindow         time.Duration `yaml:"batch_window"`
	Cooldown            time.Duration `yaml:"cooldown"`
	Timeout             time.Duration `yaml:"timeout"`
	QueueSize           int           `yaml:"queue_size"`
	MaxToolCalls        int           `yaml:"max_tool_calls"`
	MaxRounds           int           `yaml:"max_rounds"`
	MaxCompletionTokens int           `yaml:"max_completion_tokens"`
	MaxTotalTokens      int           `yaml:"max_total_tokens"`
	MaxContextBytes     int           `yaml:"max_context_bytes"`
	ToolOutputBytes     int           `yaml:"tool_output_bytes"`
}

Config is independent of the opsgate MCP server configuration.

func Default

func Default() Config

Default returns bounded investigation settings. No model is selected implicitly.

func Load

func Load(path string) (Config, error)

Load strictly parses one YAML document and validates configuration only.

func (Config) Validate

func (c Config) Validate() error

Validate rejects invalid URLs, missing credential paths and unbounded settings.

type Service

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

Service is a bounded, in-memory investigation queue and webhook handler. One worker serializes investigations, limiting model spending and MCP load.

func New

func New(c Config) (*Service, error)

New loads credentials without sending network requests. No watcher or model is started unless all files and endpoints are valid.

func (*Service) Handler

func (s *Service) Handler() http.Handler

Handler exposes only /alerts and /healthz. Alert bodies are capped at 1 MiB.

func (*Service) Run

func (s *Service) Run(ctx context.Context)

Run processes pending investigations until canceled; pending jobs are not persistent.

Jump to

Keyboard shortcuts

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