Documentation
¶
Overview ¶
backends.go contains helpers for LLM backend and provider config KV storage.
cache_cmd.go implements `contenox cache` — managing data Contenox caches between runs (currently the per-backend model-list cache).
chat_cmd.go implements contenox-runtime chat (session-backed chain execution).
cli.go holds the contenox CLI entrypoint (Main), default constants, flags, and merge logic.
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 session subcommand tree (new, list, switch, delete, show). Each subcommand opens only the DB via sessionservice; no LLM stack is needed.
tools_cmd.go — contenox tools subcommand tree (add, list, show, remove, update). Each subcommand opens only the DB; no LLM stack is needed.
Index ¶
- Constants
- Variables
- func AgentsMDMessage(content, path string) taskengine.Message
- func CLIVersion() string
- func ComputeReadiness(ctx context.Context, db libdbexec.DBManager, opts chatOpts) (setupcheck.Result, error)
- func LoadAgentsMD(startDir string) (string, string, bool)
- func Main()
- func NewCLIAskApproval(w io.Writer) localtools.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 ResolveWorkspaceID(contenoxDir string) string
- func RunGlobalInit(out io.Writer) error
- func RunInit(out, errOut io.Writer, force, update bool, provider string, contenoxDir string) error
- func WithTransaction(ctx context.Context, db libdb.DBManager, fn func(tx libdb.Exec) error) error
- type Engine
Constants ¶
const DefaultWorkspaceID = "00000000-0000-0000-0000-000000000002"
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}, {"hitl-policy-acp.json", hitlPolicyACP}, {"hitl-policy-acpx.json", hitlPolicyACPX}, }
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/runtime/runtime/contenoxcli.Version=…" (e.g. distro packagers). When empty, CLIVersion uses runtime/version/version.txt.
Functions ¶
func AgentsMDMessage ¶
func AgentsMDMessage(content, path string) taskengine.Message
func CLIVersion ¶
func CLIVersion() string
CLIVersion returns the effective CLI version string (embedded file or link override).
func ComputeReadiness ¶
func ComputeReadiness(ctx context.Context, db libdbexec.DBManager, opts chatOpts) (setupcheck.Result, error)
ComputeReadiness builds the engine — which runs a read-only backend sync, NOT a model completion — and returns the evaluated setup readiness. It is the shared path behind `contenox doctor` and the setup wizard's final check, so readiness is verified without ever sending a prompt (which would run a chain, spend tokens, and could touch tools/audit trails). opts.EffectiveNoDeleteModels is honored by BuildEngine, so a readiness check never prunes models.
func Main ¶
func Main()
Main runs the contenox CLI: init subcommand or run (default) with optional positional input.
func NewCLIAskApproval ¶
func NewCLIAskApproval(w io.Writer) localtools.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 or run. 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.
func ResolveWorkspaceID ¶
func RunGlobalInit ¶
RunGlobalInit ensures ~/.contenox/ has chain files, HITL policies, and a local backend. Unlike RunInit it does NOT create a workspace-scoped .contenox/ directory.
Types ¶
Source Files
¶
- acp_cmd.go
- agentsmd.go
- backend_cmd.go
- backends.go
- cache_cmd.go
- chain_load.go
- chat_cmd.go
- cli.go
- config_cmd.go
- db_util.go
- doctor_cmd.go
- editor.go
- engine.go
- hitl_policies.go
- hitl_tty.go
- init.go
- mcp_cmd.go
- model_capability_cmd.go
- model_cmd.go
- model_pull_cmd.go
- model_registry_cmd.go
- output.go
- run_cmd.go
- session.go
- session_cmd.go
- session_fork_cmd.go
- session_inspect_cmd.go
- setup_cmd.go
- setup_issues.go
- state_cmd.go
- stdin.go
- tools_cmd.go
- trace_render.go