diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 58c21826..6011ceed 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,10 +1,10 @@ { - "name": "Hermes-CodeSpace", + "name": "Hermes-Coding-Agent", "customizations": { "vscode": { "extensions": ["saoudrizwan.claude-dev","joaompfp.hermes-ai-agent"] } }, - "postCreateCommand": "bash ./.devcontainer/post-create-cmd.sh", - "postStartCommand": "bash echo '[post-start-cmd.sh] Container started' >> /tmp/post-start-cmd.log" -} \ No newline at end of file + "postCreateCommand": "bash ./.devcontainer/post-create-cmd.sh > /tmp/post-create-cmd.log", + "postStartCommand": "bash ./.devcontainer/post-start-cmd.sh > /tmp/post-start-cmd.log" +} diff --git a/.devcontainer/post-create-cmd.sh b/.devcontainer/post-create-cmd.sh index ea966f51..46d764ea 100755 --- a/.devcontainer/post-create-cmd.sh +++ b/.devcontainer/post-create-cmd.sh @@ -2,18 +2,36 @@ # Install modelrelay globally sudo npm install modelrelay -g --prefix /usr/local/lib/modelrelay -sudo ln -s /usr/local/lib/modelrelay/bin/modelrelay /usr/local/bin/modelrelay +sudo ln -sf /usr/local/lib/modelrelay/bin/modelrelay /usr/local/bin/modelrelay sudo npm cache clean --force -echo "[post-create-cmd.sh] Starting modelrelay in the background..." +echo "[post-create-cmd.sh] Checking modelrelay..." if command -v modelrelay &>/dev/null; then - setsid /usr/local/bin/modelrelay >> /tmp/modelrelay.log 2>&1 & + if pgrep -f modelrelay > /dev/null; then + echo "[post-create-cmd.sh] modelrelay is already running, skipping" + else + echo "[post-create-cmd.sh] Starting modelrelay in the background..." + setsid /usr/local/bin/modelrelay >> /tmp/modelrelay.log 2>&1 & + fi else echo "[post-create-cmd.sh] modelrelay not found, skipping start" fi +# Install ripgrep for better search performance in hermes-agent +if ! command -v rg &>/dev/null; then + echo "[post-create-cmd.sh] Installing ripgrep for better search performance in hermes-agent..." + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Linux + cd /tmp + curl -LO https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep_14.1.1-1_amd64.deb + sudo dpkg -i ripgrep_14.1.1-1_amd64.deb + rm ripgrep_14.1.1-1_amd64.deb + fi +fi + # Install hermes-agent -curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash -s -- --skip-setup +HERMES_VERSION="v2026.5.7" +curl -fsSL "https://raw.githubusercontent.com/NousResearch/hermes-agent/${HERMES_VERSION}/scripts/install.sh" | bash -s -- --skip-setup npm cache clean --force sudo rm -rf /var/lib/apt/lists/* @@ -24,4 +42,3 @@ if command -v hermes &>/dev/null && [ -d "$HOME/.hermes/sessions" ] && [ -z "$(l hermes config set model.base_url http://localhost:7352/v1 hermes config set model.default auto-fastest fi - diff --git a/.devcontainer/post-start-cmd.sh b/.devcontainer/post-start-cmd.sh new file mode 100755 index 00000000..9598af78 --- /dev/null +++ b/.devcontainer/post-start-cmd.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +echo "[post-start-cmd.sh] Checking modelrelay..." +if command -v modelrelay &>/dev/null; then + if pgrep -f modelrelay > /dev/null; then + echo "[post-start-cmd.sh] modelrelay is already running, skipping" + else + echo "[post-start-cmd.sh] Starting modelrelay in the background..." + setsid /usr/local/bin/modelrelay >> /tmp/modelrelay.log 2>&1 & + fi +else + echo "[post-start-cmd.sh] modelrelay not found, skipping start" +fi + +# so that the script doesn't exit immediately before modelrelay has a chance to start properly +sleep 60 \ No newline at end of file