Compare commits
1 Commits
feat/memor
...
feat/herme
| Author | SHA1 | Date | |
|---|---|---|---|
| b003d3c6ad |
66
ai/compose.yml
Executable file → Normal file
66
ai/compose.yml
Executable file → Normal file
@@ -32,7 +32,7 @@ services:
|
|||||||
- default
|
- default
|
||||||
container_name: hermes
|
container_name: hermes
|
||||||
entrypoint: ["/bin/bash", "-c",
|
entrypoint: ["/bin/bash", "-c",
|
||||||
"bash /opt/data/hermes-tools/install.sh && . /opt/hermes/.venv/bin/activate && uv pip install openai 'mautrix[encryption]' -q && exec /usr/bin/tini -g -- /opt/hermes/docker/entrypoint.sh \"$@\"",
|
"bash /opt/data/hermes-tools/install.sh && exec /usr/bin/tini -g -- /opt/hermes/docker/entrypoint.sh \"$@\"",
|
||||||
"hermes-entrypoint"]
|
"hermes-entrypoint"]
|
||||||
restart: always
|
restart: always
|
||||||
# Gateway run enables the internal API server on port 8642
|
# Gateway run enables the internal API server on port 8642
|
||||||
@@ -58,8 +58,6 @@ services:
|
|||||||
- /mnt/HoardingCow_docker_data/Syncthing/telos-ro:/opt/data/telos-ro:ro
|
- /mnt/HoardingCow_docker_data/Syncthing/telos-ro:/opt/data/telos-ro:ro
|
||||||
# Syncthing-shared inbox — write tasks here, they sync to user's laptop
|
# Syncthing-shared inbox — write tasks here, they sync to user's laptop
|
||||||
- /mnt/HoardingCow_docker_data/Syncthing/telos-rw:/opt/data/telos-rw:rw
|
- /mnt/HoardingCow_docker_data/Syncthing/telos-rw:/opt/data/telos-rw:rw
|
||||||
# Persist Python venv across container recreation (Matrix bridge deps, etc.)
|
|
||||||
- /mnt/HoardingCow_docker_data/Hermes/venv:/opt/hermes/.venv
|
|
||||||
devices:
|
devices:
|
||||||
- /dev/kfd:/dev/kfd
|
- /dev/kfd:/dev/kfd
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
@@ -68,8 +66,6 @@ services:
|
|||||||
- "26"
|
- "26"
|
||||||
networks:
|
networks:
|
||||||
- ai_backend
|
- ai_backend
|
||||||
depends_on:
|
|
||||||
- honcho
|
|
||||||
|
|
||||||
syncthing:
|
syncthing:
|
||||||
image: syncthing/syncthing:latest
|
image: syncthing/syncthing:latest
|
||||||
@@ -133,66 +129,6 @@ services:
|
|||||||
- "303"
|
- "303"
|
||||||
- "26"
|
- "26"
|
||||||
|
|
||||||
# --- Honcho: AI-native user modeling ---
|
|
||||||
honcho:
|
|
||||||
build: ./honcho
|
|
||||||
container_name: honcho
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "127.0.0.1:8000:8000"
|
|
||||||
environment:
|
|
||||||
- DB_CONNECTION_URI=postgresql+psycopg://honcho:honcho_pass@honcho-db:5432/honcho
|
|
||||||
- CACHE_URL=redis://honcho-redis:6379/0
|
|
||||||
- CACHE_ENABLED=true
|
|
||||||
volumes:
|
|
||||||
- /mnt/HoardingCow_docker_data/Honcho/data:/app/data
|
|
||||||
networks:
|
|
||||||
- ai_backend
|
|
||||||
depends_on:
|
|
||||||
honcho-db:
|
|
||||||
condition: service_healthy
|
|
||||||
honcho-redis:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
honcho-db:
|
|
||||||
image: pgvector/pgvector:pg15
|
|
||||||
container_name: honcho-db
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "127.0.0.1:5432:5432"
|
|
||||||
command: ["postgres", "-c", "max_connections=200"]
|
|
||||||
environment:
|
|
||||||
- POSTGRES_DB=honcho
|
|
||||||
- POSTGRES_USER=honcho
|
|
||||||
- POSTGRES_PASSWORD=honcho_pass
|
|
||||||
- PGDATA=/var/lib/postgresql/data/pgdata
|
|
||||||
volumes:
|
|
||||||
- /mnt/HoardingCow_docker_data/Honcho/postgres:/var/lib/postgresql/data
|
|
||||||
- ./honcho/init-db.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
||||||
networks:
|
|
||||||
- ai_backend
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U honcho -d honcho"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
honcho-redis:
|
|
||||||
image: redis:8
|
|
||||||
container_name: honcho-redis
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "127.0.0.1:6379:6379"
|
|
||||||
volumes:
|
|
||||||
- /mnt/HoardingCow_docker_data/Honcho/redis:/data
|
|
||||||
networks:
|
|
||||||
- ai_backend
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "redis-cli ping"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
ai_net:
|
ai_net:
|
||||||
external: true
|
external: true
|
||||||
|
|||||||
154
ai/hermes-workspace/entrypoint-combined.sh
Executable file
154
ai/hermes-workspace/entrypoint-combined.sh
Executable file
@@ -0,0 +1,154 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ── Hermes Workspace Combined Entrypoint ──
|
||||||
|
# Waits for the Hermes gateway container (hermes:8642) to become healthy,
|
||||||
|
# then starts the Hermes Workspace web UI in the foreground.
|
||||||
|
# Supports graceful shutdown via SIGTERM/SIGINT.
|
||||||
|
# ──────────────────────────────────────────
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# ── Configuration ──────────────────────────────────────────────
|
||||||
|
GATEWAY_HOST="${GATEWAY_HOST:-hermes}"
|
||||||
|
GATEWAY_PORT="${GATEWAY_PORT:-8642}"
|
||||||
|
GATEWAY_URL="http://${GATEWAY_HOST}:${GATEWAY_PORT}"
|
||||||
|
|
||||||
|
HEALTH_ENDPOINT="${HEALTH_ENDPOINT:-/health}"
|
||||||
|
MAX_RETRIES="${HEALTH_MAX_RETRIES:-60}"
|
||||||
|
RETRY_INTERVAL="${HEALTH_RETRY_INTERVAL:-2}"
|
||||||
|
|
||||||
|
WORKSPACE_DIR="${WORKSPACE_DIR:-/workspace}"
|
||||||
|
WORKSPACE_ENTRY="${WORKSPACE_ENTRY:-server-entry.js}"
|
||||||
|
|
||||||
|
PID_FILE="${PID_FILE:-/tmp/workspace.pid}"
|
||||||
|
|
||||||
|
# ── Logging ────────────────────────────────────────────────────
|
||||||
|
log_info() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] [INFO] $*"; }
|
||||||
|
log_warn() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] [WARN] $*"; }
|
||||||
|
log_error() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] [ERROR] $*"; }
|
||||||
|
|
||||||
|
# ── Graceful Shutdown ──────────────────────────────────────────
|
||||||
|
_workspace_pid=""
|
||||||
|
_shutting_down=false
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
if [ "$_shutting_down" = true ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
_shutting_down=true
|
||||||
|
|
||||||
|
log_info "Shutdown signal received, cleaning up..."
|
||||||
|
|
||||||
|
# Stop workspace process if running
|
||||||
|
if [ -n "$_workspace_pid" ] && kill -0 "$_workspace_pid" 2>/dev/null; then
|
||||||
|
log_info "Stopping workspace (PID: $_workspace_pid)..."
|
||||||
|
kill -TERM "$_workspace_pid" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Give it time to shut down gracefully
|
||||||
|
local wait_sec=10
|
||||||
|
while kill -0 "$_workspace_pid" 2>/dev/null && [ "$wait_sec" -gt 0 ]; do
|
||||||
|
sleep 1
|
||||||
|
wait_sec=$((wait_sec - 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Force kill if still running
|
||||||
|
if kill -0 "$_workspace_pid" 2>/dev/null; then
|
||||||
|
log_warn "Workspace did not shut down gracefully, force killing..."
|
||||||
|
kill -KILL "$_workspace_pid" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up PID file
|
||||||
|
[ -f "$PID_FILE" ] && rm -f "$PID_FILE"
|
||||||
|
|
||||||
|
log_info "Shutdown complete."
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Trap termination signals for graceful shutdown
|
||||||
|
trap cleanup SIGTERM SIGINT
|
||||||
|
|
||||||
|
# ── Gateway Health Check ───────────────────────────────────────
|
||||||
|
wait_for_gateway() {
|
||||||
|
local url="${GATEWAY_URL}${HEALTH_ENDPOINT}"
|
||||||
|
local retries="$MAX_RETRIES"
|
||||||
|
local interval="$RETRY_INTERVAL"
|
||||||
|
local attempt=0
|
||||||
|
|
||||||
|
log_info "Waiting for Hermes gateway at ${GATEWAY_URL}..."
|
||||||
|
log_info "Max retries: ${retries}, interval: ${interval}s"
|
||||||
|
|
||||||
|
while [ "$attempt" -lt "$retries" ]; do
|
||||||
|
attempt=$((attempt + 1))
|
||||||
|
|
||||||
|
if curl -fsS "${url}" >/dev/null 2>&1; then
|
||||||
|
log_info "Gateway is healthy after ${attempt} attempt(s) (${GATEWAY_URL})"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$attempt" -lt "$retries" ]; then
|
||||||
|
log_info "Gateway not ready yet (attempt ${attempt}/${retries}), retrying in ${interval}s..."
|
||||||
|
sleep "$interval"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
log_error "Gateway did not become healthy after ${retries} attempts ($((retries * interval))s)"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Workspace Startup ──────────────────────────────────────────
|
||||||
|
start_workspace() {
|
||||||
|
local entry="${WORKSPACE_DIR}/${WORKSPACE_ENTRY}"
|
||||||
|
|
||||||
|
if [ ! -d "$WORKSPACE_DIR" ]; then
|
||||||
|
log_error "Workspace directory not found: ${WORKSPACE_DIR}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$entry" ]; then
|
||||||
|
log_error "Workspace entry point not found: ${entry}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_info "Starting Hermes Workspace web UI..."
|
||||||
|
log_info " Directory: ${WORKSPACE_DIR}"
|
||||||
|
log_info " Entry: ${entry}"
|
||||||
|
|
||||||
|
cd "$WORKSPACE_DIR"
|
||||||
|
|
||||||
|
# Start workspace in background so we can trap signals
|
||||||
|
node --max-old-space-size=2048 "${entry}" &
|
||||||
|
_workspace_pid=$!
|
||||||
|
echo "$_workspace_pid" > "$PID_FILE"
|
||||||
|
|
||||||
|
log_info "Workspace started (PID: ${_workspace_pid})"
|
||||||
|
|
||||||
|
# Wait for workspace process
|
||||||
|
wait "$_workspace_pid"
|
||||||
|
local exit_code=$?
|
||||||
|
|
||||||
|
log_info "Workspace exited with code ${exit_code}"
|
||||||
|
return "$exit_code"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Main ───────────────────────────────────────────────────────
|
||||||
|
main() {
|
||||||
|
log_info "=== Hermes Workspace Combined Entrypoint ==="
|
||||||
|
log_info "Gateway: ${GATEWAY_URL}"
|
||||||
|
log_info "Workspace: ${WORKSPACE_DIR}/${WORKSPACE_ENTRY}"
|
||||||
|
log_info "PID file: ${PID_FILE}"
|
||||||
|
|
||||||
|
# Wait for gateway to be healthy
|
||||||
|
if ! wait_for_gateway; then
|
||||||
|
log_warn "Proceeding without confirmed gateway health..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start the workspace
|
||||||
|
start_workspace
|
||||||
|
local exit_code=$?
|
||||||
|
|
||||||
|
log_info "Entrypoint exiting with code ${exit_code}"
|
||||||
|
return "$exit_code"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run main; exit with its return code
|
||||||
|
main "$@"
|
||||||
@@ -48,14 +48,6 @@ RUN apt-get update && \
|
|||||||
# ---------- UV ----------
|
# ---------- UV ----------
|
||||||
COPY --chmod=0755 --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/
|
COPY --chmod=0755 --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/
|
||||||
|
|
||||||
WORKDIR /opt/hermes
|
|
||||||
|
|
||||||
# ---------- Memory provider dependencies ----------
|
|
||||||
# httpx: HTTP client for OpenViking plugin
|
|
||||||
# honcho-ai: already installed in upstream image (v2.1.1+)
|
|
||||||
RUN . /opt/hermes/.venv/bin/activate && \
|
|
||||||
uv pip install --no-cache-dir httpx
|
|
||||||
|
|
||||||
# ---------- Piper TTS ----------
|
# ---------- Piper TTS ----------
|
||||||
RUN . /opt/hermes/.venv/bin/activate && \
|
RUN . /opt/hermes/.venv/bin/activate && \
|
||||||
uv pip install --no-cache-dir piper-tts sounddevice numpy && \
|
uv pip install --no-cache-dir piper-tts sounddevice numpy && \
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# build stage — fetches and builds Honcho from source
|
|
||||||
# Using buildkit cache mounts for speed across rebuilds
|
|
||||||
FROM python:3.13-slim-bookworm AS builder
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends git && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:0.9.24 /uv /bin/uv
|
|
||||||
|
|
||||||
# Clone Honcho at a pinned commit for reproducibility
|
|
||||||
ARG HONCHO_REPO=https://github.com/plastic-labs/honcho
|
|
||||||
ARG HONCHO_REF=main
|
|
||||||
RUN git clone --depth 1 --branch ${HONCHO_REF} ${HONCHO_REPO} /app
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
ENV UV_COMPILE_BYTECODE=1
|
|
||||||
ENV UV_LINK_MODE=copy
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
||||||
uv sync --frozen --no-group dev
|
|
||||||
|
|
||||||
# --- runtime stage ---
|
|
||||||
FROM python:3.13-slim-bookworm
|
|
||||||
|
|
||||||
RUN groupadd --system app && \
|
|
||||||
useradd --system --gid app --create-home app
|
|
||||||
|
|
||||||
COPY --from=builder /app /app
|
|
||||||
COPY --from=builder /root/.cache/uv /root/.cache/uv
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
|
||||||
ENV HOME=/app
|
|
||||||
|
|
||||||
COPY --chown=app:app config.toml /app/config.toml
|
|
||||||
|
|
||||||
USER app
|
|
||||||
EXPOSE 8000
|
|
||||||
|
|
||||||
CMD ["fastapi", "run", "--host", "0.0.0.0", "src/main.py"]
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
[app]
|
|
||||||
LOG_LEVEL = "INFO"
|
|
||||||
MAX_MESSAGE_SIZE = 25000
|
|
||||||
EMBED_MESSAGES = true
|
|
||||||
NAMESPACE = "honcho"
|
|
||||||
|
|
||||||
[db]
|
|
||||||
CONNECTION_URI = "postgresql+psycopg://honcho:honcho_pass@honcho-db:5432/honcho"
|
|
||||||
SCHEMA = "public"
|
|
||||||
POOL_SIZE = 10
|
|
||||||
MAX_OVERFLOW = 20
|
|
||||||
|
|
||||||
[auth]
|
|
||||||
USE_AUTH = false
|
|
||||||
|
|
||||||
[sentry]
|
|
||||||
ENABLED = false
|
|
||||||
|
|
||||||
[telemetry]
|
|
||||||
ENABLED = false
|
|
||||||
|
|
||||||
[webhook]
|
|
||||||
ENABLED = false
|
|
||||||
|
|
||||||
[cache]
|
|
||||||
ENABLED = true
|
|
||||||
URL = "redis://honcho-redis:6379/0"
|
|
||||||
|
|
||||||
[llm]
|
|
||||||
DEFAULT_MAX_TOKENS = 4096
|
|
||||||
|
|
||||||
# Embeddings via Ollama (nomic-embed-text recommended on this system)
|
|
||||||
[embedding]
|
|
||||||
VECTOR_DIMENSIONS = 768
|
|
||||||
MAX_INPUT_TOKENS = 8192
|
|
||||||
|
|
||||||
[embedding.model_config]
|
|
||||||
transport = "openai"
|
|
||||||
model = "nomic-embed-text"
|
|
||||||
base_url = "http://ollama:11434/v1"
|
|
||||||
|
|
||||||
# --- Deriver (user representation builder) ---
|
|
||||||
[deriver]
|
|
||||||
ENABLED = true
|
|
||||||
WORKERS = 1
|
|
||||||
POLLING_SLEEP_INTERVAL_SECONDS = 5.0
|
|
||||||
FLUSH_ENABLED = true
|
|
||||||
|
|
||||||
[deriver.model_config]
|
|
||||||
transport = "openai"
|
|
||||||
model = "hermes-3"
|
|
||||||
base_url = "http://ollama:11434/v1"
|
|
||||||
|
|
||||||
# --- Dialectic ---
|
|
||||||
[dialectic]
|
|
||||||
MAX_INPUT_TOKENS = 4096
|
|
||||||
SESSION_HISTORY_MAX_TOKENS = 8192
|
|
||||||
|
|
||||||
[dialectic.levels.minimal]
|
|
||||||
MAX_TOOL_ITERATIONS = 1
|
|
||||||
MAX_OUTPUT_TOKENS = 512
|
|
||||||
[dialectic.levels.minimal.model_config]
|
|
||||||
transport = "openai"
|
|
||||||
model = "hermes-3"
|
|
||||||
base_url = "http://ollama:11434/v1"
|
|
||||||
|
|
||||||
[dialectic.levels.low]
|
|
||||||
MAX_TOOL_ITERATIONS = 3
|
|
||||||
[dialectic.levels.low.model_config]
|
|
||||||
transport = "openai"
|
|
||||||
model = "hermes-3"
|
|
||||||
base_url = "http://ollama:11434/v1"
|
|
||||||
|
|
||||||
[dialectic.levels.medium]
|
|
||||||
MAX_TOOL_ITERATIONS = 2
|
|
||||||
[dialectic.levels.medium.model_config]
|
|
||||||
transport = "openai"
|
|
||||||
model = "hermes-3"
|
|
||||||
base_url = "http://ollama:11434/v1"
|
|
||||||
|
|
||||||
[dialectic.levels.high]
|
|
||||||
MAX_TOOL_ITERATIONS = 4
|
|
||||||
[dialectic.levels.high.model_config]
|
|
||||||
transport = "openai"
|
|
||||||
model = "hermes-3"
|
|
||||||
base_url = "http://ollama:11434/v1"
|
|
||||||
|
|
||||||
[dialectic.levels.max]
|
|
||||||
MAX_TOOL_ITERATIONS = 10
|
|
||||||
[dialectic.levels.max.model_config]
|
|
||||||
transport = "openai"
|
|
||||||
model = "hermes-3"
|
|
||||||
base_url = "http://ollama:11434/v1"
|
|
||||||
|
|
||||||
# --- Summary ---
|
|
||||||
[summary]
|
|
||||||
ENABLED = true
|
|
||||||
MESSAGES_PER_SHORT_SUMMARY = 20
|
|
||||||
MESSAGES_PER_LONG_SUMMARY = 60
|
|
||||||
|
|
||||||
[summary.model_config]
|
|
||||||
transport = "openai"
|
|
||||||
model = "hermes-3"
|
|
||||||
base_url = "http://ollama:11434/v1"
|
|
||||||
|
|
||||||
# --- Dream ---
|
|
||||||
[dream]
|
|
||||||
ENABLED = false
|
|
||||||
|
|
||||||
# --- Peer Card ---
|
|
||||||
[peer_card]
|
|
||||||
ENABLED = true
|
|
||||||
|
|
||||||
# --- Vector Store ---
|
|
||||||
[vector_store]
|
|
||||||
TYPE = "pgvector"
|
|
||||||
DIMENSIONS = 768
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
CREATE EXTENSION IF NOT EXISTS vector;
|
|
||||||
Reference in New Issue
Block a user