model

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeACLDenied     = -32001
	ErrCodeRateLimited   = -32002
	ErrCodeQueueFull     = -32003
	ErrCodeApprovalDeny  = -32004
	ErrCodeParseError    = -32700 // JSON parse error per JSON-RPC 2.0 spec
	ErrCodeInvalidParams = -32602 // Invalid method parameters
	ErrCodeInternal      = -32603
)

Predefined JSON-RPC error codes for Aegis.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditEntry

type AuditEntry struct {
	RequestID       string
	AgentID         string
	BackendID       string
	ToolName        string
	Arguments       string
	ACLResult       string
	RateLimitResult string
	ApprovalResult  string
	QueuePosition   int
	QueueWaitMs     int64
	ExecStatus      string // success|error|denied|rate_limited|rejected
	ExecDurationMs  int64
	ErrorMessage    string
}

AuditEntry records the outcome of a pipeline execution.

type Notification

type Notification struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

Notification is a JSON-RPC 2.0 notification (no id).

type PipelineRequest

type PipelineRequest struct {
	RequestID string
	AgentID   string
	BackendID string
	ToolName  string
	Arguments string // raw JSON string
	SessionID string // MCP session ID for backend
	RPC       *Request
	CreatedAt time.Time
}

PipelineRequest carries all context through the pipeline stages.

type RPCError

type RPCError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

RPCError represents a JSON-RPC 2.0 error object.

type Request

type Request struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id"` // can be number, string, or null; must always be present
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

Request represents a JSON-RPC 2.0 request.

func (*Request) IsNotification

func (r *Request) IsNotification() bool

IsNotification returns true if the request has no ID (is a notification).

type Response

type Response struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *RPCError       `json:"error,omitempty"`
}

Response represents a JSON-RPC 2.0 response.

func NewErrorResponse

func NewErrorResponse(id json.RawMessage, code int, message string) *Response

NewErrorResponse creates a JSON-RPC error response.

type StageResult

type StageResult struct {
	Verdict      Verdict
	ErrorCode    int
	ErrorMessage string
}

StageResult carries the verdict and optional message from a pipeline stage.

type ToolInfo

type ToolInfo struct {
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	InputSchema json.RawMessage `json:"inputSchema,omitempty"`
}

ToolInfo represents a single tool in the tools/list response.

type ToolsCallParams

type ToolsCallParams struct {
	Name      string          `json:"name"`
	Arguments json.RawMessage `json:"arguments,omitempty"`
}

ToolsCallParams represents the params for a tools/call request.

type ToolsListResult

type ToolsListResult struct {
	Tools []ToolInfo `json:"tools"`
}

ToolsListResult represents the result of tools/list.

type Verdict

type Verdict int

Verdict represents the outcome of a pipeline stage.

const (
	VerdictAllow   Verdict = iota // proceed to next stage
	VerdictDeny                   // reject the request
	VerdictPending                // waiting for async action (approval)
)

Jump to

Keyboard shortcuts

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