Skip to content

Commit 4bab47a

Browse files
aamirrasheedclaude
andcommitted
feat: support confai provider key (forward-compat for ca-api confai rename)
Adds confai as the highest-priority provider key lookup in the InferenceProvider check and info gateway_ip extraction. Falls back to confidential (legacy) then lunal (oldest). Bumps version to v1.5.9. Extends smoke tests to cover all three provider keys and the missing-key fallback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f523621 commit 4bab47a

2 files changed

Lines changed: 40 additions & 5 deletions

File tree

ccvm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e
55
# TEE verification and management for confidential compute VMs.
66
# https://github.com/lunal-dev/confidential-cvm-cli
77

8-
VERSION="v1.5.8"
8+
VERSION="v1.5.9"
99

1010
ATTEST_DIR="/etc/privateclaw"
1111
EVIDENCE_FILE="$ATTEST_DIR/evidence.json"
@@ -383,12 +383,12 @@ cmd_verify() {
383383
FAIL_COUNT=$((FAIL_COUNT + 1))
384384
echo ""
385385
else
386-
# Try "confidential" provider first, fall back to legacy "lunal" for older configs
387-
ENDPOINT=$(jq -r '.models.providers.confidential.baseUrl // .models.providers.lunal.baseUrl // "not configured"' "$OC_CONFIG" 2>/dev/null || echo "not configured")
386+
# Try "confai" provider first (new name), fall back to "confidential" (legacy), then "lunal" (oldest)
387+
ENDPOINT=$(jq -r '.models.providers.confai.baseUrl // .models.providers.confidential.baseUrl // .models.providers.lunal.baseUrl // "not configured"' "$OC_CONFIG" 2>/dev/null || echo "not configured")
388388
[ "$VERBOSE" = "true" ] && echo " Endpoint: $ENDPOINT"
389389

390390
# Read bearer token from openclaw config (apiKey field)
391-
BEARER_TOKEN=$(jq -r '.models.providers.confidential.apiKey // .models.providers.lunal.apiKey // empty' "$OC_CONFIG" 2>/dev/null || true)
391+
BEARER_TOKEN=$(jq -r '.models.providers.confai.apiKey // .models.providers.confidential.apiKey // .models.providers.lunal.apiKey // empty' "$OC_CONFIG" 2>/dev/null || true)
392392

393393
# Make a minimal request to the inference endpoint and capture response headers
394394
INF_HEADERS=""
@@ -957,7 +957,7 @@ cmd_info() {
957957
local gateway_ip="not found"
958958
local openclaw_conf="$HOME/.openclaw/openclaw.json"
959959
if [ -f "$openclaw_conf" ] && command -v jq &>/dev/null; then
960-
gateway_ip=$(jq -r '.models.providers.confidential.baseUrl // empty' "$openclaw_conf" 2>/dev/null \
960+
gateway_ip=$(jq -r '.models.providers.confai.baseUrl // .models.providers.confidential.baseUrl // empty' "$openclaw_conf" 2>/dev/null \
961961
| sed 's|https://||; s|http://||' \
962962
| cut -d: -f1 \
963963
| cut -d/ -f1)

tests/smoke.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,39 @@ if ! grep -q "^ccvm:" <<<"$compat_info_output"; then
3535
exit 1
3636
fi
3737

38+
# Test InferenceProvider jq queries resolve correctly for all three provider keys
39+
tmp_oc=$(mktemp)
40+
trap 'rm -f "$tmp_oc"' EXIT
41+
42+
# confai key (new, highest priority)
43+
printf '{"models":{"providers":{"confai":{"baseUrl":"https://confai.example.com","apiKey":"tok-confai"}}}}' > "$tmp_oc"
44+
got_endpoint=$(jq -r '.models.providers.confai.baseUrl // .models.providers.confidential.baseUrl // .models.providers.lunal.baseUrl // "not configured"' "$tmp_oc")
45+
got_apikey=$(jq -r '.models.providers.confai.apiKey // .models.providers.confidential.apiKey // .models.providers.lunal.apiKey // empty' "$tmp_oc")
46+
if [ "$got_endpoint" != "https://confai.example.com" ] || [ "$got_apikey" != "tok-confai" ]; then
47+
echo "FAIL: confai provider key not resolved (endpoint=$got_endpoint apikey=$got_apikey)" >&2; exit 1
48+
fi
49+
50+
# confidential key (legacy fallback #1)
51+
printf '{"models":{"providers":{"confidential":{"baseUrl":"https://conf.example.com","apiKey":"tok-conf"}}}}' > "$tmp_oc"
52+
got_endpoint=$(jq -r '.models.providers.confai.baseUrl // .models.providers.confidential.baseUrl // .models.providers.lunal.baseUrl // "not configured"' "$tmp_oc")
53+
got_apikey=$(jq -r '.models.providers.confai.apiKey // .models.providers.confidential.apiKey // .models.providers.lunal.apiKey // empty' "$tmp_oc")
54+
if [ "$got_endpoint" != "https://conf.example.com" ] || [ "$got_apikey" != "tok-conf" ]; then
55+
echo "FAIL: confidential provider key not resolved (endpoint=$got_endpoint apikey=$got_apikey)" >&2; exit 1
56+
fi
57+
58+
# lunal key (legacy fallback #2)
59+
printf '{"models":{"providers":{"lunal":{"baseUrl":"https://lunal.example.com","apiKey":"tok-lunal"}}}}' > "$tmp_oc"
60+
got_endpoint=$(jq -r '.models.providers.confai.baseUrl // .models.providers.confidential.baseUrl // .models.providers.lunal.baseUrl // "not configured"' "$tmp_oc")
61+
got_apikey=$(jq -r '.models.providers.confai.apiKey // .models.providers.confidential.apiKey // .models.providers.lunal.apiKey // empty' "$tmp_oc")
62+
if [ "$got_endpoint" != "https://lunal.example.com" ] || [ "$got_apikey" != "tok-lunal" ]; then
63+
echo "FAIL: lunal provider key not resolved (endpoint=$got_endpoint apikey=$got_apikey)" >&2; exit 1
64+
fi
65+
66+
# no matching key → "not configured"
67+
printf '{"models":{"providers":{}}}' > "$tmp_oc"
68+
got_endpoint=$(jq -r '.models.providers.confai.baseUrl // .models.providers.confidential.baseUrl // .models.providers.lunal.baseUrl // "not configured"' "$tmp_oc")
69+
if [ "$got_endpoint" != "not configured" ]; then
70+
echo "FAIL: missing provider key should return 'not configured' (got: $got_endpoint)" >&2; exit 1
71+
fi
72+
3873
echo "smoke tests passed"

0 commit comments

Comments
 (0)