Documentation
¶
Overview ¶
backends.go contains helpers for LLM backend and provider config KV storage.
chat_cmd.go implements contenox-runtime chat (session-backed chain execution).
cli.go holds the contenox-runtime CLI entrypoint (Main), default constants, flags, and merge logic.
hook_cmd.go — contenox-runtime hook subcommand tree (add, list, show, remove, update). Each subcommand opens only the DB; no LLM stack is needed.
init.go implements the contenox init subcommand (scaffold .contenox/).
output.go holds CLI output helpers.
session.go — session-related constants and helpers for the contenoxcli package.
session_cmd.go — contenox-runtime session subcommand tree (new, list, switch, delete, show). Each subcommand opens only the DB via sessionservice; no LLM stack is needed.
Index ¶
- Variables
- func BuildHandler(ctx context.Context) (http.Handler, func(), error)
- func CLIVersion() string
- func Main()
- func NewCLIAskApproval(w io.Writer) localhooks.AskApproval
- func OpenDBAt(ctx context.Context, dbPath string) (libdb.DBManager, error)
- func PreflightLLMSetup(w io.Writer, res setupcheck.Result) error
- func PrintBackendChecks(w io.Writer, res setupcheck.Result)
- func PrintSetupIssues(w io.Writer, res setupcheck.Result)
- func ResolveContenoxDir(cmd *cobra.Command) (string, error)
- func RunInit(out, errOut io.Writer, force bool, provider string, contenoxDir string) error
- func WithTransaction(ctx context.Context, db libdb.DBManager, fn func(tx libdb.Exec) error) error
- type Engine
Constants ¶
This section is empty.
Variables ¶
var ErrPreflightBlocked = errors.New("LLM setup is not ready")
ErrPreflightBlocked is returned when LLM setup is not ready; instructions are already printed to w.
var HITLPolicyPresets = []struct { Name string Content string }{ {"hitl-policy-default.json", hitlPolicyDefault}, {"hitl-policy-strict.json", hitlPolicyStrict}, {"hitl-policy-dev.json", hitlPolicyDev}, }
HITLPolicyPresets lists the names and content of all embedded HITL policy presets in the order they should be written to disk.
var Version string
Version is an optional link-time override via -ldflags "-X github.com/contenox/contenox/runtime/contenoxcli.Version=…" (e.g. distro packagers). When empty, CLIVersion uses apiframework/version.txt embedded in package apiframework.
Functions ¶
func BuildHandler ¶
BuildHandler initialises all services from the local .contenox directory and returns the combined HTTP handler (API + Beam SPA). Used by the Wails desktop entry point so it can pass the handler directly to Wails' AssetServer.
func CLIVersion ¶
func CLIVersion() string
CLIVersion returns the effective CLI version string (embedded file or link override).
func Main ¶
func Main()
Main runs the contenox-runtime CLI: init subcommand or run (default) with optional positional input.
func NewCLIAskApproval ¶
func NewCLIAskApproval(w io.Writer) localhooks.AskApproval
NewCLIAskApproval returns an AskApproval callback suitable for interactive CLI use. It opens /dev/tty directly so it works even when stdin is piped (e.g. --auto runs or shell-piped input). Falls back to os.Stdin if /dev/tty is unavailable.
The callback prints the tool name, args, and diff (if any) to w (stderr), prompts "Approve? y/N:", and blocks until the user responds or ctx is cancelled. Only "y" or "yes" (case-insensitive) approves; everything else (including blank input and EOF) denies.
func OpenDBAt ¶
OpenDBAt opens (and creates if needed) the SQLite database at the given path. It applies the application schema and the KV store schema so the kv_store table is always present for provider model-list caching.
func PreflightLLMSetup ¶
func PreflightLLMSetup(w io.Writer, res setupcheck.Result) error
PreflightLLMSetup checks setup status before running chat, run, or plan. If the user must fix configuration first, it prints instructions and returns ErrPreflightBlocked. Otherwise it returns nil.
func PrintBackendChecks ¶
func PrintBackendChecks(w io.Writer, res setupcheck.Result)
PrintBackendChecks prints one line per registered backend plus any runtime error hint.
func PrintSetupIssues ¶
func PrintSetupIssues(w io.Writer, res setupcheck.Result)
PrintSetupIssues prints actionable setup issues after model resolution failures. Includes error and warning severities, ordered for readability.
func ResolveContenoxDir ¶
ResolveContenoxDir finds the closest .contenox directory by walking up from the current working directory. If cmd is non-nil and --data-dir is set, that value is returned directly. Otherwise it walks up from cwd; if it hits the root without finding one, it returns the .contenox directory in the current working directory as a fallback.
Types ¶
type Engine ¶
type Engine struct {
TaskService execservice.TasksEnvService
Tracker libtracker.ActivityTracker
Stop func()
Bus libbus.Messenger
MCPManager *mcpworker.Manager
// LocalHooks lists the names of all registered local hook handlers.
LocalHooks []string
// SetupCheck is the last SetupStatus evaluation after RunBackendCycle (for resolver-failure hints).
SetupCheck setupcheck.Result
}
func BuildEngine ¶
BuildEngine scaffolds the complex dependency graph needed to run task chains.
func (*Engine) WatchTaskEvents ¶
func (e *Engine) WatchTaskEvents(ctx context.Context, requestID string, ch chan<- taskengine.TaskEvent) (libbus.Subscription, error)
WatchTaskEvents subscribes to request-scoped taskengine events and decodes them into structured TaskEvent values for CLI consumers.
Source Files
¶
- backend_cmd.go
- backends.go
- beam_cmd.go
- chat_cmd.go
- cli.go
- config_cmd.go
- db_util.go
- doctor_cmd.go
- engine.go
- hitl_policies.go
- hitl_tty.go
- hook_cmd.go
- init.go
- mcp_cmd.go
- model_cmd.go
- model_pull_cmd.go
- model_registry_cmd.go
- output.go
- plan.go
- plan_cmd.go
- plan_init.go
- run_cmd.go
- session.go
- session_cmd.go
- setup_issues.go
- stdin.go
- task_events.go