cli

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 80 Imported by: 0

Documentation

Overview

Package cli is the mast binary: serve mode, one-shot mode, and the `mast sessions` / `mast stop` subcommands. cmd/mast is a one-line main over Main, so a custom main.go built on this package is the same binary by construction (#301).

mast one-shot mode: `mast --task=<class> [--model=...] [--provider=...] [--session-db=...] "<prompt>"`. A positional prompt switches the binary from serving to running exactly one turn to completion and printing the result on stdout (logs stay on stderr). Serve remains the no-prompt default — scripts/demo-spike2.sh's flag-only invocations are untouched.

mast sessions — the operator-facing session surface (docs/durable-execution-design.md, "Operator-facing surface" + "The v0.2 pause/abort mechanics").

mast sessions list   --session-db=... [--user=...] [--state=paused|aborted|interrupted|idle]
mast sessions show   <session-id> --session-db=...
mast sessions export-decisions [<session-id>] --session-db=... [--workload=...]
                     [--since=RFC3339] [--until=RFC3339] [--include-approver] [--out=FILE]
mast sessions resume <session-id> --interrupt=<iid> --response='{"approved":true}' [--ack-effects] [--addr=...]
mast sessions resume --token=<mrt_...> [--response='<json>'] [--ack-effects] [--addr=... | --session-db=...]
mast sessions pause  <session-id> --reason=<enum> [--message=...] [--resume-at=RFC3339 | --resume-after=15m]
                     [--interrupt] [--ttl=48h] [--addr=...]
mast sessions extend-token <mrt_...> --ttl=<duration> [--addr=...]
mast sessions abort  <session-id> [--reason=...] [--addr=...]
mast sessions ack-effects <session-id> [--reason=...] [--addr=... | --session-db=...]

list/show read the SQLite session DB directly (works with or without a running daemon). resume/pause/extend-token/abort go through a running daemon — resume must be executed by the runner that owns the workflow, hard pause must reach the daemon's cancel registry, and a single-writer store stays single-writer. Exception: `resume --token --session-db=...` clears a GATE pause directly, ONLY on a DB no daemon is serving (an interrupt pause always needs the daemon).

The v0.1 deviation note (resume keyed by interrupt ID, not token) is resolved: both keyings now exist, and tokens are the v0.2 programmatic-pause surface as originally sketched.

mast stop — the planned-stop verb (issue #42; docs/durable-execution- design.md, "Planned stop"). Asks a running daemon to drain and exit: exactly the SIGTERM path, with the interruption markers classified "operator stop" instead of "daemon shutdown".

mast stop [--addr=...] [--reason=...] [--pause-sessions]

Exit-code contract (the daemon's, not this command's): 0 = clean drain, 3 = drain window expired with interrupted survivors, 1 = error. The exit code encodes work-cut-short, not who initiated — Restart=on-failure supervision revives the daemon exactly when boot-time repair has work to do.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(ctx context.Context, args []string) int

Main runs the mast binary over args — the command line without the program name, os.Args[1:] — and returns the process exit status. It does not call os.Exit; the caller does, with what Main returns. The one exception is the teardown watchdog, which kills a process whose shutdown has hung past every deadline, because by then nothing is left to return to.

Cancelling ctx shuts serve mode down the way SIGINT or SIGTERM does: the same drain, the same exit status.

func MainWith

func MainWith(ctx context.Context, args []string, ext Options) int

MainWith is Main with what a custom main.go adds (see Options). The public cli package calls it; cmd/mast calls Main, which is MainWith with nothing added.

Types

type Options

type Options struct {
	// Models is asked for every model name before mast's own providers:
	// --model, and each specialist's `model:` override. Returning false
	// falls through.
	Models func(name string) (model.LLM, bool)

	// Toolsets are offered to Task-mode specialists beside the
	// workload's MCP servers, reached by naming a toolset's Name() in a
	// specialist's tools.mcp allowlist.
	Toolsets []tool.Toolset
}

Options is what a custom main.go adds to the binary, through the public github.com/go-steer/mast/cli package. The zero value is the stock `mast` binary: cmd/mast passes nothing.

Every field is in ADK's own types. The public package keeps its option type opaque and converts to this one, so nothing exported names it.

Jump to

Keyboard shortcuts

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