types

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package types contains stable protocol values shared across the model, memory, security, and engine layers.

Domain-specific configuration and result types belong to their owning packages rather than this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithRunContext

func WithRunContext(parent context.Context, runContext *RunContext) context.Context

Types

type ErrorCode

type ErrorCode string
const (
	ErrModelTimeout        ErrorCode = "MODEL_TIMEOUT"
	ErrToolError           ErrorCode = "TOOL_ERROR"
	ErrInvalidInput        ErrorCode = "INVALID_INPUT"
	ErrInvalidConfig       ErrorCode = "INVALID_CONFIG"
	ErrAPIError            ErrorCode = "API_ERROR"
	ErrRateLimit           ErrorCode = "RATE_LIMIT"
	ErrRunCancelled        ErrorCode = "RUN_CANCELLED"
	ErrSecurityViolation   ErrorCode = "SECURITY_VIOLATION"
	ErrMaxLoopsExceeded    ErrorCode = "MAX_LOOPS_EXCEEDED"
	ErrCircuitOpen         ErrorCode = "CIRCUIT_OPEN"
	ErrEventDelivery       ErrorCode = "EVENT_DELIVERY_FAILED"
	ErrTurnNotFound        ErrorCode = "TURN_NOT_FOUND"
	ErrInteractionNotFound ErrorCode = "INTERACTION_NOT_FOUND"
	ErrRunInterrupted      ErrorCode = "RUN_INTERRUPTED"
	ErrSummaryFailed       ErrorCode = "SUMMARY_FAILED"
)

type HarnessError

type HarnessError struct {
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
	Err     error     `json:"-"`
}

func NewError

func NewError(code ErrorCode, msg string) *HarnessError

func WrapError

func WrapError(code ErrorCode, msg string, err error) *HarnessError

func (*HarnessError) Error

func (e *HarnessError) Error() string

func (*HarnessError) Unwrap

func (e *HarnessError) Unwrap() error

type Message

type Message struct {
	Role           Role              `json:"role"`
	Content        string            `json:"content"`
	Reasoning      string            `json:"reasoning,omitempty"`
	ReasoningState []json.RawMessage `json:"reasoning_state,omitempty"`
	ToolCallID     string            `json:"tool_call_id,omitempty"`
	ToolCalls      []ToolCall        `json:"tool_calls,omitempty"`
	Name           string            `json:"name,omitempty"`
	CreatedAt      time.Time         `json:"created_at"`
}

type Role

type Role string
const (
	RoleSystem    Role = "system"
	RoleUser      Role = "user"
	RoleAssistant Role = "assistant"
	RoleTool      Role = "tool"
)

type RunContext

type RunContext struct {
	RunID       string
	SessionID   string
	UserID      string
	AgentID     string
	TeamID      string
	WorkflowID  string
	ParentRunID string
	Metadata    map[string]any
}

func RunContextFrom added in v0.2.0

func RunContextFrom(ctx context.Context) (*RunContext, bool)

type ToolCall

type ToolCall struct {
	ID       string           `json:"id"`
	Type     string           `json:"type"`
	Function ToolCallFunction `json:"function"`
}

type ToolCallFunction

type ToolCallFunction struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

type Usage

type Usage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	ReasoningTokens  int `json:"reasoning_tokens,omitempty"`
	TotalTokens      int `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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