types

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package types provides shared cross-repo contracts for the hawk-eco platform. This file adds types for composio and cognee integration, enabling SDKs and engines to share a common vocabulary for:

  • Composio tool metadata (discovery, search, execution)
  • Cognee structured memory entries (QA, trace, feedback, skill run)
  • Composio credential management

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentSkill added in v0.1.12

type AgentSkill struct {
	Name          string             `json:"name"`
	Description   string             `json:"description"`
	Version       string             `json:"version"`
	Author        string             `json:"author"`
	License       string             `json:"license"`
	Category      AgentSkillCategory `json:"category,omitempty"`
	AutoInvoke    bool               `json:"auto_invoke,omitempty"`
	Compatibility string             `json:"compatibility,omitempty"`
	AllowedTools  string             `json:"allowed_tools,omitempty"`
	Agents        []string           `json:"agents,omitempty"`
	Invoke        string             `json:"invoke,omitempty"`
	Refs          []string           `json:"refs,omitempty"`
	Chain         AgentSkillChain    `json:"chain,omitempty"`
}

AgentSkill represents a skill conforming to the agentskills.io specification.

type AgentSkillCategory added in v0.1.12

type AgentSkillCategory string

AgentSkillCategory defines the category of an agent skill.

const (
	SkillCategoryEngineering AgentSkillCategory = "engineering"
	SkillCategoryOps         AgentSkillCategory = "ops"
	SkillCategoryTesting     AgentSkillCategory = "testing"
	SkillCategorySecurity    AgentSkillCategory = "security"
	SkillCategoryDevtools    AgentSkillCategory = "devtools"
	SkillCategoryWorkflow    AgentSkillCategory = "workflow"
)

type AgentSkillChain added in v0.1.12

type AgentSkillChain struct {
	After     []string `json:"after,omitempty"`
	Before    []string `json:"before,omitempty"`
	Conflicts []string `json:"conflicts,omitempty"`
	Enhances  []string `json:"enhances,omitempty"`
}

AgentSkillChain declares relationships between skills.

type AuditSeverity

type AuditSeverity string

AuditSeverity indicates how dangerous a security audit finding is.

const (
	AuditSeverityCritical AuditSeverity = "CRITICAL"
	AuditSeverityWarning  AuditSeverity = "WARNING"
	AuditSeverityInfo     AuditSeverity = "INFO"
)

type CogneeEntryType added in v0.1.12

type CogneeEntryType string

CogneeEntryType identifies a structured memory entry kind.

const (
	CogneeEntryQA       CogneeEntryType = "qa"
	CogneeEntryTrace    CogneeEntryType = "trace"
	CogneeEntryFeedback CogneeEntryType = "feedback"
	CogneeEntrySkillRun CogneeEntryType = "skill_run"
)

type CogneeFeedbackEntry added in v0.1.12

type CogneeFeedbackEntry struct {
	Type         CogneeEntryType `json:"type"`
	TargetNodeID string          `json:"target_node_id"`
	FeedbackText string          `json:"feedback_text"`
	Score        *int            `json:"feedback_score,omitempty"`
	Project      string          `json:"project"`
	SessionID    string          `json:"session_id,omitempty"`
	SourceAgent  string          `json:"source_agent,omitempty"`
	Timestamp    time.Time       `json:"timestamp"`
}

CogneeFeedbackEntry attaches feedback to an existing QA entry.

type CogneeQAEntry added in v0.1.12

type CogneeQAEntry struct {
	Type          CogneeEntryType `json:"type"`
	Question      string          `json:"question"`
	Answer        string          `json:"answer"`
	Context       string          `json:"context,omitempty"`
	FeedbackText  string          `json:"feedback_text,omitempty"`
	FeedbackScore *int            `json:"feedback_score,omitempty"`
	UsedGraphIDs  []string        `json:"used_graph_element_ids,omitempty"`
	SessionID     string          `json:"session_id,omitempty"`
	Project       string          `json:"project"`
	SourceAgent   string          `json:"source_agent,omitempty"`
	Timestamp     time.Time       `json:"timestamp"`
}

CogneeQAEntry captures a Q&A conversation turn with optional feedback.

type CogneeSkillRunEntry added in v0.1.12

type CogneeSkillRunEntry struct {
	Type         CogneeEntryType `json:"type"`
	SkillName    string          `json:"skill_name"`
	SkillVersion string          `json:"skill_version,omitempty"`
	Params       string          `json:"params,omitempty"`
	Result       string          `json:"result,omitempty"`
	Status       string          `json:"status"`
	DurationMs   int64           `json:"duration_ms,omitempty"`
	Error        string          `json:"error,omitempty"`
	Project      string          `json:"project"`
	SessionID    string          `json:"session_id,omitempty"`
	SourceAgent  string          `json:"source_agent,omitempty"`
	Timestamp    time.Time       `json:"timestamp"`
}

CogneeSkillRunEntry persists an execution record for a skill.

type CogneeTraceEntry added in v0.1.12

type CogneeTraceEntry struct {
	Type              CogneeEntryType `json:"type"`
	OriginFunction    string          `json:"origin_function"`
	Status            string          `json:"status"`
	MethodParams      string          `json:"method_params,omitempty"`
	MethodReturnValue string          `json:"method_return_value,omitempty"`
	MemoryQuery       string          `json:"memory_query,omitempty"`
	MemoryContext     string          `json:"memory_context,omitempty"`
	ErrorMessage      string          `json:"error_message,omitempty"`
	GenerateFeedback  bool            `json:"generate_feedback_with_llm"`
	SessionID         string          `json:"session_id"`
	Project           string          `json:"project"`
	SourceAgent       string          `json:"source_agent,omitempty"`
	Timestamp         time.Time       `json:"timestamp"`
}

CogneeTraceEntry captures a single step in an agent's execution trace.

type ComposioCredential added in v0.1.12

type ComposioCredential struct {
	ID          string            `json:"id"`
	ServiceName string            `json:"service_name"`
	Type        string            `json:"type"` // "oauth", "api_key", "password"
	Value       string            `json:"-"`    // never serialize
	Scope       string            `json:"scope,omitempty"`
	ExpiresAt   time.Time         `json:"expires_at,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

ComposioCredential holds an API credential for a connected service.

func (ComposioCredential) IsExpired added in v0.1.12

func (c ComposioCredential) IsExpired() bool

IsExpired reports whether the credential has expired.

type ComposioTool added in v0.1.12

type ComposioTool struct {
	Name         string                 `json:"name"`
	Description  string                 `json:"description"`
	Scope        ComposioToolScope      `json:"scope"`
	AuthRequired bool                   `json:"auth_required"`
	Params       map[string]interface{} `json:"params"`
	Tags         []string               `json:"tags"`
	Category     string                 `json:"category"`
}

ComposioTool represents a tool available from the composio platform.

type ComposioToolResult added in v0.1.12

type ComposioToolResult struct {
	Success bool                   `json:"success"`
	Data    map[string]interface{} `json:"data,omitempty"`
	Error   string                 `json:"error,omitempty"`
}

ComposioToolResult is the result of executing a composio tool.

type ComposioToolScope added in v0.1.12

type ComposioToolScope string

ComposioToolScope defines the scope at which a composio tool operates.

const (
	ComposioScopeReadOnly ComposioToolScope = "read"
	ComposioScopeWrite    ComposioToolScope = "write"
	ComposioScopeAction   ComposioToolScope = "action"
)

type Finding

type Finding struct {
	ID         string            `json:"id"`
	Source     string            `json:"source"`
	Concern    string            `json:"concern"`
	Severity   Severity          `json:"severity"`
	File       string            `json:"file,omitempty"`
	URL        string            `json:"url,omitempty"`
	Line       int               `json:"line,omitempty"`
	EndLine    int               `json:"end_line,omitempty"`
	Message    string            `json:"message"`
	CWE        string            `json:"cwe,omitempty"`
	Confidence float64           `json:"confidence"`
	Fix        string            `json:"fix,omitempty"`
	Reasoning  string            `json:"reasoning,omitempty"`
	Tags       []string          `json:"tags,omitempty"`
	Metadata   map[string]string `json:"metadata,omitempty"`
	CreatedAt  time.Time         `json:"created_at"`
}

Finding represents a unified analysis concern sourced from Hawk support engines.

func FindingFromInspect

func FindingFromInspect(
	concern, url, message string,
	sev Severity,
	tags []string,
) Finding

FindingFromInspect constructs a Finding from an inspect analysis result.

func FindingFromSight

func FindingFromSight(
	concern, file string,
	line int,
	message, cwe string,
	sev Severity,
	confidence float64,
) Finding

FindingFromSight constructs a Finding from a sight review result.

func (Finding) Validate added in v0.1.13

func (f Finding) Validate() error

Validate reports whether the finding satisfies the minimum contract invariants: a non-blank Message, a non-negative Line, and a Confidence within [0, 1]. It returns a descriptive error naming the first violated field.

type FindingSlice

type FindingSlice []Finding

FindingSlice is sortable by severity descending and confidence descending.

func (FindingSlice) ByFile

func (s FindingSlice) ByFile() map[string]FindingSlice

ByFile groups findings by their File field.

func (FindingSlice) FilterByConfidence

func (s FindingSlice) FilterByConfidence(min float64) FindingSlice

FilterByConfidence returns findings whose Confidence is >= min.

func (FindingSlice) FilterBySeverity

func (s FindingSlice) FilterBySeverity(min Severity) FindingSlice

FilterBySeverity returns findings whose Severity is at least min.

func (FindingSlice) FilterBySource

func (s FindingSlice) FilterBySource(source string) FindingSlice

FilterBySource returns findings whose Source matches the given value.

func (FindingSlice) Len

func (s FindingSlice) Len() int

func (FindingSlice) Less

func (s FindingSlice) Less(i, j int) bool

func (FindingSlice) Summary

func (s FindingSlice) Summary() FindingSummary

Summary returns a FindingSummary for the slice.

func (FindingSlice) Swap

func (s FindingSlice) Swap(i, j int)

type FindingSummary

type FindingSummary struct {
	Total         int            `json:"total"`
	BySource      map[string]int `json:"by_source"`
	BySeverity    map[string]int `json:"by_severity"`
	AvgConfidence float64        `json:"avg_confidence"`
}

FindingSummary provides aggregate counts over a set of findings.

type Severity

type Severity int

Severity represents the impact level of a finding.

const (
	SeverityInfo Severity = iota
	SeverityLow
	SeverityMedium
	SeverityHigh
	SeverityCritical
)

func ParseSeverity deprecated

func ParseSeverity(s string) Severity

ParseSeverity converts a string to a Severity.

Deprecated: ParseSeverity fails open — unknown input (typos such as "critcal", empty strings, arbitrary text) silently maps to SeverityInfo, so a malformed value is indistinguishable from a legitimate "info". Callers handling untrusted input should use ParseSeverityStrict, which reports unknown values as errors instead.

func ParseSeverityStrict added in v0.1.13

func ParseSeverityStrict(s string) (Severity, error)

ParseSeverityStrict converts a string to a Severity, reporting unknown values as errors instead of failing open to SeverityInfo. Matching is case-insensitive and ignores surrounding whitespace, exactly like ParseSeverity; the two accept the same set of valid names.

func (Severity) AtLeast

func (s Severity) AtLeast(threshold Severity) bool

AtLeast returns true if s >= threshold.

func (Severity) String

func (s Severity) String() string

type TokenSeverity

type TokenSeverity string

TokenSeverity defines rule severity for compression error patterns.

const (
	TokenSeverityCritical TokenSeverity = "critical"
	TokenSeverityHigh     TokenSeverity = "high"
	TokenSeverityMedium   TokenSeverity = "medium"
	TokenSeverityLow      TokenSeverity = "low"
)

Jump to

Keyboard shortcuts

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