mtrx-cli 0.1.6 → 0.1.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtrx-cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "MATRX CLI for routing Codex and Claude through Matrx",
5
5
  "homepage": "https://mtrx.so",
6
6
  "repository": {
@@ -1 +1 @@
1
- __version__ = "0.1.6"
1
+ __version__ = "0.1.7"
@@ -170,13 +170,6 @@ def prepare_routed_setup(
170
170
  changed = True
171
171
  if route == "matrx" and _persist_workspace_binding_from_env(state, env):
172
172
  changed = True
173
- if route == "matrx" and tool == "claude":
174
- mx_key, _ = _resolve_matrx_route_key(state, env)
175
- if _approve_claude_custom_api_key(mx_key):
176
- changed = True
177
- if _sync_claude_subscription_to_matrx(state, env):
178
- changed = True
179
-
180
173
  if _sync_tool_route_config(state, tool=tool, route=route):
181
174
  changed = True
182
175
 
@@ -500,8 +493,8 @@ def _build_claude_env(
500
493
  env.pop("MATRX_CLAUDE_MODE", None)
501
494
  env["MATRX_BASE_URL"] = proxy_root
502
495
  env["MATRX_API_KEY"] = mx_key
503
- env["ANTHROPIC_BASE_URL"] = proxy_base
504
- env["ANTHROPIC_API_KEY"] = mx_key
496
+ env["ANTHROPIC_BASE_URL"] = proxy_root
497
+ env.pop("ANTHROPIC_API_KEY", None)
505
498
  group_id, project_id = _resolve_matrx_context_overrides(state, env)
506
499
  session_id = str(uuid.uuid4())
507
500
  # Evolutionary scaffolding: env snapshot for AI context injection
@@ -568,7 +561,7 @@ def _validate_claude_launch_plan(plan: LaunchPlan, state: dict) -> None:
568
561
  return
569
562
 
570
563
  base_url = (plan.env.get("ANTHROPIC_BASE_URL") or "").strip()
571
- expected_base_url = ensure_v1_url(state.get("auth", {}).get("matrx", {}).get("base_url"))
564
+ expected_base_url = ensure_root_url(state.get("auth", {}).get("matrx", {}).get("base_url"))
572
565
  if not base_url:
573
566
  raise ValueError("Claude Matrx route is missing ANTHROPIC_BASE_URL")
574
567
  if base_url != expected_base_url:
@@ -581,14 +574,12 @@ def _validate_claude_launch_plan(plan: LaunchPlan, state: dict) -> None:
581
574
  if not mx_key.startswith("mx_"):
582
575
  raise ValueError("Claude Matrx route is missing a valid MATRX_API_KEY")
583
576
 
584
- anthropic_key = (plan.env.get("ANTHROPIC_API_KEY") or "").strip()
585
- if anthropic_key != mx_key:
586
- raise ValueError("Claude Matrx route must set ANTHROPIC_API_KEY to the same mx_ key as MATRX_API_KEY")
587
-
588
577
  custom_headers = (plan.env.get("ANTHROPIC_CUSTOM_HEADERS") or "").strip()
589
578
  if not custom_headers:
590
579
  raise ValueError("Claude Matrx route is missing ANTHROPIC_CUSTOM_HEADERS")
591
580
  lowered_headers = custom_headers.lower()
581
+ if "x-matrx-key:" not in lowered_headers:
582
+ raise ValueError("Claude Matrx route is missing ANTHROPIC_CUSTOM_HEADERS with X-Matrx-Key")
592
583
  if "x-matrx-session-id:" not in lowered_headers:
593
584
  raise ValueError("Claude Matrx route is missing ANTHROPIC_CUSTOM_HEADERS with X-Matrx-Session-Id")
594
585
  if "x-matrx-provider: claude_code" not in lowered_headers:
@@ -598,6 +589,8 @@ def _validate_claude_launch_plan(plan: LaunchPlan, state: dict) -> None:
598
589
 
599
590
  if plan.env.get("ANTHROPIC_AUTH_TOKEN"):
600
591
  raise ValueError("Claude Matrx route should not set ANTHROPIC_AUTH_TOKEN")
592
+ if plan.env.get("ANTHROPIC_API_KEY"):
593
+ raise ValueError("Claude Matrx route should not set ANTHROPIC_API_KEY")
601
594
 
602
595
 
603
596
  def _validate_codex_launch_plan(plan: LaunchPlan, state: dict) -> None:
@@ -647,15 +640,14 @@ def describe_launch_plan(plan: LaunchPlan, state: dict) -> list[str]:
647
640
  ]
648
641
 
649
642
  if plan.tool == "claude":
650
- base_url = ensure_v1_url(state.get("auth", {}).get("matrx", {}).get("base_url"))
643
+ base_url = ensure_root_url(state.get("auth", {}).get("matrx", {}).get("base_url"))
651
644
  custom_headers = (plan.env.get("ANTHROPIC_CUSTOM_HEADERS") or "").strip()
652
- anthropic_key = (plan.env.get("ANTHROPIC_API_KEY") or "").strip()
653
645
  return [
654
646
  "Launching claude via Matrx",
655
647
  f" base_url: {base_url or DEFAULT_MATRX_BASE_URL}",
656
648
  f" auth_source: {plan.auth_source}",
657
649
  f" custom_headers_present: {bool(custom_headers)}",
658
- f" proxy_key_present: {anthropic_key.startswith('mx_')}",
650
+ f" proxy_key_present: {'x-matrx-key:' in custom_headers.lower()}",
659
651
  f" subscription_token_available: {bool(_resolve_claude_subscription_token(state))}",
660
652
  " runtime_route: env injection",
661
653
  " persistent_route: disabled",
@@ -263,8 +263,7 @@ def _complete_codex_login() -> None:
263
263
 
264
264
 
265
265
  def _complete_claude_login(state: dict) -> tuple[dict, bool]:
266
- imported = (state.get("auth", {}).get("claude_code", {}).get("oauth_token") or "").strip()
267
- if imported or claude_oauth_available():
266
+ if claude_oauth_available():
268
267
  return state, False
269
268
  if not _is_interactive_terminal():
270
269
  raise ValueError(