Files
luzia/docker/cockpit/Dockerfile
admin ec33ac1936 Refactor cockpit to use DockerTmuxController pattern
Based on claude-code-tools TmuxCLIController, this refactor:

- Added DockerTmuxController class for robust tmux session management
- Implements send_keys() with configurable delay_enter
- Implements capture_pane() for output retrieval
- Implements wait_for_prompt() for pattern-based completion detection
- Implements wait_for_idle() for content-hash-based idle detection
- Implements wait_for_shell_prompt() for shell prompt detection

Also includes workflow improvements:
- Pre-task git snapshot before agent execution
- Post-task commit protocol in agent guidelines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 10:42:16 -03:00

73 lines
1.6 KiB
Docker

# Luzia Cockpit - Interactive Claude Agent Container
# Provides tmux-based session management for human-in-the-loop workflows
FROM debian:bookworm-slim
# Avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install base tools
RUN apt-get update && apt-get install -y --no-install-recommends \
tmux \
curl \
git \
jq \
ca-certificates \
gnupg \
procps \
less \
vim-tiny \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js 20 LTS
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install Claude CLI globally
RUN npm install -g @anthropic-ai/claude-code
# Create workspace directory
RUN mkdir -p /workspace /root/.claude
# Tmux configuration for better session handling
RUN cat > /root/.tmux.conf << 'EOF'
# Increase scrollback buffer
set-option -g history-limit 50000
# Don't rename windows automatically
set-option -g allow-rename off
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Enable mouse (for human attach)
set -g mouse on
# Status bar showing session info
set -g status-left '[#S] '
set -g status-right '%H:%M '
# Keep tmux server running even if no clients
set -g exit-empty off
EOF
# Entry script that starts tmux and keeps container alive
RUN cat > /entrypoint.sh << 'EOF'
#!/bin/bash
set -e
# Start tmux server with agent session
tmux new-session -d -s agent -n main
# Keep container alive by waiting on tmux
exec tmux wait-for exit-signal
EOF
RUN chmod +x /entrypoint.sh
WORKDIR /workspace
# Default command starts tmux server
CMD ["/entrypoint.sh"]