container: Add Pi coding agent (pi.dev) as a third harness

- Install @earendil-works/pi-coding-agent globally via npm in the
  image so it survives the home directory bind mount
- Add pi subcommand forwarding PI_* and provider key prefixes
- Add pi shell wrapper alias
- Build with --network host so image builds work on hosts where the
  Docker bridge network cannot create veth pairs
This commit is contained in:
Jeena 2026-08-30 11:50:56 +09:00
parent 7984b9129a
commit 5c2f3ae83c
4 changed files with 58 additions and 4 deletions

View file

@ -18,6 +18,7 @@ USAGE = """\
Usage:
agent-container opencode [args...] Run OpenCode in the container
agent-container claude [args...] Run Claude Code in the container
agent-container pi [args...] Run Pi in the container
agent-container update Rebuild image with latest versions
agent-container purge Remove all containers, image, and data
"""
@ -80,6 +81,41 @@ class AgentContainer:
env_prefixes=["ANTHROPIC_", "CLAUDE_"],
extra_env={"DISABLE_AUTOUPDATER": "1"},
)
elif command == "pi":
# Forward pi's own variables plus the API key prefixes of its
# supported providers (see pi docs: providers.md). Auth via
# /login persists in the shared container home instead.
self._run_tool(
"pi",
args,
env_prefixes=[
"PI_",
"ANTHROPIC_",
"ANT_LING_",
"OPENAI_",
"AZURE_",
"GOOGLE_",
"GEMINI_",
"DEEPSEEK_",
"NVIDIA_",
"MISTRAL_",
"GROQ_",
"CEREBRAS_",
"CLOUDFLARE_",
"XAI_",
"OPENROUTER_",
"AI_GATEWAY_",
"ZAI_",
"KIMI_",
"MINIMAX_",
"QWEN_",
"OPENCODE_",
"FIREWORKS_",
"TOGETHER_",
"BASETEN_",
"OLLAMA_",
],
)
elif command == "update":
self.update()
elif command == "purge":
@ -221,6 +257,10 @@ class AgentContainer:
cmd = [
"docker",
"build",
# Use host networking during build so the build works on hosts
# where the default bridge network cannot create veth pairs
"--network",
"host",
"--build-arg",
f"USERNAME={self.host_username}",
"--build-arg",