Documentation
¶
Index ¶
- type App
- func (app *App) EnsurePrimary(ctx context.Context)
- func (app *App) PromoteToPrimary(ctx context.Context, lockFile *os.File) error
- func (a *App) RunNonInteractive(ctx context.Context, prompt string, outputFormat string, quiet bool, ...) error
- func (a *App) RunNonInteractiveGoal(ctx context.Context, objective string, outputFormat string, quiet bool, ...) (NonInteractiveGoalResult, error)
- func (app *App) SetIPCSecondaryContext(client *ipc.Client, roConn *sql.DB, workdir, instanceID string, ...)
- func (app *App) SetupIPC(bus *ipc.Bus)
- func (app *App) Shutdown()
- type AppOptions
- type NonInteractiveGoalResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Sessions session.Service
Messages message.Service
History history.Service
Permissions permission.Service
DBQuerier db.Querier
CoderAgent agent.Service
Projects project.Service
ProjectManager *project.Manager
Snapshots snapshot.Service
LSPClients map[string]*lsp.Client
SkillManager *skills.SkillManager
MesnadaOrchestrator *mesnadaOrch.Orchestrator
CronService *cronjob.Service
MesnadaServer *mesnadaServer.Server
Remembrances *rag.RemembrancesService
ContextEnricher *rag.ContextEnricher
LuaManager *luaengine.FilterManager
MCPGateway *mcpgateway.Gateway
Evaluator *evaluator.EvaluatorService
// IPCBus is set on the primary instance after calling SetupIPC.
// Secondary instances leave this nil.
IPCBus *ipc.Bus
// IPCIsPrimary is true when this instance holds the IPC lock.
IPCIsPrimary bool
// contains filtered or unexported fields
}
func (*App) EnsurePrimary ¶ added in v0.326.0
EnsurePrimary performs an active liveness probe of the primary and, if the primary is unreachable and auto-failover is enabled, triggers the failover sequence. Must be called before processing each user prompt on a secondary instance. Safe to call on the primary instance (no-op).
func (*App) PromoteToPrimary ¶ added in v0.326.0
PromoteToPrimary is the failover.PromoteFunc implementation. It is called by the Watcher when this secondary wins the lock race. lockFile is the open flock file that must be kept open for the duration of this instance's primary role.
The method:
- Closes the old read-only SQLite connection.
- Opens a new read-write connection (with migrations).
- Creates a new IPC Bus and calls ipcBusSetupFunc to wire all handlers.
- Updates the app's Querier, IPCBus, and IPCIsPrimary fields.
- Publishes instance.promoted on the new Bus so other secondaries reconnect.
func (*App) RunNonInteractive ¶
func (a *App) RunNonInteractive(ctx context.Context, prompt string, outputFormat string, quiet bool, yoloMode bool) error
RunNonInteractive handles the execution flow when a prompt is provided via CLI flag.
func (*App) RunNonInteractiveGoal ¶ added in v0.324.0
func (*App) SetIPCSecondaryContext ¶ added in v0.326.0
func (app *App) SetIPCSecondaryContext( client *ipc.Client, roConn *sql.DB, workdir, instanceID string, pubPort, rpcPort int, watcher *failover.Watcher, busSetupFunc func(ctx context.Context, bus *ipc.Bus, rwConn *sql.DB) error, )
SetIPCSecondaryContext stores the secondary IPC state and registers the active-probe function on the watcher so it can perform per-prompt and per-minute liveness checks.
busSetupFunc is called during promotion with the new Bus and RW connection. It must wire the writecoordinator, changepub publisher, and bridge handlers.
func (*App) SetupIPC ¶ added in v0.294.1
Shutdown performs a clean shutdown of the application SetupIPC configures the primary IPC bus for this instance. Call this after New() on the primary instance to enable ZMQ event broadcasting and to register the db.write handler so secondary instances can proxy writes. bus must already be started (bus.Start called) before calling SetupIPC.
type AppOptions ¶ added in v0.100.0
type AppOptions struct {
// SkipLSP disables LSP client initialisation. Set this to true in headless
// modes (e.g. ACP stdio) where the editor manages its own language servers.
SkipLSP bool
// SkipMesnadaServer avoids starting the embedded Mesnada HTTP server while
// still allowing the orchestrator and related tools to be initialized.
SkipMesnadaServer bool
// StartupMode identifies the mode in which Pando is starting so background
// remembrances behaviors can be aligned consistently across entrypoints.
StartupMode string
// DBQuerier overrides the db.Querier used for sessions, messages, and projects.
// When non-nil this querier is used instead of db.New(conn).
// Primary instances leave this nil; secondary instances pass a dbproxy.DBProxy.
DBQuerier db.Querier
}
AppOptions configures optional behaviour for New().
type NonInteractiveGoalResult ¶ added in v0.324.0
type NonInteractiveGoalResult struct {
SessionID string `json:"session_id"`
Objective string `json:"objective"`
Status string `json:"status"`
Iteration int64 `json:"iteration"`
MaxIterations int64 `json:"max_iterations"`
MaxDurationSeconds int64 `json:"max_duration_seconds"`
Response string `json:"response"`
Progress string `json:"progress,omitempty"`
NextStep string `json:"next_step,omitempty"`
BlockedReason string `json:"blocked_reason,omitempty"`
}
NonInteractiveGoalResult is the serialized outcome of a CLI goal-mode run.