mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-23 02:36:57 -04:00
240e989e8f
Phase 4: Tiara Hook Integration - Add lifecycle hooks module (src/hooks/lifecycle.ts) - Daemon lifecycle hooks: start, ready, shutdown - Session lifecycle hooks: start, restore, end, transfer - Todo lifecycle hooks: continuation, completed, blocked - Integrate hooks with daemon startup/shutdown - Integrate hooks with Telegram gateway for session events Phase 5: WezTerm Visual Orchestration - Add WezTerm orchestration module (src/orchestration/wezterm.ts) - Display detection (X11 via DISPLAY, Wayland via WAYLAND_DISPLAY) - Status pane showing daemon health, services, sessions - Session pane management API (create/close/focus) - Graceful degradation when no display available - CLI options: --wezterm, --wezterm-layout - Integration with lifecycle hooks for auto-updates Also includes: - Session persistence module (src/session/persistence.ts) - Telegram gateway (src/gateway/telegram.ts) - Daemon CLI command (src/cli/cmd/daemon.ts) - Systemd service files (scripts/systemd/) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
94 lines
3.0 KiB
Bash
Executable File
94 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Install agent-core as a systemd service
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
SERVICE_FILE="$SCRIPT_DIR/agent-core.service"
|
|
TARGET="/etc/systemd/system/agent-core.service"
|
|
|
|
# Check if running as root
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "This script must be run as root (use sudo)"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if service file exists
|
|
if [[ ! -f "$SERVICE_FILE" ]]; then
|
|
echo "Error: Service file not found at $SERVICE_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
# Copy service file
|
|
echo "Installing service file to $TARGET..."
|
|
cp "$SERVICE_FILE" "$TARGET"
|
|
|
|
# Create environment file directory if needed
|
|
mkdir -p /home/artur/.config/agent-core
|
|
|
|
# Create environment file template if it doesn't exist
|
|
ENV_FILE="/home/artur/.config/agent-core/daemon.env"
|
|
if [[ ! -f "$ENV_FILE" ]]; then
|
|
echo "Creating environment file template at $ENV_FILE..."
|
|
cat > "$ENV_FILE" << 'EOF'
|
|
# Agent Core Daemon Environment Configuration
|
|
# Add your API keys here (uncomment and fill in)
|
|
|
|
# =============================================================================
|
|
# LLM Provider Keys (at least one required)
|
|
# =============================================================================
|
|
|
|
# Anthropic API key (recommended)
|
|
# ANTHROPIC_API_KEY=your-key-here
|
|
|
|
# OpenAI API key (optional)
|
|
# OPENAI_API_KEY=your-key-here
|
|
|
|
# =============================================================================
|
|
# Tool API Keys
|
|
# =============================================================================
|
|
|
|
# EXA API key (for web search)
|
|
# EXA_API_KEY=your-key-here
|
|
|
|
# =============================================================================
|
|
# Telegram Gateway (Phase 2: Remote Access)
|
|
# =============================================================================
|
|
|
|
# Get your bot token from @BotFather on Telegram
|
|
# TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrsTUVwxyz
|
|
|
|
# Restrict access to specific Telegram user IDs (comma-separated)
|
|
# Find your ID by messaging @userinfobot on Telegram
|
|
# Leave empty to allow all users (not recommended for public bots)
|
|
# TELEGRAM_ALLOWED_USERS=123456789,987654321
|
|
|
|
# =============================================================================
|
|
# Discord Gateway (Future - Phase 2)
|
|
# =============================================================================
|
|
|
|
# DISCORD_BOT_TOKEN=your-discord-token-here
|
|
EOF
|
|
chown artur:artur "$ENV_FILE"
|
|
chmod 600 "$ENV_FILE"
|
|
fi
|
|
|
|
# Reload systemd
|
|
echo "Reloading systemd..."
|
|
systemctl daemon-reload
|
|
|
|
echo ""
|
|
echo "Installation complete!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " 1. Edit your API keys in: $ENV_FILE"
|
|
echo " 2. Enable the service: sudo systemctl enable agent-core"
|
|
echo " 3. Start the service: sudo systemctl start agent-core"
|
|
echo " 4. Check status: sudo systemctl status agent-core"
|
|
echo " 5. View logs: journalctl -u agent-core -f"
|
|
echo ""
|
|
echo "Or use the CLI commands:"
|
|
echo " opencode daemon # Start in foreground"
|
|
echo " opencode daemon-status # Check if running"
|
|
echo " opencode daemon-stop # Stop the daemon"
|