From 2605465e7ea71ac41ea63c266bd19caed9d032e9 Mon Sep 17 00:00:00 2001 From: Clawdie Operator Date: Thu, 4 Jun 2026 11:21:40 +0000 Subject: [PATCH] Enable DeepSeek cache warming + HTTP/2 compression (v0.9.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three improvements for DeepSeek API cost/performance: 1. Daemon cache warming: export DEEPSEEK_API_KEY, COLIBRI_CACHE_WARMING=true, COLIBRI_CACHE_WARMING_INTERVAL_HOURS=6 in rc.d prestart. Keeps DeepSeek prefix cache warm across sessions (~3,500 free tokens/request). 2. pi HTTP/2: change allowH2:false → true in http-dispatcher.js after npm install. Enables HPACK header compression and multiplexing for API calls (Node 24 + undici 8.3 handle this correctly). 3. Live verification: cache warming triggered and confirmed cache HIT with 3,584 hit tokens on first warm cycle. Tested: daemon restart, cache warming log, CLI status confirms enabled. --- build.sh | 10 ++++++++++ scripts/stage-colibri-iso.sh | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/build.sh b/build.sh index 88fcb820..bd8ead03 100755 --- a/build.sh +++ b/build.sh @@ -902,6 +902,16 @@ install_live_npm_globals() { echo "ERROR: /opt/clawdie/npm-global ownership is ${_npm_owner}, expected clawdie:clawdie" exit 1 fi + + # Fix pi HTTP/2: the bundled http-dispatcher sets allowH2:false to + # work around a Node 26.0 undici decompression bug. We run Node 24 + # with undici 8.3, where H2 works correctly. Enabling HTTP/2 gives + # HPACK header compression and multiplexing for API calls. + _pi_dispatcher="${_live_prefix}/lib/node_modules/@earendil-works/pi-coding-agent/dist/core/http-dispatcher.js" + if [ -f "${_pi_dispatcher}" ]; then + sed -i '' 's/allowH2: false/allowH2: true/' "${_pi_dispatcher}" + echo " pi http-dispatcher: allowH2 → true" + fi } seed_live_ai_source_repo() { diff --git a/scripts/stage-colibri-iso.sh b/scripts/stage-colibri-iso.sh index 8b0ddce0..acd9d9b2 100755 --- a/scripts/stage-colibri-iso.sh +++ b/scripts/stage-colibri-iso.sh @@ -103,6 +103,15 @@ sed -i '' '/socket ready/a\ chmod 644 "${pidfile}" 2>/dev/null || true' \ "${RC_DIR}/colibri_daemon" +# Add DeepSeek API key and cache warming to daemon environment. +# These are injected into the rc.d prestart so the daemon picks them up +# without needing a separate config file. +sed -i '' '/export COLIBRI_COST_MODE/a\ + export DEEPSEEK_API_KEY="${DEEPSEEK_API_KEY:-}"\ + export COLIBRI_CACHE_WARMING="true"\ + export COLIBRI_CACHE_WARMING_INTERVAL_HOURS="6"' \ + "${RC_DIR}/colibri_daemon" + cat > "${ETC_DIR}/rc.conf.sample" <