diff --git a/kiloclaw/Dockerfile b/kiloclaw/Dockerfile index 49b8daad51..70f1857064 100644 --- a/kiloclaw/Dockerfile +++ b/kiloclaw/Dockerfile @@ -58,7 +58,7 @@ RUN npm install -g github:Kilo-Org/openclaw-channel-streamchat#catrielmuller/att RUN npm install -g @steipete/summarize@0.12.0 # Install Kilo CLI (agentic coding assistant for the terminal) -RUN npm install -g @kilocode/cli@7.0.46 +RUN npm install -g @kilocode/cli@7.1.13 # Install Go (available at runtime for users to `go install` additional tools) ENV GO_VERSION=1.26.0 diff --git a/kiloclaw/Dockerfile.local b/kiloclaw/Dockerfile.local index aec68d3005..d32324c6e7 100644 --- a/kiloclaw/Dockerfile.local +++ b/kiloclaw/Dockerfile.local @@ -59,7 +59,7 @@ RUN npm install -g github:Kilo-Org/openclaw-channel-streamchat#catrielmuller/att RUN npm install -g @steipete/summarize@0.12.0 # Install Kilo CLI (agentic coding assistant for the terminal) -RUN npm install -g @kilocode/cli@7.0.46 +RUN npm install -g @kilocode/cli@7.1.13 # Install Go (available at runtime for users to `go install` additional tools) ENV GO_VERSION=1.26.0 diff --git a/kiloclaw/controller/src/index.ts b/kiloclaw/controller/src/index.ts index 1ddfdc5910..8814b067cb 100644 --- a/kiloclaw/controller/src/index.ts +++ b/kiloclaw/controller/src/index.ts @@ -1,4 +1,5 @@ import http from 'node:http'; +import { execFile } from 'node:child_process'; import { Duplex, Readable } from 'node:stream'; import { Hono } from 'hono'; import { @@ -416,6 +417,27 @@ export async function startController(env: NodeJS.ProcessEnv = process.env): Pro console.log( `[controller] Ready version=${CONTROLLER_VERSION} commit=${CONTROLLER_COMMIT} requireProxyToken=${config.requireProxyToken} wsIdleTimeoutMs=${config.wsIdleTimeoutMs} wsHandshakeTimeoutMs=${config.wsHandshakeTimeoutMs} maxWsConnections=${config.maxWsConnections}` ); + + // ── Background: upgrade Kilo CLI ──────────────────────────────────── + // The Docker image bakes in a pinned version; this upgrades to the + // latest release in the background so the instance always has the + // newest CLI without requiring an image rebuild. + if (env.KILOCLAW_KILO_CLI === 'true') { + // Strip NPM_CONFIG_PREFIX so the install overwrites the system-wide + // binary in /usr/local/bin instead of writing to the per-user prefix. + const upgradeEnv = { ...process.env }; + delete upgradeEnv.NPM_CONFIG_PREFIX; + execFile('npm', ['install', '-g', '@kilocode/cli@latest'], { env: upgradeEnv }, err => { + if (err) { + console.warn( + '[kilo-cli] Background upgrade failed (using baked-in version):', + err.message + ); + } else { + console.log('[kilo-cli] Upgraded to latest version'); + } + }); + } } catch (err) { const fullError = err instanceof Error ? err.message : String(err); controllerState.current = { state: 'degraded', error: toPublicDegradedError('gateway-start') };