service

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRunnerSvc

func NewRunnerSvc(config *RunnerConfig) domain.RunnerSvc

func NewSchedulerSvc

func NewSchedulerSvc(config *SchedulerConfig) domain.SchedulerSvc

Types

type AgentDefinitionSvcConfig

type AgentDefinitionSvcConfig struct {
	// Repos (required) is the repository factory for agent persistence.
	Repos domain.RepoFactory

	// MediatorFactory (required) builds the mediators used for access checks.
	MediatorFactory domain.MediatorFactory

	// TxManager (required) wraps multi-step operations in database transactions.
	TxManager TransactionManager

	// PlanGate (optional; default: nil) checks whether an account's plan allows agents. When nil, plan gating is skipped and all accounts are allowed.
	PlanGate PlanGate

	// OutboxNotifier (optional; default: nil) wakes the outbox enqueuer the instant a chat run is enqueued, so the run starts (and its "thinking" indicator appears) without waiting out the enqueuer's idle poll backoff. When nil, the run is still picked up on the next poll.
	OutboxNotifier messaging.OutboxNotifier
}

func (*AgentDefinitionSvcConfig) WithDefaults

type PlanGate

type PlanGate interface {
	CanUseAgents(ctx context.Context, accountID string) (bool, error)
}

type RunnerConfig

type RunnerConfig struct {
	// Repos (required) is the repository factory for agent persistence.
	Repos domain.RepoFactory

	// ToolRegistry (required) resolves the tool handlers available to agent runs.
	ToolRegistry *agents.ToolHandlerRegistry

	// LLMProviders (required) maps provider names to LLM provider implementations.
	LLMProviders map[string]llm.LLMProvider

	// OutboxRepo (required) is the outbox repository used to enqueue messages.
	OutboxRepo messaging.OutboxRepo

	// CoreClient (required) is the core-service client used to resolve account context and role permissions.
	CoreClient domain.CoreClient

	// GatewayClient (optional; default: nil) invokes api-gateway endpoints for generated endpoint-tools. When nil, those tools return an error if called.
	GatewayClient domain.GatewayClient

	// NotificationClient (optional; default: nil) invokes notification-service RPCs for the draft_reply / send_email tools. When nil, those tools return an error if called.
	NotificationClient domain.NotificationClient

	// Broker (optional; default: nil) is the message broker used to stream run step events. When nil, step events are not published.
	Broker messaging.MessageBroker

	// BillingClient (required) resolves billing customers for spend tracking.
	BillingClient domain.BillingCustomerResolver

	// OutboxNotifier (optional; default: nil) wakes the outbox enqueuer the instant the runner commits a latency-sensitive durable row (the streaming reply bubble, its finalize, run completion), so those post without waiting out the enqueuer's idle poll backoff. When nil, they are still picked up on the next poll.
	OutboxNotifier messaging.OutboxNotifier
}

func (*RunnerConfig) WithDefaults

func (c *RunnerConfig) WithDefaults() *RunnerConfig

type SchedulerConfig

type SchedulerConfig struct {
	// Repos (required) is the repository factory for agent persistence.
	Repos domain.RepoFactory

	// OutboxRepo (required) is the outbox repository used to enqueue run commands.
	OutboxRepo messaging.OutboxRepo

	// PollInterval (optional; default: 60s) controls how frequently the scheduler polls for due agent schedules.
	PollInterval time.Duration

	// PlanGate (optional; default: nil) checks whether an account's plan allows agents. When nil, plan gating is skipped and all accounts are allowed.
	PlanGate PlanGate

	// Lease (required) is the distributed lease ensuring only one pod schedules runs per tick.
	Lease *lease.Lease
}

func (*SchedulerConfig) WithDefaults

func (c *SchedulerConfig) WithDefaults() *SchedulerConfig

WithDefaults fills zero-value fields with production defaults and returns the config.

type TransactionManager

type TransactionManager interface {
	WithTx(ctx context.Context, fn func(ctx context.Context, f domain.RepoFactory) *apierror.APIError) *apierror.APIError
}

func NewTransactionManager

func NewTransactionManager(pool *pgxpool.Pool, queries *sqlc.Queries) TransactionManager

Jump to

Keyboard shortcuts

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