app

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: 139 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatUserError added in v0.5.0

func FormatUserError(err error) string

FormatUserError converts an error into a user-friendly message. If the error is an *adk.AgentError, its structured UserMessage is used. Otherwise, a generic message is returned.

Types

type App

type App struct {
	Config *config.Config

	// Core Components
	Agent   *adk.Agent
	Gateway *gateway.Server
	Store   session.Store

	// Browser (optional, io.Closer)
	Browser io.Closer

	// Security Components (optional)
	Crypto  security.CryptoProvider
	Keys    *security.KeyRegistry
	Secrets *security.SecretsStore

	// Approval Provider (composite, routes to channel-specific providers)
	ApprovalProvider approval.Provider
	GrantStore       *approval.GrantStore
	ApprovalHistory  *approval.HistoryStore

	// Self-Learning Components
	KnowledgeStore *knowledge.Store
	LearningEngine *learning.Engine
	SkillRegistry  *skill.Registry

	// Agent Memory Components (optional, per-agent persistent memory)
	AgentMemoryStore agentmemory.Store

	// Observational Memory Components (optional)
	MemoryStore  *memory.Store
	MemoryBuffer *memory.Buffer

	// Embedding / RAG Components (optional)
	EmbeddingBuffer *embedding.EmbeddingBuffer
	RAGService      *embedding.RAGService

	// Conversation Analysis Components (optional)
	AnalysisBuffer *learning.AnalysisBuffer

	// Proactive Librarian Components (optional)
	LibrarianInquiryStore    *librarian.InquiryStore
	LibrarianProactiveBuffer *librarian.ProactiveBuffer

	// Graph Components (optional)
	GraphStore  graph.Store
	GraphBuffer *graph.GraphBuffer

	// Payment Components (optional)
	WalletProvider  wallet.WalletProvider
	PaymentService  *payment.Service
	X402Interceptor *x402pkg.Interceptor

	// Cron Scheduling Components (optional)
	CronScheduler *cronpkg.Scheduler

	// Background Task Components (optional)
	BackgroundManager *background.Manager

	// Workflow Engine Components (optional)
	WorkflowEngine *workflow.Engine

	// Economy Components (optional, P2P economy layer)
	EconomyBudget      *budget.Engine
	EconomyRisk        *risk.Engine
	EconomyPricing     *pricing.Engine
	EconomyNegotiation *negotiation.Engine
	EconomyEscrow      *escrow.Engine

	// Smart Account Components (optional, ERC-7579 modular accounts)
	SmartAccountManager    sa.AccountManager
	SmartAccountComponents *smartAccountComponents // full components for CLI access

	// Output Store (compressed tool output retrieval)
	OutputStore *tooloutput.OutputStore

	// Gatekeeper (response sanitizer)
	Sanitizer *gatekeeper.Sanitizer

	// Turn Runtime (shared execution + durable traces)
	TurnRunner     *turnrunner.Runner
	TurnTraceStore turntrace.Store

	// RunLedger Components (optional, Task OS durable execution)
	RunLedgerStore runledger.RunLedgerStore
	RunLedgerPEV   *runledger.PEVEngine

	// Provenance Components (optional)
	ProvenanceCheckpoints *provenance.CheckpointService
	ProvenanceSessionTree *provenance.SessionTree
	ProvenanceAttribution *provenance.AttributionService
	ProvenanceBundle      *provenance.BundleService

	// MCP Components (optional, external MCP server integration)
	MCPManager *mcp.ServerManager

	// Observability Components (optional)
	MetricsCollector *observability.MetricsCollector
	HealthRegistry   *health.Registry
	TokenStore       *token.EntTokenStore
	TracerShutdown   func(context.Context) error

	// Tool Catalog (built-in tool discovery + dynamic dispatch)
	ToolCatalog *toolcatalog.Catalog

	// P2P Components (optional)
	P2PNode            *p2p.Node
	P2PAgentPool       *agentpool.Pool
	P2PTeamCoordinator *team.Coordinator
	P2PAgentProvider   agentpool.DynamicAgentProvider

	// Event Bus (app-level, for hooks and cross-component communication)
	EventBus *eventbus.Bus

	// Agent Registry (dynamic agent definitions)
	AgentRegistry *agentregistry.Registry

	// Hook Registry (tool execution hooks)
	HookRegistry *toolchain.HookRegistry

	// FeatureStatuses holds aggregated init diagnostics for context subsystems.
	FeatureStatuses *StatusCollector

	// Channels
	Channels []Channel
	// contains filtered or unexported fields
}

App is the root application structure

func New

func New(boot *bootstrap.Result, opts ...AppOption) (*App, error)

New creates a new application instance from a bootstrap result.

func (*App) Start

func (a *App) Start(ctx context.Context) error

Start starts the application services using the lifecycle registry.

func (*App) Stop

func (a *App) Stop(ctx context.Context) error

Stop stops the application services and waits for all goroutines to exit.

type AppMode added in v0.7.0

type AppMode int

AppMode determines the application operating mode.

const (
	// AppModeServer is the default mode — starts all components including
	// gateway, channels, automation, and network.
	AppModeServer AppMode = iota

	// AppModeLocalChat starts only core components (Infra, Core, Buffer)
	// and skips network/automation/gateway/channel lifecycle. Used for
	// interactive TUI chat.
	AppModeLocalChat

	// AppModeCockpit starts core + buffer components and optionally initializes
	// channels (if configured), but skips the HTTP gateway and automation lifecycle.
	// Channel Start/Stop is managed externally by the caller (e.g., runCockpit).
	AppModeCockpit
)

type AppOption added in v0.7.0

type AppOption func(*appOptions)

AppOption configures optional behavior for App construction.

func WithCockpit added in v0.7.0

func WithCockpit() AppOption

WithCockpit creates an App in cockpit mode. Core components start normally, channels are initialized if configured, but gateway and automation are skipped.

func WithLocalChat added in v0.7.0

func WithLocalChat() AppOption

WithLocalChat creates an App in local-chat mode. Network, automation, gateway, and channel lifecycle components are not started.

type Channel

type Channel interface {
	Name() string
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
}

Channel represents a communication channel (Telegram, Discord, Slack)

type ExtendableDeadline added in v0.5.0

type ExtendableDeadline = deadline.ExtendableDeadline

ExtendableDeadline is an alias for backward compatibility within the app package.

func NewExtendableDeadline added in v0.5.0

func NewExtendableDeadline(parent context.Context, baseTimeout, maxTimeout time.Duration) (context.Context, *ExtendableDeadline)

NewExtendableDeadline creates a new ExtendableDeadline. Deprecated: Use deadline.New directly.

type StatusCollector added in v0.7.0

type StatusCollector struct {
	// contains filtered or unexported fields
}

StatusCollector aggregates FeatureStatus from wiring functions.

func NewStatusCollector added in v0.7.0

func NewStatusCollector() *StatusCollector

NewStatusCollector creates an empty StatusCollector.

func (*StatusCollector) Add added in v0.7.0

func (c *StatusCollector) Add(s *types.FeatureStatus)

Add appends a feature status. Nil pointers are ignored.

func (*StatusCollector) All added in v0.7.0

func (c *StatusCollector) All() []types.FeatureStatus

All returns a copy of all collected statuses.

func (*StatusCollector) SilentDisabledCount added in v0.7.0

func (c *StatusCollector) SilentDisabledCount() int

SilentDisabledCount returns the number of features that are disabled with a non-empty reason — i.e., features the user likely didn't intend to disable but that are off due to missing dependencies.

Jump to

Keyboard shortcuts

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