* Let Grok updates through mise take effect Grok's npm launcher runs ~/.grok/bin/grok whenever it exists, and the install script that repoints it at a new release doesn't run under mise, so every machine kept running the release it first unpacked. Updating mise tools now drops a link to an older release and the old binary, and lets the launcher unpack the installed one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep several Grok accounts, the way Claude and Codex do Grok honors GROK_HOME, so an added Grok account gets its own home holding only its login and settings cache, with the CLI binary, sessions, skills, plugins, memory, and config linked back to ~/.grok. The account commands, the add flow (a second account signs in through a private window), the launcher, and a grok shell function all take it like the others, and its identity and plan come from the files Grok writes at login. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Show Grok's plan and credits in the agents panel A grok collector reads each account's plan from the settings Grok caches and its credits from the endpoint behind Grok's own /usage view, so Grok gets a section, per-account limits, and autoswitch like Claude and Codex. A signed-in agent with a plan now shows before its first numbers, so a lapsed sign-in has somewhere to say so. Grok's mark joins the assets, and with every agent able to take another account the add screen no longer needs to dim one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Document Grok accounts and limits alongside Claude and Codex Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Read Grok's credits the way xAI actually answers The answer nests under config, names a weekly period with its end, and as protobuf JSON leaves the usage percentage out while it's zero. The collector now reads that shape, so a fresh week shows as 0% until it resets rather than as nothing known. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Count Grok's prompts and sessions from its session summaries Grok keeps a summary beside each session with when it was last active and how many prompts it had, so its section and the hero's summary get today's prompts and sessions and its active days. It records no token counts there, so none are claimed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give each Grok limits cache write its own temporary file Two overlapping collector runs wrote the same cache through one .tmp path, so one rename could leave the other's failing and its record not updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Read a single Grok account from GROK_HOME when it's set The launcher and the CLI honor GROK_HOME, but the collector always read ~/.grok, so a Grok signed in only in a custom home showed nothing. With one account, the collector now reads the home the CLI would; with several registered, the primary stays ~/.grok. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop guesses the real Grok credits answer made unnecessary The collector carried fallbacks for fields and shapes guessed from the binary before xAI's actual answer was seen, a numeric timestamp branch nothing writes, the panel's default for prompt stats, and guards that an empty sign-in already covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the working Grok release until its update is in place The update dropped the link and older binaries before the new release was unpacked and ignored a failed unpack, which could leave every Grok account without a CLI. The old release now stays until the new one is linked, and its link comes back if it never is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Count only Grok sessions for today, not prompts A session's summary holds all its prompts and only when it was last active, so a resumed session put its whole history on today. Today now counts the sessions active in it; prompts stay an all-time total. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Reuse the Grok session scan on a limits-only refresh Opening the panel and near-limit checks only need fresh limits, so they reuse a scan up to 15 minutes old, as the Codex collector does; --force still rescans. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
161 lines
5.0 KiB
Bash
Executable File
161 lines
5.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Launch the default coding agent in a terminal
|
|
# omarchy:args=[--inline] [--pick]
|
|
# omarchy:examples=omarchy agent | omarchy agent --inline
|
|
|
|
inline=false
|
|
pick=false
|
|
|
|
# Flags only. A bare prompt would shadow the subcommands under this group, so
|
|
# prompts go through omarchy-agent-prompt, which passes one here as --prompt.
|
|
while (($#)); do
|
|
case "$1" in
|
|
--inline)
|
|
inline=true
|
|
shift
|
|
;;
|
|
--pick)
|
|
pick=true
|
|
shift
|
|
;;
|
|
--prompt)
|
|
prompt=${2:?--prompt needs a value}
|
|
shift 2
|
|
;;
|
|
*)
|
|
echo "Unexpected argument: $1" >&2
|
|
echo "To pass a prompt: omarchy agent prompt \"$*\"" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Agents refuse to remember trust for $HOME, so launches from the keybinding or
|
|
# menu start in the work directory instead of re-asking on every session.
|
|
[[ $PWD == "$HOME" && -d $HOME/Work ]] && cd "$HOME/Work"
|
|
|
|
agent=$(omarchy-default-agent)
|
|
|
|
# Omarchy ships without a default, so there is nothing to launch until one is
|
|
# picked. --pick offers the choice instead of the error, which is what the
|
|
# keybinding wants: a keypress that opens nothing explains nothing.
|
|
if [[ -z $agent ]]; then
|
|
[[ $pick == "true" ]] && exec omarchy-menu summon setup.default.agent
|
|
echo "Choose default agent with: omarchy default agent <name>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if omarchy-cmd-missing "$agent"; then
|
|
echo "$agent is not installed. Choose an installed agent with: omarchy default agent <name>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Agents launched from the keybinding or menu run unattended, so each one starts
|
|
# with its own spelling of "don't stop to ask". Pi and Ori have none to skip.
|
|
case "$agent" in
|
|
opencode)
|
|
command=(opencode --auto)
|
|
[[ -n ${prompt:-} ]] && command+=(--prompt "$prompt")
|
|
;;
|
|
agy)
|
|
command=(agy --dangerously-skip-permissions)
|
|
[[ -n ${prompt:-} ]] && command+=(--prompt-interactive "$prompt")
|
|
;;
|
|
copilot)
|
|
command=(copilot --allow-all)
|
|
[[ -n ${prompt:-} ]] && command+=(--interactive "$prompt")
|
|
;;
|
|
crush)
|
|
# --yolo belongs to the interactive command only; `crush run` never prompts.
|
|
if [[ -n ${prompt:-} ]]; then
|
|
command=(crush run "$prompt")
|
|
else
|
|
command=(crush --yolo)
|
|
fi
|
|
;;
|
|
claude)
|
|
command=(claude --permission-mode auto)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
grok)
|
|
command=(grok --permission-mode bypassPermissions)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
openclaw)
|
|
# The launcher owns onboarding and the gateway dance: OpenClaw's terminal UI
|
|
# must attach to the running gateway (the embedded `openclaw chat` refuses to
|
|
# start while the gateway owns the state directory). It has no permission
|
|
# prompts to skip, and --message seeds the session while keeping it
|
|
# interactive.
|
|
command=(omarchy-launch-openclaw --tui)
|
|
[[ -n ${prompt:-} ]] && command+=(--message "$prompt")
|
|
;;
|
|
codex)
|
|
command=(codex --approve-for-me)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
cursor-agent)
|
|
# --yolo covers commands only; the workspace trust dialog has its own flag.
|
|
# A one-word prompt naming a subcommand (update, login, help) still runs that
|
|
# subcommand after a bare --, so the agent subcommand is named outright, and
|
|
# -- after it keeps a prompt starting with a dash from being read as an option.
|
|
command=(cursor-agent --yolo --trust)
|
|
[[ -n ${prompt:-} ]] && command+=(agent -- "$prompt")
|
|
;;
|
|
hermes)
|
|
if [[ -n ${prompt:-} ]]; then
|
|
command=(env -u HERMES_SESSION_SOURCE hermes chat --yolo --tui "--query=$prompt")
|
|
else
|
|
command=(hermes --yolo)
|
|
fi
|
|
;;
|
|
muse)
|
|
# --approval-mode never skips the tool prompts but keeps Muse's own sandbox.
|
|
command=(muse --approval-mode never)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
omp)
|
|
command=(omp --auto-approve)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
ori)
|
|
# Ori is a harness launcher, and `ori code` is the agent it runs itself.
|
|
# A prompt alone means one headless turn there, printed after the turn ends,
|
|
# so --interactive is what seeds the session with it and keeps the window.
|
|
command=(ori code)
|
|
[[ -n ${prompt:-} ]] && command+=(--interactive --prompt "$prompt")
|
|
;;
|
|
pi)
|
|
command=(pi)
|
|
[[ -n ${prompt:-} ]] && command+=("$prompt")
|
|
;;
|
|
*)
|
|
echo "Unsupported default agent: $agent" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# Claude, Codex, and Grok start as the active subscription account, the same
|
|
# as the shell functions in default/bash/fns/agent-accounts. The home travels
|
|
# in the command itself, since a terminal launched through uwsm doesn't
|
|
# inherit this process's environment.
|
|
case "$agent" in
|
|
claude) home_env="CLAUDE_CONFIG_DIR" ;;
|
|
codex) home_env="CODEX_HOME" ;;
|
|
grok) home_env="GROK_HOME" ;;
|
|
*) home_env="" ;;
|
|
esac
|
|
if [[ -n $home_env && -z ${!home_env:-} ]]; then
|
|
home=$(omarchy-agent-account-home "$agent")
|
|
[[ -n $home ]] && command=(env "$home_env=$home" "${command[@]}")
|
|
fi
|
|
|
|
if [[ $inline == "true" ]]; then
|
|
exec "${command[@]}"
|
|
else
|
|
# A fixed app-id rather than the default org.omarchy.<binary>, so every agent
|
|
# window shares one class for window rules and themes to single out.
|
|
exec omarchy-launch-tui --app-id=org.omarchy.agent "${command[@]}"
|
|
fi
|