di

package
v0.0.0-...-820128f Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package di wires the application runtime dependency graph.

Index

Constants

View Source
const ConfigOverridesKey = "config.overrides"

ConfigOverridesKey stores process-level config overrides in the injector.

View Source
const ConfigPathKey = "config.path"

ConfigPathKey stores the optional config file path in the injector.

Variables

This section is empty.

Functions

func RegisterServices

func RegisterServices(injector do.Injector)

RegisterServices registers all application services in the injector.

Types

type AgentTaskService

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

AgentTaskService owns durable background agent execution.

func NewAgentTaskService

func NewAgentTaskService(injector do.Injector) (*AgentTaskService, error)

NewAgentTaskService wires the assistant runtime into the durable task scheduler.

func (*AgentTaskService) Shutdown

func (service *AgentTaskService) Shutdown(ctx context.Context) error

Shutdown stops workers before the database service is closed.

func (*AgentTaskService) Start

func (service *AgentTaskService) Start(ctx context.Context) error

Start constructs the durable task scheduler without starting workers.

func (*AgentTaskService) StartWorkers

func (service *AgentTaskService) StartWorkers(ctx context.Context) error

StartWorkers starts scheduler workers after runtime capabilities are published.

func (*AgentTaskService) Tasks

func (service *AgentTaskService) Tasks() *agenttask.Service

Tasks returns the constructed durable task scheduler, if startup reached that stage.

type AssistantService

type AssistantService struct {
	Runtime *assistant.Runtime
	Agents  *agent.Catalog
	// contains filtered or unexported fields
}

AssistantService exposes the assistant runtime.

func NewAssistantService

func NewAssistantService(injector do.Injector) (*AssistantService, error)

NewAssistantService wires the assistant runtime.

type AuthService

type AuthService struct {
	Storage *auth.Storage
}

AuthService owns provider credential storage.

func NewAuthService

func NewAuthService(injector do.Injector) (*AuthService, error)

NewAuthService wires librecode-style auth.json credential storage.

type CacheService

type CacheService struct {
	Responses *assistant.ResponseCache
}

CacheService owns process-local response caches.

func NewCacheService

func NewCacheService(injector do.Injector) (*CacheService, error)

NewCacheService creates response caches from config.

func (*CacheService) Shutdown

func (service *CacheService) Shutdown()

Shutdown stops cache janitors.

type ChatWorkflowService

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

ChatWorkflowService owns the in-process workflow dispatcher used by interactive chat.

func NewChatWorkflowService

func NewChatWorkflowService(injector do.Injector) (*ChatWorkflowService, error)

NewChatWorkflowService enables model-authored workflows for interactive chat.

func (*ChatWorkflowService) Dispatcher

func (service *ChatWorkflowService) Dispatcher() *workflow.Dispatcher

Dispatcher returns the constructed workflow dispatcher, if startup reached that stage.

func (*ChatWorkflowService) Runs

func (service *ChatWorkflowService) Runs() *workflow.Service

Runs returns the durable workflow service, if startup reached that stage.

func (*ChatWorkflowService) Shutdown

func (service *ChatWorkflowService) Shutdown(ctx context.Context) error

Shutdown stops workflow workers before their dependencies are closed.

func (*ChatWorkflowService) Start

func (service *ChatWorkflowService) Start(ctx context.Context) error

Start constructs the in-process workflow dispatcher without starting workers.

func (*ChatWorkflowService) StartWorkers

func (service *ChatWorkflowService) StartWorkers(ctx context.Context) error

StartWorkers starts workflow workers after runtime capabilities are published.

type ConfigOverrides

type ConfigOverrides struct {
	DisableExtensions bool
	Interactive       bool
}

ConfigOverrides contains CLI/runtime overrides applied after config loading.

type ConfigService

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

ConfigService provides access to the resolved application configuration.

func NewConfigService

func NewConfigService(injector do.Injector) (*ConfigService, error)

NewConfigService loads configuration from the injector's configured path.

func (*ConfigService) Get

func (s *ConfigService) Get() *config.Config

Get returns the resolved application configuration.

func (*ConfigService) Interactive

func (s *ConfigService) Interactive() bool

Interactive reports whether the process is running the terminal UI.

func (*ConfigService) Path

func (s *ConfigService) Path() string

Path returns the config file path used to load configuration, if any.

type Container

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

Container wraps the root injector used by the CLI runtime.

func NewContainer

func NewContainer(ctx context.Context, configPath string, overrides ConfigOverrides) (*Container, error)

NewContainer builds the root injector for the CLI runtime.

func (*Container) AgentTaskService

func (c *Container) AgentTaskService() (*AgentTaskService, error)

AgentTaskService resolves the inert durable background agent service.

func (*Container) AssistantService

func (c *Container) AssistantService() (*AssistantService, error)

AssistantService resolves the assistant runtime without starting workers.

func (*Container) AuthService

func (c *Container) AuthService() (*AuthService, error)

AuthService resolves the auth service.

func (*Container) ChatWorkflowService

func (c *Container) ChatWorkflowService() (*ChatWorkflowService, error)

ChatWorkflowService resolves the inert interactive workflow dispatcher.

func (*Container) ConfigService

func (c *Container) ConfigService() (*ConfigService, error)

ConfigService resolves the configuration service.

func (*Container) DatabaseService

func (c *Container) DatabaseService() (*DatabaseService, error)

DatabaseService resolves the database service.

func (*Container) ExtensionService

func (c *Container) ExtensionService() (*ExtensionService, error)

ExtensionService resolves the extension service.

func (*Container) ModelService

func (c *Container) ModelService() (*ModelService, error)

ModelService resolves the model service.

func (*Container) ShutdownWithContext

func (c *Container) ShutdownWithContext(ctx context.Context) *do.ShutdownReport

ShutdownWithContext stops all registered services using the given context.

func (*Container) SkillsService

func (c *Container) SkillsService() (*SkillsService, error)

SkillsService resolves the skills cache service.

func (*Container) StartRuntime

func (c *Container) StartRuntime() (*RuntimeServices, error)

StartRuntime constructs the complete runtime and starts its durable workers.

func (*Container) ToolService

func (c *Container) ToolService() (*ToolService, error)

ToolService resolves the tool service.

func (*Container) WorkflowService

func (c *Container) WorkflowService() (*WorkflowService, error)

WorkflowService resolves inert script-driven durable agent orchestration.

type DatabaseService

type DatabaseService struct {
	DB         *sql.DB
	Sessions   *database.SessionRepository
	Documents  *database.DocumentRepository
	Tasks      *database.TaskRepository
	AgentTasks *database.AgentTaskRepository
	Workflows  *database.WorkflowRepository
	ToolTasks  *database.ToolTaskRepository
	// contains filtered or unexported fields
}

DatabaseService owns the session database connection and schema lifecycle.

func NewDatabaseService

func NewDatabaseService(injector do.Injector) (*DatabaseService, error)

NewDatabaseService opens the session database and applies embedded migrations.

func (*DatabaseService) HealthCheck

func (service *DatabaseService) HealthCheck(ctx context.Context) error

HealthCheck verifies the database connection is alive.

func (*DatabaseService) Path

func (service *DatabaseService) Path() string

Path returns the resolved session database path.

func (*DatabaseService) Shutdown

func (service *DatabaseService) Shutdown(ctx context.Context) error

Shutdown closes the database connection.

type ExtensionService

type ExtensionService struct {
	Manager *extension.Manager
	State   extension.ManagerState
}

ExtensionService owns the Lua extension manager.

func NewExtensionService

func NewExtensionService(injector do.Injector) (*ExtensionService, error)

NewExtensionService loads configured Lua extensions.

func (*ExtensionService) Shutdown

func (service *ExtensionService) Shutdown()

Shutdown closes loaded Lua runtimes.

type LoggerService

type LoggerService struct {
	SlogLogger    *slog.Logger
	ZerologLogger zerolog.Logger
}

LoggerService exposes structured slog and zerolog loggers.

func NewLoggerService

func NewLoggerService(injector do.Injector) (*LoggerService, error)

NewLoggerService configures application logging from the resolved config.

type ModelService

type ModelService struct {
	Registry *model.Registry
}

ModelService owns the provider/model registry.

func NewModelService

func NewModelService(injector do.Injector) (*ModelService, error)

NewModelService wires librecode-style model registry loading.

type RuntimeServices

type RuntimeServices struct {
	Config        *ConfigService       `do:""`
	Database      *DatabaseService     `do:""`
	Auth          *AuthService         `do:""`
	Models        *ModelService        `do:""`
	Extensions    *ExtensionService    `do:""`
	Assistant     *AssistantService    `do:""`
	AgentTasks    *AgentTaskService    `do:""`
	Workflows     *WorkflowService     `do:""`
	ChatWorkflows *ChatWorkflowService `do:""`
	TaskRuntime   *TaskRuntimeService  `do:""`
}

RuntimeServices is the fully constructed and started application runtime.

type SkillsService

type SkillsService struct {
	Cache *core.SkillsCache
}

SkillsService owns the process-level skills cache.

func NewSkillsService

func NewSkillsService(_ do.Injector) (*SkillsService, error)

NewSkillsService creates a skills cache that eliminates redundant filesystem scans on every prompt.

func (*SkillsService) Shutdown

func (service *SkillsService) Shutdown()

Shutdown stops the cache's background file watcher.

type TaskRuntimeService

type TaskRuntimeService struct {
	Runtime *taskruntime.Service
	Manager *taskruntime.Manager
	Tools   *tooltask.Service
}

TaskRuntimeService owns generic tool-task scheduling and admission.

func NewTaskRuntimeService

func NewTaskRuntimeService(injector do.Injector) (*TaskRuntimeService, error)

NewTaskRuntimeService wires durable tool-task admission and scheduling.

func (*TaskRuntimeService) Shutdown

func (service *TaskRuntimeService) Shutdown(ctx context.Context) error

Shutdown stops and drains managed task workers.

func (*TaskRuntimeService) Start

func (service *TaskRuntimeService) Start(ctx context.Context) error

Start begins managed task polling and execution.

type ToolService

type ToolService struct {
	Registry    *tool.Registry
	Coordinator *tool.Coordinator
}

ToolService exposes librecode-style built-in coding tools for the process working directory.

func NewToolService

func NewToolService(_ do.Injector) (*ToolService, error)

NewToolService wires the built-in tool registry.

type WorkflowService

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

WorkflowService owns script-driven durable agent orchestration.

func NewWorkflowService

func NewWorkflowService(injector do.Injector) (*WorkflowService, error)

NewWorkflowService wires workflow execution to the durable agent scheduler.

func (*WorkflowService) Runner

func (service *WorkflowService) Runner() *workflow.Runner

Runner returns the constructed workflow runner, if startup reached that stage.

func (*WorkflowService) Runs

func (service *WorkflowService) Runs() *workflow.Service

Runs returns the constructed durable workflow service, if startup reached that stage.

func (*WorkflowService) Start

func (service *WorkflowService) Start(ctx context.Context) error

Start constructs workflow orchestration and recovers interrupted runs.

Jump to

Keyboard shortcuts

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