feat(cli/tui): -q now seeds a live interactive session; prompts submit literally

On a real TTY, `hermes chat -q "…"` (and `--tui -q`) now starts a normal
interactive session with the prompt submitted literally as the first turn —
no slash-command routing, no '!' shell dispatch, no $(...) interpolation,
no file-drop rewriting — matching how other coding agents handle seeded
launches (Omarchy prompted agent terminals, basecamp/omarchy#8705).

Legacy answer-and-exit is preserved everywhere automation depends on it:
- new `hermes chat --oneshot` flag (distinct dest from top-level -z)
- -Q/--quiet machine-readable contract
- any non-TTY stdio (kanban workers, cron, pipes, A2A)
- top-level `hermes -z` unchanged

CLI: seeded prompt rides a _SeededQueryMessage sentinel through
process_loop, which skips the slash/!/file-drop dispatchers for that one
message. TUI: STARTUP_QUERY submits via a new literal path (submitLiteral)
that bypasses dispatchSubmission and the input.detect_drop rewrite.
This commit is contained in:
Teknium
2026-08-28 04:59:06 -07:00
parent ad4adbbfeb
commit a5c7eed5f3
11 changed files with 347 additions and 19 deletions
+21 -1
View File
@@ -351,7 +351,12 @@ def build_top_level_parser():
)
_query_group = chat_parser.add_mutually_exclusive_group()
_query_group.add_argument(
"-q", "--query", help="Single query (non-interactive mode)"
"-q", "--query",
help=(
"Query to run. On a real TTY the prompt seeds an interactive "
"session (submitted literally as the first turn); combined with "
"--oneshot or -Q, or on a non-TTY, it answers and exits."
),
)
_query_group.add_argument(
"--query-file",
@@ -363,6 +368,21 @@ def build_top_level_parser():
"verbatim. Mutually exclusive with -q."
),
)
chat_parser.add_argument(
"--oneshot",
dest="oneshot_exit",
action="store_true",
# Distinct dest: the top-level `-z/--oneshot PROMPT` is value-taking
# and its dispatch sites do `if args.oneshot: _run_and_exit_oneshot(
# args.oneshot)` — a shared boolean dest would be passed as the
# prompt. `oneshot_exit` keeps the surfaces independent.
default=False,
help=(
"With -q/--query-file: answer the query and exit (legacy "
"single-query behavior) instead of seeding an interactive "
"session. Implied on non-TTY stdio and by -Q/--quiet."
),
)
chat_parser.add_argument(
"--image", help="Optional local image path to attach to a single query"
)