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:
Gabriel Brown committed 2026-10-30 14:58:46 -04:00
1 parent 5af5d7a96b
commit e21a4c24f0
8 files changed
+108 -15

No files matched your search

+53 -2
View File
@@ -27,8 +27,11 @@
# 6. panama-agent-crash carries all four coredump facts and the absolute path
# to the skill. The path is what makes the ladder work for an agent whose
# harness has no skill mechanism.
# 7. T3 Code opens no terminal. It starts a thread in the checkout's project
# with the prompt intact on stdin, and opens that thread's t3code:// link.
#
# Hermetic on purpose: kitty, claude, codex, setsid and coredumpctl are all
# Hermetic on purpose: kitty, claude, codex, t3, xdg-open, setsid and
# coredumpctl are all
# stubbed onto PATH and the settings file is fabricated, so no agent is ever
# launched and no window is ever opened. This is NOT in tests/desktop-hijacking
# for exactly that reason -- it must stay runnable mid-session.
@@ -79,6 +82,23 @@ for agent in claude codex; do
STUB
done
# T3 Code's CLI. It records each call and its stdin, and answers `thread start`
# with a thread id the way the real one does.
cat >"$stub/t3" <<STUB
#!/usr/bin/env bash
printf '%s\0' "\$@" >>"$work/t3-calls"
printf '\n' >>"$work/t3-calls"
if [[ "\$1 \$2" == "thread start" ]]; then
cat >"$work/t3-stdin"
printf 'thread-123\n'
fi
STUB
cat >"$stub/xdg-open" <<STUB
#!/usr/bin/env bash
printf '%s' "\$1" >"$work/opened"
STUB
# A hand-run PID has no core here; the real one would be a slow lookup against
# this machine's journal.
cat >"$stub/coredumpctl" <<'STUB'
@@ -104,7 +124,9 @@ chmod +x "$stub"/*
# from the previous run are cleared first, so "was not launched" is a missing
# file rather than a stale one.
launch() {
rm -f "$work/argv" "$work/cwd" "$work/setsid-used" "$work/agent-actually-ran"
rm -f "$work/argv" "$work/cwd" "$work/setsid-used" "$work/agent-actually-ran" \
"$work/t3-calls" "$work/t3-stdin" "$work/opened"
T3CODE_HOME="$work/t3home" \
PATH="$stub:/usr/bin:/bin" \
PANAMA_PATH="$repo_dir" \
PANAMA_AGENT_SETTINGS="$settings" \
@@ -252,6 +274,35 @@ else
note 'launching codex with auto-approve off opened no terminal'
fi
# ── 7. T3 Code ──────────────────────────────────────────────────────────────
# The recorded t3 calls, one per line, arguments joined by \x1f.
t3_calls() { tr '\0' '\037' <"$work/t3-calls" 2>/dev/null; }
mkdir -p "$work/t3home/userdata"
printf 'env-456' >"$work/t3home/userdata/environment-id"
printf '{"preferredAgent":"t3","agentAutoApprove":true}\n' >"$settings"
dash_prompt=$'--looks-like-a-flag\nsecond line'
launch "$launcher" --prompt "$dash_prompt"
status=$?
(( status == 0 )) || note "panama-agent exited $status launching T3 Code: $(head -1 "$work/stderr")"
[[ -e "$work/argv" ]] && note 'T3 Code was launched in a terminal; it should open a thread in the app'
t3_calls | grep -qxF "thread"$'\x1f'"start"$'\x1f'"$repo_dir"$'\x1f'"-"$'\x1f' \
|| note 'T3 Code was not asked to start a thread in the checkout with the prompt on stdin'
[[ "$(cat "$work/t3-stdin" 2>/dev/null)" == "$dash_prompt" ]] \
|| note 'the T3 thread did not receive the prompt intact on stdin'
[[ "$(cat "$work/opened" 2>/dev/null)" == "t3code://threads/env-456/thread-123" ]] \
|| note "T3 Code opened '$(cat "$work/opened" 2>/dev/null)' rather than the new thread's link"
# No prompt means nothing to start: the app opens on the project.
launch "$launcher"
t3_calls | grep -qF "thread"$'\x1f'"start" \
&& note 'with no prompt T3 Code still started a thread'
t3_calls | grep -qxF "app"$'\x1f'"$repo_dir"$'\x1f' \
|| note 'with no prompt T3 Code was not opened on the checkout'
# ── An agent installed where only the user's own PATH looks ─────────────────
#
# Both agents install themselves into ~/.local/bin. The rungs are clicked from