Offer T3 Code as the preferred agent, opening a thread in the Panama project, and install it with the desktop
This commit is contained in:
1 parent
5af5d7a96b
commit
e21a4c24f0
8 files changed
+108
-15
No files matched your search
+40
-5
@@ -10,9 +10,16 @@
|
||||
# start time, so choosing an agent in Settings takes effect on the next crash
|
||||
# without restarting anything:
|
||||
#
|
||||
# preferredAgent none | claude | codex ("none" is the default: silence)
|
||||
# preferredAgent none | claude | codex | t3 ("none" is the default: silence)
|
||||
# agentAutoApprove true -> the agent starts in its own "don't stop to ask"
|
||||
# mode; false -> its normal prompting mode, untouched.
|
||||
# T3 Code ignores it: a T3 thread runs in the mode its
|
||||
# project is set to, which is a choice made inside T3.
|
||||
#
|
||||
# claude and codex open in a kitty window. t3 starts a thread in the Panama
|
||||
# project on the running T3 Code server and brings it up in the desktop app,
|
||||
# so the investigation lives beside every other thread instead of in a
|
||||
# terminal of its own.
|
||||
#
|
||||
# "none" exits 0 without a word. It is not an error to have no agent; it is the
|
||||
# shipped state, and a rung that shouted about it would be a rung that gets
|
||||
@@ -95,8 +102,9 @@ usage() {
|
||||
cat <<'EOF'
|
||||
Usage: panama-agent [--prompt "text"]
|
||||
|
||||
Opens the agent named by preferredAgent in a terminal, in the Panama checkout.
|
||||
With no agent chosen, exits silently: choose one on Settings > System > Agents.
|
||||
Opens the agent named by preferredAgent in the Panama checkout: a terminal for
|
||||
claude and codex, a thread in the T3 Code app for t3. With no agent chosen,
|
||||
exits silently: choose one on Settings > System > Agents.
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -139,7 +147,7 @@ agent="$(read_setting preferredAgent none)"
|
||||
auto_approve="$(read_setting agentAutoApprove true)"
|
||||
|
||||
case "$agent" in
|
||||
claude | codex) ;;
|
||||
claude | codex | t3) ;;
|
||||
*)
|
||||
printf 'panama-agent: unsupported preferredAgent: %s\n' "$agent" >&2
|
||||
printf 'Choose one on Settings > System > Agents.\n' >&2
|
||||
@@ -148,7 +156,8 @@ case "$agent" in
|
||||
esac
|
||||
|
||||
# Resolved to a path before argv is built, so kitty is never asked to repeat a
|
||||
# PATH lookup this script has already done more carefully than kitty could.
|
||||
# PATH lookup this script has already done more carefully than kitty could. T3
|
||||
# Code's CLI is `t3`, which the desktop app writes into ~/.local/bin.
|
||||
if ! agent_bin="$(resolve_agent "$agent")"; then
|
||||
printf 'panama-agent: %s is not installed.\n' "$agent" >&2
|
||||
printf 'Looked on PATH and in %s.\n' "$HOME/.local/bin" >&2
|
||||
@@ -156,6 +165,32 @@ if ! agent_bin="$(resolve_agent "$agent")"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# T3 Code: no terminal. The thread starts on the running server in the
|
||||
# project whose root is the checkout, with the project's default model, and
|
||||
# the t3code:// link opens it in the app. `project add` refuses a root that is
|
||||
# already a project, which is the common case, so its failure is not one. The
|
||||
# prompt goes over stdin ("-"), so a prompt that begins with a dash is never
|
||||
# read as a flag. With no prompt there is nothing to start, so the app just
|
||||
# opens on the project.
|
||||
if [[ "$agent" == "t3" ]]; then
|
||||
repair_path
|
||||
"$agent_bin" project add "$PANAMA_PATH" >/dev/null 2>&1 || true
|
||||
if [[ -z "$prompt" ]]; then
|
||||
exec setsid "$agent_bin" app "$PANAMA_PATH"
|
||||
fi
|
||||
if ! thread="$(printf '%s' "$prompt" | "$agent_bin" thread start "$PANAMA_PATH" -)"; then
|
||||
printf 'panama-agent: T3 Code could not start a thread.\n' >&2
|
||||
printf 'Is the T3 Code server running? Check: systemctl --user status t3code\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
environment_file="${T3CODE_HOME:-$HOME/.t3}/userdata/environment-id"
|
||||
environment="$(cat "$environment_file" 2>/dev/null || true)"
|
||||
if [[ -n "$environment" ]]; then
|
||||
exec setsid xdg-open "t3code://threads/$environment/$thread"
|
||||
fi
|
||||
exec setsid "$agent_bin" app "$PANAMA_PATH"
|
||||
fi
|
||||
|
||||
# The per-agent launch table. VERIFIED against the installed binaries' --help on
|
||||
# 2026-08-25 (claude 2.1.245, codex-cli 0.149.1) -- these flags are not the same
|
||||
# from release to release, so re-run --help before changing them.
|
||||
|
||||
Reference in new issue
Block a user