types

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DIDPrefix = "did:lango:"

DIDPrefix is the method-specific prefix for Lango v1 DIDs.

View Source
const DIDv2Prefix = "did:lango:v2:"

DIDv2Prefix is the method-specific prefix for Lango v2 DIDs (content-addressed).

Variables

This section is empty.

Functions

func DetachContext

func DetachContext(ctx context.Context) context.Context

DetachContext returns a new context that is independent of the parent's cancellation and deadline but preserves all context values. Use this when spawning long-running goroutines that must not be cancelled when the originating request completes.

func EstimateTokens

func EstimateTokens(text string) int

EstimateTokens returns a character-based token count approximation. ASCII/Latin characters are counted as 1 token per 4 characters. CJK characters (Chinese, Japanese, Korean) are counted as 1 token per 2 characters.

func IsCJK

func IsCJK(r rune) bool

IsCJK returns true if the rune falls within CJK Unicode ranges.

Types

type ChannelType

type ChannelType string

ChannelType represents a messaging platform channel type.

const (
	ChannelTelegram ChannelType = "telegram"
	ChannelDiscord  ChannelType = "discord"
	ChannelSlack    ChannelType = "slack"
)

func (ChannelType) Valid

func (c ChannelType) Valid() bool

Valid reports whether c is a known channel type.

func (ChannelType) Values

func (c ChannelType) Values() []ChannelType

Values returns all known channel types.

type Confidence

type Confidence string

Confidence represents a confidence level for analysis results.

const (
	ConfidenceHigh   Confidence = "high"
	ConfidenceMedium Confidence = "medium"
	ConfidenceLow    Confidence = "low"
)

func (Confidence) Valid

func (c Confidence) Valid() bool

Valid reports whether c is a known confidence level.

func (Confidence) Values

func (c Confidence) Values() []Confidence

Values returns all known confidence levels.

type ContentCallback

type ContentCallback func(id, collection, content string, metadata map[string]string)

ContentCallback is an optional hook called when content is saved, enabling asynchronous processing without importing external packages.

type EmbedCallback

type EmbedCallback func(id, collection, content string, metadata map[string]string)

EmbedCallback is an optional hook called when content is saved, enabling asynchronous embedding without importing the embedding package.

type Enum

type Enum[T any] interface {
	Valid() bool
	Values() []T
}

Enum defines a common interface for typed enum values. Each enum type should implement Valid() and Values() as value receiver methods.

type FeatureStatus added in v0.7.0

type FeatureStatus struct {
	// Name is the human-readable feature name (e.g., "Embedding & RAG").
	Name string `json:"name"`
	// Enabled indicates whether the feature is active.
	Enabled bool `json:"enabled"`
	// Healthy indicates whether the feature initialized without errors.
	Healthy bool `json:"healthy"`
	// AutoEnabled indicates the feature was auto-enabled (not explicitly configured).
	AutoEnabled bool `json:"autoEnabled,omitempty"`
	// Reason explains why the feature is disabled or unhealthy (empty when OK).
	Reason string `json:"reason,omitempty"`
	// Suggestion provides an actionable next step for the user (empty when OK).
	Suggestion string `json:"suggestion,omitempty"`
}

FeatureStatus describes the initialization state of a subsystem feature. Used by doctor checks, status command, and TUI for structured diagnostics.

type MessageRole

type MessageRole string

MessageRole represents the role of a message participant.

const (
	RoleUser      MessageRole = "user"
	RoleAssistant MessageRole = "assistant"
	RoleTool      MessageRole = "tool"
	RoleFunction  MessageRole = "function"
	RoleModel     MessageRole = "model"
)

func (MessageRole) Normalize

func (r MessageRole) Normalize() MessageRole

Normalize converts legacy role names to their canonical forms. "model" becomes "assistant", "function" becomes "tool". All other roles are returned as-is.

func (MessageRole) Valid

func (r MessageRole) Valid() bool

Valid reports whether r is a known message role.

func (MessageRole) Values

func (r MessageRole) Values() []MessageRole

Values returns all known message roles.

type ProviderType

type ProviderType string

ProviderType represents an LLM provider type.

const (
	ProviderOpenAI    ProviderType = "openai"
	ProviderAnthropic ProviderType = "anthropic"
	ProviderGemini    ProviderType = "gemini"
	ProviderGoogle    ProviderType = "google"
	ProviderOllama    ProviderType = "ollama"
	ProviderGitHub    ProviderType = "github"
)

func (ProviderType) Valid

func (p ProviderType) Valid() bool

Valid reports whether p is a known provider type.

func (ProviderType) Values

func (p ProviderType) Values() []ProviderType

Values returns all known provider types.

type RPCSenderFunc

type RPCSenderFunc func(event string, payload interface{}) error

RPCSenderFunc defines how to send an RPC request to a remote provider.

type ReputationQuerier added in v0.7.0

type ReputationQuerier func(ctx context.Context, peerDID string) (float64, error)

ReputationQuerier queries peer trust scores. The score is in [0, 1].

type Triple

type Triple struct {
	Subject   string
	Predicate string
	Object    string
	Metadata  map[string]string
}

Triple mirrors graph.Triple to avoid import cycles.

type TripleCallback

type TripleCallback func(triples []Triple)

TripleCallback is an optional hook for saving graph triples.

Jump to

Keyboard shortcuts

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