## LLM 공급자 어댑터 (B)
- sister-agent/src/llm/ 에 LlmAdapter 인터페이스 신설. 어댑터 5종:
openclaw (기존), openai, anthropic, ollama, mock
- 선택은 LLM_PROVIDER 환경변수로. 기본값 mock.
- 모델명은 LLM_MODEL_{MANAGER,PRINCIPAL,LEAD,JUNIOR} 로 외부화.
OpenClaw 내부 네이밍이 기본값이지만 env 로 얼마든지 갈아끼움.
- openai 어댑터는 OPENAI_BASE_URL 로 OpenRouter / Azure / 로컬 llama.cpp
서버까지 커버.
## In-process 단일 프로세스 모드 (C)
- sister-agent/src/core.ts 로 executeInvocation 을 library-export
- rails 에 InProcessTransport 추가. 동적 import 로 sister-agent core 를
로드해 같은 Node 프로세스에서 함수 호출로 실행.
- DirectRailsClient 로 HTTP 루프백 없이 DB 에 직접 쓰기 — 단일
프로세스에서도 observability 동일.
- RailsConfig 에 transport: "in-process" 추가.
- buildTransports 가 RAILS_TRANSPORT 와 per-stage override 를 지원하도록
확장. 레거시 RAILS_TRANSPORT_MODE + RAILS_AGENT_*_HOST 도 그대로 호환.
## Git push 외부화 + allowlist env 화
- spawn.ts 의 ENABLE_GIT_PUSH 를 "GITEA_TOKEN 있으면 auto on" 으로 변경.
기존 Dev 토폴로지는 sister LXC 들에 이미 토큰이 있어서 행동 변화 없음.
- rails.service.ts 의 파일 프록시 allowlist 를 GIT_RAW_ALLOWED_HOSTS
env 로 외부화. 기본값은 기존 Gitea 호스트 유지.
## Docker / 배포
- Dockerfile 추가. 단일 이미지로 rails + sister-agent 둘 다 빌드.
- docker-compose.yml (기본): mariadb + rails 한 컨테이너 = in-process.
docker compose up 한 줄로 로컬 E2E 가능.
- docker-compose.full.yml: rails + 4 개 독립 sister 컨테이너 = 분산.
## 설정 샘플 + 문서
- .env.example 완전 재작성: 필수/LLM/토폴로지/Gitea/Discord 5 섹션
- rails.config.local.yaml: in-process 샘플
- rails.config.distributed.yaml: http 분산 샘플
- docs/LOCAL-SETUP.md: 30분 퀵스타트 (Docker + 네이티브 두 경로)
- README 에 "5분 퀵스타트" + 토폴로지 표 + LLM 공급자 목록 추가
## 테스트
- tests/transport-build.test.ts (6 테스트): 기본값 / in-process /
per-stage override / http 엔드포인트 누락 / env 기반 wiring / 레거시
env 호환
- 전체 테스트 105 → 111 통과
123 lines
5.2 KiB
Plaintext
123 lines
5.2 KiB
Plaintext
# ────────────────────────────────────────────────────────────────
|
|
# hanarang-rails — environment configuration
|
|
# Copy this file to `.env` and fill in the values you need.
|
|
#
|
|
# The file is grouped into:
|
|
# 1. required (must set to run any pipeline)
|
|
# 2. LLM provider (pick one)
|
|
# 3. transport / deployment topology
|
|
# 4. optional — Gitea push
|
|
# 5. optional — Discord bridge
|
|
# ────────────────────────────────────────────────────────────────
|
|
|
|
# ==== 1. REQUIRED =====================================================
|
|
|
|
# MariaDB / MySQL connection string used by Prisma.
|
|
# For docker-compose, use:
|
|
# mysql://rails:rails@mariadb:3306/hanarang_rails
|
|
DATABASE_URL="mysql://rails:CHANGE_ME@localhost:3306/hanarang_rails"
|
|
|
|
# Rails HTTP server port
|
|
RAILS_PORT=18800
|
|
RAILS_LOG_LEVEL=info
|
|
NODE_ENV=production
|
|
|
|
|
|
# ==== 2. LLM PROVIDER =================================================
|
|
#
|
|
# Pick exactly one provider for LLM_PROVIDER. Supported values:
|
|
# mock — deterministic fake responses. No network, no money.
|
|
# openai — OpenAI / OpenRouter / Azure OpenAI / any OpenAI-compatible API
|
|
# anthropic — Anthropic Messages API
|
|
# ollama — local Ollama server (https://ollama.com)
|
|
# openclaw — hanarang-internal OpenClaw runtime (most external users won't have this)
|
|
|
|
LLM_PROVIDER=mock
|
|
|
|
# Per-role model override. Leave empty to use the defaults baked into roles.ts
|
|
# (which are OpenClaw-flavored names — you probably need to set these for
|
|
# openai / anthropic / ollama).
|
|
#
|
|
# Good starting points:
|
|
# OpenAI: gpt-4o / gpt-4o-mini
|
|
# Anthropic: claude-opus-4-6 / claude-haiku-4-5
|
|
# Ollama: qwen2.5-coder:32b / qwen2.5-coder:7b
|
|
#
|
|
# LLM_MODEL_MANAGER=gpt-4o
|
|
# LLM_MODEL_PRINCIPAL=gpt-4o
|
|
# LLM_MODEL_LEAD=gpt-4o-mini
|
|
# LLM_MODEL_JUNIOR=gpt-4o-mini
|
|
# LLM_MODEL_FALLBACK=gpt-4o-mini
|
|
|
|
# ── OpenAI (and OpenAI-compatible) ────────────────────────────────────
|
|
# OPENAI_API_KEY=sk-...
|
|
# OPENAI_BASE_URL=https://api.openai.com/v1
|
|
# (also works for OpenRouter, Azure OpenAI, local llama.cpp servers, etc.)
|
|
|
|
# ── Anthropic ─────────────────────────────────────────────────────────
|
|
# ANTHROPIC_API_KEY=sk-ant-...
|
|
# ANTHROPIC_BASE_URL=https://api.anthropic.com
|
|
|
|
# ── Ollama (local) ────────────────────────────────────────────────────
|
|
# OLLAMA_BASE_URL=http://localhost:11434
|
|
|
|
# ── OpenClaw (internal) ───────────────────────────────────────────────
|
|
# OPENCLAW_BIN=/home/you/.npm-global/bin/openclaw
|
|
|
|
|
|
# ==== 3. TRANSPORT / TOPOLOGY =========================================
|
|
#
|
|
# rails supports three deployment topologies:
|
|
#
|
|
# 1. in-process — everything in one Node process. The simplest. The 4
|
|
# sister agents are just function calls inside rails.
|
|
# Requires sister-agent to be built under
|
|
# ./sister-agent/dist/.
|
|
#
|
|
# 2. http — rails calls each sister-agent over HTTP. The sister
|
|
# agents run as separate daemons (potentially on separate
|
|
# machines/containers). Production topology.
|
|
#
|
|
# 3. mock — no LLM, no files, no push. Just exercises the FSM.
|
|
#
|
|
# Set via RAILS_TRANSPORT globally, or per-stage via RAILS_TRANSPORT_PLAN etc.
|
|
|
|
RAILS_TRANSPORT=in-process
|
|
|
|
# For http mode — each sister-agent daemon's HTTP endpoint:
|
|
# SISTER_ENDPOINT_PLAN=http://harang-lxc:18801
|
|
# SISTER_ENDPOINT_IMPLEMENT=http://narang-lxc:18801
|
|
# SISTER_ENDPOINT_REVIEW=http://darang-lxc:18801
|
|
# SISTER_ENDPOINT_DEPLOY=http://erang-lxc:18801
|
|
|
|
# Loopback URL that sister-agent uses to report sub-task events back to rails.
|
|
# Usually the same as your rails HTTP URL as seen from the sister.
|
|
RAILS_API_URL=http://127.0.0.1:18800
|
|
|
|
# For in-process mode, optional override of where to load the compiled
|
|
# sister-agent core module from. Defaults to ./sister-agent/dist/core.js
|
|
# SISTER_AGENT_CORE_PATH=/app/sister-agent/dist/core.js
|
|
|
|
# Where sister-agent writes per-pipeline workspaces on disk.
|
|
# SISTER_WORKSPACE_DIR=/home/you/rails-projects
|
|
|
|
|
|
# ==== 4. OPTIONAL — Gitea auto-push ===================================
|
|
#
|
|
# When enabled, each pipeline run auto-creates a public repo and pushes its
|
|
# workspace to Gitea, giving you a shareable URL for the generated files.
|
|
# Leave GITEA_TOKEN empty to skip the push step entirely.
|
|
|
|
# GITEA_BASE_URL=https://git.example.com
|
|
# GITEA_ORG=my-org
|
|
# GITEA_TOKEN=
|
|
# GIT_USER_NAME=rails-agent
|
|
# GIT_USER_EMAIL=rails@example.com
|
|
# GIT_PUSH_ENABLED=true # force on/off; default is auto (on iff GITEA_TOKEN set)
|
|
|
|
|
|
# ==== 5. OPTIONAL — Discord bridge ====================================
|
|
# DISCORD_TOKEN=
|
|
# DISCORD_GUILD_ID=
|
|
# GITEA_WEBHOOK_SECRET=
|