feat(eltex): add ai-eltex launcher for corporate LLM proxy
ai-eltex runs Claude Code through the Eltex LiteLLM proxy (http://llm.eltex.loc:4000, team GLM subscription). The personal key from admins is checked via /v1/models and stored in ~/.config/ai-setup/eltex_key; the model is taken from the key's allowed list (ELTEX_MODEL / ELTEX_BASE_URL override). The proxy ignores effort/thinking, so no effort forcing. /logout-eltex and /logout in ai-eltex drop the key; setup.sh status shows it. ru-bypass: hosts block now has an end marker and only that block is rewritten, manual entries outside it survive; llm.eltex.loc/llm2 added since the VPN DNS does not resolve it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,8 @@ fail() { echo "[FAIL] $1"; FAIL=$((FAIL+1)); }
|
||||
GPT_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-gpt"/,/^GPTEOF/' "$SCRIPT")
|
||||
KIMI_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-kimi"/,/^KIMIEOF/' "$SCRIPT")
|
||||
GLM_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-glm"/,/^GLMEOF/' "$SCRIPT")
|
||||
ELTEX_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-eltex"/,/^ELTEXEOF/' "$SCRIPT")
|
||||
LOGOUT_HOOK="$(cd "$(dirname "$0")/.." && pwd)/home-configs/claude/hooks/logout-account-hook.sh"
|
||||
GEMINI_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-gemini"/,/^GEMINIEOF/' "$SCRIPT")
|
||||
OPENCODE_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-opencode"/,/^OPENCODEEOF/' "$SCRIPT")
|
||||
CURSOR_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-cursor"/,/^CURSOREOF/' "$SCRIPT")
|
||||
@@ -104,6 +106,46 @@ test_glm_official_api() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ── ai-eltex: Claude Code через корпоративный прокси Eltex ─────────────────
|
||||
test_eltex_claude_launcher() {
|
||||
if echo "$ELTEX_SECTION" | grep -q 'claude --dangerously-skip-permissions' \
|
||||
&& echo "$ELTEX_SECTION" | grep -q 'ELTEX_BASE_URL:-http://llm.eltex.loc:4000' \
|
||||
&& echo "$ELTEX_SECTION" | grep -q 'ANTHROPIC_BASE_URL="$eltex_base_url"' \
|
||||
&& echo "$ELTEX_SECTION" | grep -q 'CLAUDE_CONFIG_DIR="$HOME/.config/ai-setup/cfg/eltex"' \
|
||||
&& echo "$ELTEX_SECTION" | grep -q 'key_file="$HOME/.config/ai-setup/eltex_key"'; then
|
||||
ok "ai-eltex: launches claude via llm.eltex.loc with its own key and config dir"
|
||||
else
|
||||
fail "ai-eltex: must launch claude via llm.eltex.loc with eltex_key and cfg/eltex"
|
||||
fi
|
||||
}
|
||||
|
||||
# ── ai-eltex: модель берётся из /v1/models ключа ──────────────────────────
|
||||
test_eltex_model_from_key() {
|
||||
if echo "$ELTEX_SECTION" | grep -q '/v1/models' \
|
||||
&& echo "$ELTEX_SECTION" | grep -q 'model="${ELTEX_MODEL:-}"' \
|
||||
&& echo "$ELTEX_SECTION" | grep -q 'ANTHROPIC_DEFAULT_OPUS_MODEL="$model"' \
|
||||
&& echo "$ELTEX_SECTION" | grep -q 'ANTHROPIC_DEFAULT_HAIKU_MODEL="$model"'; then
|
||||
ok "ai-eltex: model resolved from the key's /v1/models (ELTEX_MODEL overrides)"
|
||||
else
|
||||
fail "ai-eltex: model must come from /v1/models or ELTEX_MODEL"
|
||||
fi
|
||||
}
|
||||
|
||||
# ── logout hook: /logout-eltex удаляет eltex_key ──────────────────────────
|
||||
test_logout_eltex() {
|
||||
local tmp_home rc=0
|
||||
tmp_home=$(mktemp -d)
|
||||
mkdir -p "$tmp_home/.config/ai-setup"
|
||||
echo "sk-test" > "$tmp_home/.config/ai-setup/eltex_key"
|
||||
echo '{"prompt":"/logout"}' | HOME="$tmp_home" AI_LAUNCHER=eltex bash "$LOGOUT_HOOK" 2>/dev/null || rc=$?
|
||||
if [ "$rc" -eq 2 ] && [ ! -f "$tmp_home/.config/ai-setup/eltex_key" ]; then
|
||||
ok "logout hook: /logout in ai-eltex removes eltex_key"
|
||||
else
|
||||
fail "logout hook: /logout in ai-eltex must remove eltex_key (rc=$rc)"
|
||||
fi
|
||||
rm -rf "$tmp_home"
|
||||
}
|
||||
|
||||
# ── ai-glm: default effort is xhigh (still overridable via AI_EFFORT) ─────
|
||||
test_glm_default_effort() {
|
||||
if echo "$GLM_SECTION" | grep -q -- '--effort "${AI_EFFORT:-xhigh}"' \
|
||||
@@ -312,6 +354,9 @@ test_kimi_no_artemox
|
||||
test_glm_claude_launcher
|
||||
test_glm_official_api
|
||||
test_glm_default_effort
|
||||
test_eltex_claude_launcher
|
||||
test_eltex_model_from_key
|
||||
test_logout_eltex
|
||||
test_gemini_native_launcher
|
||||
test_cursor_native_launcher
|
||||
test_global_rules_source_installed
|
||||
|
||||
Reference in New Issue
Block a user