mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:30:45 +00:00
fix: harden OpenCode ACP bind dispatch
This commit is contained in:
@@ -31,8 +31,9 @@ openclaw_live_acp_bind_resolve_auth_provider() {
|
||||
claude) printf '%s\n' "claude-cli" ;;
|
||||
codex) printf '%s\n' "codex-cli" ;;
|
||||
gemini) printf '%s\n' "google-gemini-cli" ;;
|
||||
opencode) printf '%s\n' "opencode" ;;
|
||||
*)
|
||||
echo "Unsupported OPENCLAW_LIVE_ACP_BIND agent: ${1:-} (expected claude, codex, or gemini)" >&2
|
||||
echo "Unsupported OPENCLAW_LIVE_ACP_BIND agent: ${1:-} (expected claude, codex, gemini, or opencode)" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
@@ -43,6 +44,7 @@ openclaw_live_acp_bind_resolve_agent_command() {
|
||||
claude) printf '%s' "${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND_CLAUDE:-${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND:-}}" ;;
|
||||
codex) printf '%s' "${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND_CODEX:-${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND:-}}" ;;
|
||||
gemini) printf '%s' "${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND_GEMINI:-${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND:-}}" ;;
|
||||
opencode) printf '%s' "${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND_OPENCODE:-${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND:-}}" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
@@ -157,6 +159,14 @@ WRAP
|
||||
npm install -g @google/gemini-cli
|
||||
fi
|
||||
;;
|
||||
opencode)
|
||||
if [ ! -x "$NPM_CONFIG_PREFIX/bin/opencode" ]; then
|
||||
npm install -g opencode-ai
|
||||
fi
|
||||
export OPENCODE_CONFIG_CONTENT="$(
|
||||
node -e 'process.stdout.write(JSON.stringify({model: process.env.OPENCLAW_LIVE_ACP_BIND_OPENCODE_MODEL || "opencode/kimi-k2.6"}))'
|
||||
)"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported OPENCLAW_LIVE_ACP_BIND_AGENT: $agent" >&2
|
||||
exit 1
|
||||
@@ -187,7 +197,7 @@ for token in "${ACP_AGENT_TOKENS[@]}"; do
|
||||
done
|
||||
|
||||
if ((${#ACP_AGENTS[@]} == 0)); then
|
||||
echo "No ACP bind agents selected. Use OPENCLAW_LIVE_ACP_BIND_AGENTS=claude,codex,gemini." >&2
|
||||
echo "No ACP bind agents selected. Use OPENCLAW_LIVE_ACP_BIND_AGENTS=claude,codex,gemini,opencode." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -274,6 +284,9 @@ for ACP_AGENT in "${ACP_AGENTS[@]}"; do
|
||||
-e GEMINI_API_KEY \
|
||||
-e GOOGLE_API_KEY \
|
||||
-e OPENAI_API_KEY \
|
||||
-e OPENCODE_API_KEY \
|
||||
-e OPENCODE_ZEN_API_KEY \
|
||||
-e OPENCODE_CONFIG_CONTENT \
|
||||
-e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
|
||||
-e HOME=/home/node \
|
||||
-e NODE_OPTIONS=--disable-warning=ExperimentalWarning \
|
||||
@@ -286,6 +299,7 @@ for ACP_AGENT in "${ACP_AGENTS[@]}"; do
|
||||
-e OPENCLAW_LIVE_TEST=1 \
|
||||
-e OPENCLAW_LIVE_ACP_BIND=1 \
|
||||
-e OPENCLAW_LIVE_ACP_BIND_AGENT="$ACP_AGENT" \
|
||||
-e OPENCLAW_LIVE_ACP_BIND_OPENCODE_MODEL="${OPENCLAW_LIVE_ACP_BIND_OPENCODE_MODEL:-opencode/kimi-k2.6}" \
|
||||
-e OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND="$AGENT_COMMAND")
|
||||
openclaw_live_append_array DOCKER_RUN_ARGS DOCKER_HOME_MOUNT
|
||||
DOCKER_RUN_ARGS+=(\
|
||||
|
||||
Reference in New Issue
Block a user