smah.runner
- class smah.runner.Runner(args, settings)[source]
Bases:
object- MAX_PIPE_LENGTH = 2048
- PIPE_HEAD_LENGTH = 1024
- static copy_to_clipboard(text: str) bool[source]
Best-effort clipboard copy.
Returns False whenever the optional pyperclip dependency is unavailable or the copy fails; callers must treat clipboard as a nice-to-have only.
- Parameters:
text (str) – The text to copy.
- Returns:
True if the text was copied, False otherwise.
- Return type:
bool
- static planner_response(response: Completion) Tuple[bool, dict] | None[source]
- static print_message(message: dict, format: bool = False, strip_cot=True, styles: dict | None = None)[source]
- provider_for(model: Model) Provider[source]
Resolve the configured provider implementation for a model (exits 3 on unknown keys).
- run(model: Model, thread: list, response_format: dict | _Unset = UNSET, tools: dict | _Unset = UNSET, options: dict | None = None, show: bool = False) Completion[source]
- static show_suggested_commands(commands: list[dict]) None[source]
Print suggested commands for the user to review and run themselves.
SMAH never executes commands; this presentation is print-only by design. Each command is rendered in a clearly delimited panel with the model’s title/purpose (its explanation of what the command does and its impact), the command itself in a copy-friendly code block, and an explicit notice that SMAH does not run commands.
- Parameters:
commands (list[dict]) – Commands extracted from the model response (dicts with title/purpose/command/shell keys).
Modules