feat: forward agent style via native CLI config and terminal title

Replace prompt-injection for display identity with native UI wiring:
- Claude: writes a statusline shell script + custom theme JSON, wired up
  via settings.json so label/color show in the status bar and theme
- Codex: writes [tui] block into codex-config.toml (status_line,
  terminal_title, dark-ansi theme)
- Both backends set the terminal title via ANSI OSC 0 escape before
  exec-ing the agent when a label is present

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 00:00:19 -04:00
parent 39811c9b32
commit d02226aab9
9 changed files with 204 additions and 65 deletions
+11 -3
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
import subprocess
import shlex
from typing import Callable
from typing import cast
@@ -22,12 +23,14 @@ class DockerBottle(Bottle):
*,
agent_command: str = "claude",
agent_prompt_mode: PromptMode = "append_file",
terminal_title: str = "",
):
self.name = container
self._teardown = teardown
self.prompt_path = prompt_path_in_container
self._agent_prompt_mode = agent_prompt_mode
self.agent_command = agent_command
self.terminal_title = terminal_title
self.agent_provider_template = (
"codex" if agent_command == "codex" else "claude"
)
@@ -47,9 +50,14 @@ class DockerBottle(Bottle):
return cmd
def exec_agent(self, argv: list[str], *, tty: bool = True) -> int:
return subprocess.run(
self.agent_argv(argv, tty=tty), check=False,
).returncode
agent_argv = self.agent_argv(argv, tty=tty)
if self.terminal_title and tty:
shell_script = (
f"printf '\\033]0;%s\\007' {shlex.quote(self.terminal_title)}; "
f"exec {shlex.join(agent_argv)}"
)
return subprocess.run(["sh", "-lc", shell_script], check=False).returncode
return subprocess.run(agent_argv, check=False).returncode
def exec(self, script: str, *, user: str = "node") -> ExecResult:
# Pipe via stdin to `sh -s` so the caller never has to worry
+1
View File
@@ -175,6 +175,7 @@ def launch(
None,
agent_command=plan.agent_command,
agent_prompt_mode=plan.agent_prompt_mode,
terminal_title=plan.spec.label or plan.spec.agent_name,
)
bottle.prompt_path = provision(plan, bottle)