tools

package
v1.4.25 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package tools contains read-only AI tools backed by Versus state.

Index

Constants

View Source
const (
	CapabilityStatusTrue    = "true"
	CapabilityStatusFalse   = "false"
	CapabilityStatusUnknown = "unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertDecisionProvider

type AlertDecisionProvider interface {
	AlertDecision(context.Context, tenancy.OrgScope, string) (AlertDecisionSnapshot, error)
}

AlertDecisionProvider is the optional read-only alert decision seam.

type AlertDecisionSnapshot

type AlertDecisionSnapshot struct {
	Identifier   string     `json:"identifier"`
	Found        bool       `json:"found"`
	DecisionType string     `json:"decision_type,omitempty"`
	Status       string     `json:"status,omitempty"`
	Action       string     `json:"action,omitempty"`
	Outcome      string     `json:"outcome,omitempty"`
	ReasonKnown  bool       `json:"reason_known"`
	Reason       string     `json:"reason,omitempty"`
	Evidence     []string   `json:"evidence,omitempty"`
	Provenance   string     `json:"provenance,omitempty"`
	Timestamp    *time.Time `json:"timestamp,omitempty"`
	Rule         string     `json:"rule,omitempty"`
	Fingerprint  string     `json:"fingerprint,omitempty"`
}

AlertDecisionSnapshot is one provider-neutral decision record.

type CapabilityStatus

type CapabilityStatus struct {
	Name        string `json:"name"`
	Group       string `json:"group,omitempty"`
	Configured  bool   `json:"configured"`
	Licensed    string `json:"licensed"`
	Available   string `json:"available"`
	Reason      string `json:"reason,omitempty"`
	Observation string `json:"observation,omitempty"`
	SetupAction string `json:"setup_action,omitempty"`
}

CapabilityStatus is one model-safe feature/source availability record.

type CapabilityStatusProvider

type CapabilityStatusProvider interface {
	CapabilityStatuses(tenancy.OrgScope) []CapabilityStatus
}

CapabilityStatusProvider reports bounded, model-safe, provider-neutral state. Implementations must not include credentials, backend errors, or secret values.

type CatalogPageOptions

type CatalogPageOptions struct {
	Offset  int
	Limit   int
	Search  string
	Service string
}

CatalogPageOptions is one bounded catalog read. Total values returned by PatternCatalog page methods are exact after applying Search.

type CategoryHealth

type CategoryHealth struct {
	Kind       string `json:"kind"`
	Configured bool   `json:"configured"`
	Dark       bool   `json:"dark"`
}

CategoryHealth distinguishes configured categories from dark ones.

type DetectionHealthReader

type DetectionHealthReader interface {
	DetectionHealth(tenancy.OrgScope) DetectionHealthSnapshot
}

DetectionHealthReader exposes passive source wiring/runtime observations. Implementations must never pull a source to answer this read.

type DetectionHealthSnapshot

type DetectionHealthSnapshot struct {
	Sources     []SourceHealth   `json:"sources"`
	Categories  []CategoryHealth `json:"categories"`
	Observation string           `json:"observation"`
}

DetectionHealthSnapshot is the configured source and signal-category view.

type GetAlertDecision

type GetAlertDecision struct {
	Provider AlertDecisionProvider
	Scope    tenancy.OrgScope
	Redactor LineRedactor
}

func (GetAlertDecision) ArgsSchema

func (GetAlertDecision) ArgsSchema() map[string]any

func (GetAlertDecision) Description

func (GetAlertDecision) Description() string

func (GetAlertDecision) DisplayName

func (GetAlertDecision) DisplayName() string

func (GetAlertDecision) Invoke

func (tool GetAlertDecision) Invoke(ctx context.Context, args json.RawMessage) (*core.ToolResult, error)

func (GetAlertDecision) Name

func (GetAlertDecision) Name() string

type GetDetectionHealth

type GetDetectionHealth struct {
	Reader DetectionHealthReader
	Scope  tenancy.OrgScope
}

func (GetDetectionHealth) ArgsSchema

func (GetDetectionHealth) ArgsSchema() map[string]any

func (GetDetectionHealth) Description

func (GetDetectionHealth) Description() string

func (GetDetectionHealth) DisplayName

func (GetDetectionHealth) DisplayName() string

func (GetDetectionHealth) Invoke

func (GetDetectionHealth) Name

func (GetDetectionHealth) Name() string

type GetIncident

type GetIncident struct {
	Store    storage.Provider
	Scope    tenancy.OrgScope
	Redactor LineRedactor
}

GetIncident returns bounded lifecycle and assignment metadata for one incident.

func (GetIncident) ArgsSchema

func (GetIncident) ArgsSchema() map[string]any

func (GetIncident) Description

func (GetIncident) Description() string

func (GetIncident) DisplayName

func (GetIncident) DisplayName() string

func (GetIncident) Invoke

func (tool GetIncident) Invoke(_ context.Context, args json.RawMessage) (*core.ToolResult, error)

func (GetIncident) Name

func (GetIncident) Name() string

type GetPattern

type GetPattern struct {
	Catalog  PatternCatalog
	Redactor LineRedactor
}

GetPattern looks up the agent catalog by pattern id and returns the curated metadata (template, counts, baseline, verdict, tags).

func (GetPattern) ArgsSchema

func (GetPattern) ArgsSchema() map[string]any

ArgsSchema implements core.AnalyzeTool.

func (GetPattern) Description

func (GetPattern) Description() string

Description implements core.AnalyzeTool.

func (GetPattern) DisplayName

func (GetPattern) DisplayName() string

func (GetPattern) Invoke

func (p GetPattern) Invoke(_ context.Context, args json.RawMessage) (*core.ToolResult, error)

Invoke implements core.AnalyzeTool.

func (GetPattern) Name

func (GetPattern) Name() string

Name implements core.AnalyzeTool.

type GetService

type GetService struct {
	Catalog     PatternCatalog
	Redactor    LineRedactor
	Reliability ServiceReliabilityProvider
	Scope       tenancy.OrgScope
}

GetService returns the catalog-known summary for a service: how long it has been observed and how many patterns are attributed to it.

func (GetService) ArgsSchema

func (GetService) ArgsSchema() map[string]any

ArgsSchema implements core.AnalyzeTool.

func (GetService) Description

func (GetService) Description() string

Description implements core.AnalyzeTool.

func (GetService) DisplayName

func (GetService) DisplayName() string

func (GetService) Invoke

func (d GetService) Invoke(ctx context.Context, args json.RawMessage) (*core.ToolResult, error)

Invoke implements core.AnalyzeTool.

func (GetService) Name

func (GetService) Name() string

Name implements core.AnalyzeTool.

type GetSystemOverview

type GetSystemOverview struct {
	Store   storage.Provider
	Scope   tenancy.OrgScope
	Catalog PagedPatternCatalog
	Health  DetectionHealthReader
}

GetSystemOverview summarizes the local evidence available to the agent.

func (GetSystemOverview) ArgsSchema

func (GetSystemOverview) ArgsSchema() map[string]any

func (GetSystemOverview) Description

func (GetSystemOverview) Description() string

func (GetSystemOverview) DisplayName

func (GetSystemOverview) DisplayName() string

func (GetSystemOverview) Invoke

func (GetSystemOverview) Name

func (GetSystemOverview) Name() string

type LineRedactor

type LineRedactor interface {
	Scrub(string) string
}

LineRedactor scrubs a catalog sample before it reaches a model.

type ListAnalyses

type ListAnalyses struct {
	Store    storage.Provider
	Scope    tenancy.OrgScope
	Redactor LineRedactor
}

func (ListAnalyses) ArgsSchema

func (ListAnalyses) ArgsSchema() map[string]any

func (ListAnalyses) Description

func (ListAnalyses) Description() string

func (ListAnalyses) DisplayName

func (ListAnalyses) DisplayName() string

func (ListAnalyses) Invoke

func (tool ListAnalyses) Invoke(_ context.Context, args json.RawMessage) (*core.ToolResult, error)

func (ListAnalyses) Name

func (ListAnalyses) Name() string

type ListCapabilities

type ListCapabilities struct{ Capabilities []CapabilityStatus }

func (ListCapabilities) ArgsSchema

func (ListCapabilities) ArgsSchema() map[string]any

func (ListCapabilities) Description

func (ListCapabilities) Description() string

func (ListCapabilities) DisplayName

func (ListCapabilities) DisplayName() string

func (ListCapabilities) Invoke

func (ListCapabilities) Name

func (ListCapabilities) Name() string

type ListPatterns

type ListPatterns struct {
	Catalog  PagedPatternCatalog
	Redactor LineRedactor
}

func (ListPatterns) ArgsSchema

func (ListPatterns) ArgsSchema() map[string]any

func (ListPatterns) Description

func (ListPatterns) Description() string

func (ListPatterns) DisplayName

func (ListPatterns) DisplayName() string

func (ListPatterns) Invoke

func (tool ListPatterns) Invoke(_ context.Context, args json.RawMessage) (*core.ToolResult, error)

func (ListPatterns) Name

func (ListPatterns) Name() string

type ListServices

type ListServices struct {
	Store   storage.Provider
	Scope   tenancy.OrgScope
	Catalog PagedPatternCatalog
}

func (ListServices) ArgsSchema

func (ListServices) ArgsSchema() map[string]any

func (ListServices) Description

func (ListServices) Description() string

func (ListServices) DisplayName

func (ListServices) DisplayName() string

func (ListServices) Invoke

func (tool ListServices) Invoke(_ context.Context, args json.RawMessage) (*core.ToolResult, error)

func (ListServices) Name

func (ListServices) Name() string

type PagedPatternCatalog

type PagedPatternCatalog interface {
	PatternsPage(CatalogPageOptions) ([]*PatternView, int, error)
	ServicesPage(CatalogPageOptions) ([]ServiceRow, int, error)
}

PagedPatternCatalog is the optional bounded catalog capability used by discovery tools. It is separate from PatternCatalog so existing point-read consumers and adapters do not have to fork their shared contract.

type PatternCatalog

type PatternCatalog interface {
	Get(id string) *PatternView
	All() []*PatternView
	AllServices() map[string]ServiceInfo
}

PatternCatalog is the read-only catalog surface used by Versus tools.

type PatternView

type PatternView struct {
	ID        string
	Template  string
	Source    string
	Service   string
	RuleName  string
	Verdict   string
	Tags      []string
	Count     int
	Baseline  float64
	FirstSeen time.Time
	LastSeen  time.Time
	Samples   []string
	// AutoPromoteAfter is the effective sighting threshold used by the
	// owning catalog. Zero means the threshold is unavailable.
	AutoPromoteAfter int
}

PatternView contains the catalog fields exposed to AI tools.

type SearchIncidents

type SearchIncidents struct {
	Store    storage.Provider
	Scope    tenancy.OrgScope
	Redactor LineRedactor
}

func (SearchIncidents) ArgsSchema

func (SearchIncidents) ArgsSchema() map[string]any

func (SearchIncidents) Description

func (SearchIncidents) Description() string

func (SearchIncidents) DisplayName

func (SearchIncidents) DisplayName() string

func (SearchIncidents) Invoke

func (SearchIncidents) Name

func (SearchIncidents) Name() string

type ServiceIndicator

type ServiceIndicator struct {
	Name        string   `json:"name"`
	Kind        string   `json:"kind,omitempty"`
	Description string   `json:"description,omitempty"`
	Current     *float64 `json:"current,omitempty"`
	Unit        string   `json:"unit,omitempty"`
}

type ServiceInfo

type ServiceInfo struct {
	FirstSeen time.Time
}

ServiceInfo contains service fields exposed to AI tools.

type ServiceObjective

type ServiceObjective struct {
	Name       string  `json:"name"`
	SLI        string  `json:"sli"`
	Target     float64 `json:"target"`
	WindowDays int     `json:"window_days,omitempty"`
	Derived    bool    `json:"derived,omitempty"`
}

type ServiceReliabilityProvider

type ServiceReliabilityProvider interface {
	ServiceReliability(context.Context, tenancy.OrgScope, string) (ServiceReliabilitySnapshot, error)
}

ServiceReliabilityProvider is the optional read-only reliability seam.

type ServiceReliabilitySnapshot

type ServiceReliabilitySnapshot struct {
	Service     string             `json:"service"`
	SLIs        []ServiceIndicator `json:"slis"`
	SLOs        []ServiceObjective `json:"slos"`
	Source      string             `json:"source,omitempty"`
	Observation string             `json:"observation,omitempty"`
	Configured  bool               `json:"configured"`
	Licensed    string             `json:"licensed"`
	Available   string             `json:"available"`
	Reason      string             `json:"reason,omitempty"`
	SetupAction string             `json:"setup_action,omitempty"`
}

ServiceReliabilitySnapshot contains provider-neutral service reliability data.

type ServiceRow

type ServiceRow struct {
	Name string
	Info ServiceInfo
}

ServiceRow is one stable, ordered service catalog row.

type SourceHealth

type SourceHealth struct {
	Name               string     `json:"name"`
	Kind               string     `json:"kind"`
	Configured         bool       `json:"configured"`
	Observation        string     `json:"observation"`
	LastSuccessfulPull *time.Time `json:"last_successful_pull,omitempty"`
	ErrorClass         string     `json:"error_class,omitempty"`
}

SourceHealth describes one configured source without endpoint or secret data.

Jump to

Keyboard shortcuts

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