Use Hermes native prompted sessions
Hermes now keeps chat queries interactive and literal to TUI control syntax, so launch it directly and let its own session flow replace the local one-shot, usage-file, and resume bridge. Gate installation on the capability added with native interactive queries, preserve unowned mise environments, and keep the unprompted launch path unchanged. Co-Authored-By: Codex XHigh <noreply@openai.com>
This commit is contained in:
co-authored by
Codex XHigh
parent
64203cc208
commit
5284be6582
+1
-1
@@ -88,7 +88,7 @@ codex)
|
||||
;;
|
||||
hermes)
|
||||
if [[ -n ${prompt:-} ]]; then
|
||||
command=(omarchy-agent-hermes "$prompt")
|
||||
command=(env -u HERMES_SESSION_SOURCE hermes chat --yolo --tui "--query=$prompt")
|
||||
else
|
||||
command=(hermes --yolo)
|
||||
fi
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Seed Hermes literally and resume the resulting interactive session
|
||||
# omarchy:args=<prompt>
|
||||
# omarchy:hidden=true
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
prompt=${1:?usage: omarchy-agent-hermes <prompt>}
|
||||
unset HERMES_SESSION_SOURCE
|
||||
usage=$(mktemp)
|
||||
trap 'rm -f "$usage"' EXIT
|
||||
|
||||
# TUI startup queries pass through Hermes' slash, shell, and interpolation
|
||||
# dispatcher. One-shot treats the prompt literally and records its session ID.
|
||||
seed_session() {
|
||||
hermes --yolo --usage-file "$usage" --oneshot="$prompt"
|
||||
}
|
||||
|
||||
if ! seed_session; then
|
||||
if jq -e '.failed == true and (.failure | strings | startswith("No inference provider configured."))' "$usage" >/dev/null 2>&1; then
|
||||
hermes setup
|
||||
seed_session
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
session_id=$(jq -er 'select(.completed == true and .failed != true) | .session_id | strings | select(length > 0)' "$usage")
|
||||
|
||||
rm -f "$usage"
|
||||
trap - EXIT
|
||||
|
||||
exec hermes chat --yolo --tui --resume "$session_id"
|
||||
@@ -88,13 +88,13 @@ hermes_runs() {
|
||||
timeout 15 "$HOME/.local/bin/hermes" --version >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Prompted Omarchy sessions need Hermes' usage report to identify and validate
|
||||
# the exact one-shot session before reopening it interactively.
|
||||
# The chat subcommand's --oneshot opt-out arrived with native interactive -q,
|
||||
# so its presence is a stable capability check without relying on a version.
|
||||
hermes_prompt_ready() {
|
||||
local help
|
||||
hermes_runs &&
|
||||
help=$(timeout 15 "$HOME/.local/bin/hermes" --help 2>/dev/null) &&
|
||||
grep -qF -- '--usage-file' <<<"$help"
|
||||
help=$(timeout 15 "$HOME/.local/bin/hermes" chat --help 2>/dev/null) &&
|
||||
grep -qF -- '--oneshot' <<<"$help"
|
||||
}
|
||||
|
||||
# --owns answers whether the wrapper on PATH is the one this command wrote, so
|
||||
@@ -154,8 +154,8 @@ if foreign_hermes; then
|
||||
fi
|
||||
|
||||
if hermes_runs; then
|
||||
echo "~/.local/bin/hermes does not support the session report Omarchy needs for prompted launches." >&2
|
||||
echo "Update it to Hermes Agent 0.18.1 or newer, then run omarchy-install-hermes-cli again." >&2
|
||||
echo "~/.local/bin/hermes does not support the interactive seeded sessions Omarchy needs." >&2
|
||||
echo "Update it to a Hermes Agent release with interactive chat queries, then run omarchy-install-hermes-cli again." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -164,12 +164,17 @@ if foreign_hermes; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# An older mise environment may predate the session report. It belongs to this
|
||||
# installer, so discard only that environment and let the current stub rebuild it.
|
||||
# Only the marked wrapper proves the matching mise environment is ours to replace.
|
||||
if installed && ! hermes_prompt_ready; then
|
||||
echo "Updating Hermes for prompted sessions..." >&2
|
||||
mise rm -g "$tool" >/dev/null 2>&1 || true
|
||||
mise uninstall --all "$tool" >/dev/null 2>&1 || true
|
||||
if ours; then
|
||||
echo "Updating Hermes for prompted sessions..." >&2
|
||||
mise rm -g "$tool" >/dev/null 2>&1 || true
|
||||
mise uninstall --all "$tool" >/dev/null 2>&1 || true
|
||||
else
|
||||
echo "A Hermes mise environment exists without an Omarchy-owned wrapper." >&2
|
||||
echo "Update or remove it explicitly, then run omarchy-install-hermes-cli again." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
@@ -218,7 +223,7 @@ chmod +x "$HOME/.local/bin/hermes"
|
||||
if [[ $mode == "--now" ]]; then
|
||||
"$HOME/.local/bin/hermes" --version
|
||||
if ! hermes_prompt_ready; then
|
||||
echo "Hermes installed without the session report Omarchy needs for prompted launches." >&2
|
||||
echo "Hermes installed without the interactive seeded sessions Omarchy needs." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user