bootstrap

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WireGoalTools added in v0.2.2

func WireGoalTools(sess *agent.Session, mgr *goal.Manager)

WireGoalTools connects goal tool callbacks and the usage-limit handler to the goal manager. Called at boot and again by the UI after a plugin reload rebuilds the toolset.

Types

type MCPReport added in v0.2.2

type MCPReport struct {
	Tools  int
	Errors []string
}

MCPReport summarizes a ConnectMCP run for frontend display.

type Options

type Options struct {
	Cwd string

	Continue   bool
	Resume     bool
	NonTTYMode bool

	ApprovalMode  string
	ToolFactories []ToolFactory
	ModelFactory  agent.ModelFactory
}

Options controls how runtime bootstraps.

type Runtime

type Runtime struct {
	Cwd       string
	GitBranch string

	ApprovalEngine *approval.Engine
	TaskRuntime    *task.Runtime
	TeamRegistry   *team.Registry
	TeammateEvents *agent.TeammateEventHub

	Settings      config.Resolved
	ModelName     string // display form: "provider/model" or session-restored name
	Session       *agent.Session
	SessionStore  *storage.Store
	PluginCatalog *plugin.Catalog
	SkillCatalog  *skill.Catalog
	MCPManager    *mcpclient.Manager
	MCPServers    map[string]mcpclient.ServerConfig // for async connection in TUI
	HookRunner    *hooks.Runner                     // nil if no hooks configured
	EnvHint       string                            // non-empty when credentials come from environment variable

	// Frontend-neutral session lifecycle, assembled by wireLifecycle.
	// Restored from the session snapshot before any frontend runs.
	PlanStore   *storage.PlanStore
	PlanManager *plan.Manager
	GoalManager *goal.Manager
	CronStore   *cron.Store // nil when the cron tools are absent
	// contains filtered or unexported fields
}

Runtime is the bootstrapped app runtime state.

func Boot

func Boot(opts Options) (*Runtime, error)

Boot creates a ready-to-run runtime.

func (*Runtime) Close

func (r *Runtime) Close()

Close releases runtime resources.

func (*Runtime) ConnectMCP added in v0.2.2

func (r *Runtime) ConnectMCP(ctx context.Context) *MCPReport

ConnectMCP connects all configured MCP servers and warms the tool list. Blocking — async frontends run it in a goroutine. Returns nil when no servers are configured.

It deliberately never touches the session: session prompt state is not goroutine-safe, so MCP tools and instructions enter the session through exactly one writer — the before-prompt refresh hook, which MarkDirty arms and which runs on the prompt path ahead of the turn.

func (*Runtime) StartCron added in v0.2.2

func (r *Runtime) StartCron(onFire func(prompt string)) func()

StartCron starts the session cron scheduler. Fired prompts are delivered through onFire — the frontend decides how they enter the conversation (the TUI injects them as user prompts). Returns a stop function, or nil when no cron store is available. Print mode never starts cron: a one-shot run has no loop to schedule against.

type ToolFactory

type ToolFactory func(cwd string) agentcore.Tool

ToolFactory creates one tool instance for the given workspace.

Jump to

Keyboard shortcuts

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