#!/usr/bin/env raku
# 321 - the harness-agnostic agent runtime.  Arguments are passed through
# untouched: the CLI parses them itself, so MAIN is not used.
use Do321::Wire;
use Do321::Look;
use Do321::CLI;
use Do321::Mission;

# On a terminal, a row of air above and below, and the words dressed;
# into a pipe, the words alone.  Installed before anything is written.
install-air();
END settle-air();

# Mission Control drives this runtime, so it is handed in rather than named
hand-runs-to(&mc-main);

# DO_321_INTERACTIVE=1 is a test seam: it treats stdin as a terminal so the
# suite can exercise the interactive operator path without one.
my $interactive = $*IN.t || so %*ENV<DO_321_INTERACTIVE>;
exit cli-main(Env.new(:stdin(LineSource.new(:handle($*IN))), :stdout($*OUT), :stderr($*ERR), :args(@*ARGS), :$interactive, :signals));
