@weave-os/router 0.2.27 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/install.sh +25 -27
  2. package/package.json +1 -1
package/install.sh CHANGED
@@ -2683,33 +2683,29 @@ toggle_claude() {
2683
2683
  case "$mode" in
2684
2684
  status)
2685
2685
  local on_hint="on --claude"
2686
- [ "$proj" = "true" ] && on_hint="on --claude --scope project"
2687
- if [ "$parked_present" = "true" ]; then
2688
- ok "Claude Code: ${C_BOLD}off${C_RESET} — routing directly to Anthropic. Run '$on_hint' to re-enable."
2689
- elif [ "$proj" = "true" ]; then
2690
- local_base="$(json_get "$local_settings_file" '.env.ANTHROPIC_BASE_URL')"
2691
- if [ -n "$local_base" ] && ! router_shaped_url "$local_base"; then
2692
- ok "Claude Code (project): ${C_BOLD}off${C_RESET} — routing directly to Anthropic. Run '$on_hint' to re-enable."
2693
- elif router_shaped_url "$committed_base"; then
2694
- # Router URL is committed, but it only authenticates if this teammate's
2695
- # settings.local.json carries the key header. A fresh clone (shared
2696
- # settings.json, no personal local file) has the URL but no key.
2697
- if claude_key_present "$local_settings_file"; then
2698
- ok "Claude Code (project): ${C_BOLD}on${C_RESET} — routing through $committed_base."
2699
- else
2700
- warn "Claude Code (project): router URL is set but your personal router key is missing (no settings.local.json) — requests won't authenticate. Run the installer to add your key."
2701
- fi
2702
- else
2703
- info "Claude Code (project): not configured for the router. Run the installer first."
2686
+ local effective_base="$committed_base" key_settings_file="$settings_file" status_label="Claude Code"
2687
+ [ "$scope" = "project" ] && on_hint="on --claude --scope project"
2688
+ if [ "$scope" = "project" ]; then
2689
+ status_label="Claude Code (project)"
2690
+ if [ -f "$local_settings_file" ] && jq -e '.env | has("ANTHROPIC_BASE_URL")' "$local_settings_file" >/dev/null 2>&1; then
2691
+ effective_base="$(json_get "$local_settings_file" '.env.ANTHROPIC_BASE_URL')"
2692
+ fi
2693
+ if [ -f "$local_settings_file" ] && jq -e '.env | has("ANTHROPIC_CUSTOM_HEADERS")' "$local_settings_file" >/dev/null 2>&1; then
2694
+ key_settings_file="$local_settings_file"
2704
2695
  fi
2705
- elif router_shaped_url "$committed_base"; then
2706
- if claude_key_present "$settings_file"; then
2707
- ok "Claude Code: ${C_BOLD}on${C_RESET} — routing through $committed_base."
2696
+ fi
2697
+ if router_shaped_url "$effective_base"; then
2698
+ if claude_key_present "$key_settings_file"; then
2699
+ ok "$status_label: ${C_BOLD}on${C_RESET} in saved settings — endpoint $effective_base."
2708
2700
  else
2709
- warn "Claude Code: router URL is set but the router key header is missing — requests won't authenticate. Run the installer to restore it."
2701
+ warn "$status_label: router key header is missing from active settings — Weave-key authentication is not configured; other authentication methods are not checked."
2710
2702
  fi
2703
+ elif [ "$parked_present" = "true" ]; then
2704
+ ok "Claude Code: ${C_BOLD}off${C_RESET} in saved settings — direct to Anthropic. Run '$on_hint' to re-enable."
2705
+ elif [ -n "$effective_base" ]; then
2706
+ ok "$status_label: ${C_BOLD}off${C_RESET} in saved settings — direct to Anthropic. Run '$on_hint' to re-enable."
2711
2707
  else
2712
- info "Claude Code: not configured for the router. Run the installer first."
2708
+ info "$status_label: not configured for the router in this scope."
2713
2709
  fi
2714
2710
  ;;
2715
2711
  off)
@@ -3567,7 +3563,7 @@ run_login() {
3567
3563
  }
3568
3564
 
3569
3565
  run_router_status() {
3570
- local saved_target claude_endpoint codex_endpoint redacted_key
3566
+ local saved_target codex_endpoint redacted_key
3571
3567
  saved_target="$target"
3572
3568
  settings_dir="$settings_base/.claude"
3573
3569
  settings_file="$settings_dir/settings.json"
@@ -3577,7 +3573,6 @@ run_router_status() {
3577
3573
  local_settings_file=""
3578
3574
  fi
3579
3575
  codex_config_file="$settings_base/.codex/config.toml"
3580
- target="claude"; claude_endpoint="$(resolve_installed_endpoint)"
3581
3576
  target="codex"; codex_endpoint="$(resolve_installed_endpoint)"
3582
3577
  target="$saved_target"
3583
3578
  if [ "${#api_key}" -gt 8 ]; then
@@ -3587,11 +3582,14 @@ run_router_status() {
3587
3582
  fi
3588
3583
  printf 'Router: %s\nIdentity: %s\n' "$base_url" "$redacted_key"
3589
3584
  if models_api GET "/validate"; then
3590
- printf 'Connectivity: connected\n'
3585
+ printf 'Connectivity: connected (API key accepted; inference not verified)\n'
3591
3586
  else
3592
3587
  printf 'Connectivity: unavailable (HTTP %s)\n' "${models_http_status:-network error}"
3593
3588
  fi
3594
- printf 'Claude Code: %s\n' "$(if [ "${claude_endpoint%/}" = "${base_url%/}" ]; then printf 'points at Router'; elif [ -n "$claude_endpoint" ]; then printf 'different endpoint (%s)' "$claude_endpoint"; else printf 'not configured'; fi)"
3589
+ printf 'Claude Code settings: %s (scope: %s)\n' "$settings_dir" "$scope"
3590
+ # Administrative lookup includes parked credentials; routing status must not.
3591
+ toggle_claude
3592
+ printf 'Status describes this scope only, not a running session; other scopes or runtime overrides may differ. Restart Claude Code after on/off changes.\n'
3595
3593
  printf 'Codex: %s\n' "$(if [ "${codex_endpoint%/}" = "${base_url%/}" ]; then printf 'points at Router'; elif [ -n "$codex_endpoint" ]; then printf 'different endpoint (%s)' "$codex_endpoint"; else printf 'not configured'; fi)"
3596
3594
  if models_api GET "/v1/subscriptions/accounts"; then
3597
3595
  printf 'Subscription accounts:\n'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weave-os/router",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "description": "One-command installer that points Claude Code, Codex, opencode, or pi at the Weave Router. For pi it also ships the routing extension, loaded via pi.extensions.",
5
5
  "bin": {
6
6
  "weave-router": "bin.js",