mtrx-cli 0.1.4 → 0.1.6

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.4",
3
+ "version": "0.1.6",
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.4"
1
+ __version__ = "0.1.6"
@@ -221,7 +221,16 @@ def codex_auth_path() -> Path:
221
221
 
222
222
  def claude_oauth_available() -> bool:
223
223
  token = read_claude_oauth_token()
224
- return bool(token)
224
+ if token:
225
+ return True
226
+ state = _read_claude_app_state()
227
+ oauth_account = state.get("oauthAccount")
228
+ if not isinstance(oauth_account, dict):
229
+ return False
230
+ return bool(
231
+ (oauth_account.get("accountUuid") or "").strip()
232
+ or (oauth_account.get("emailAddress") or "").strip()
233
+ )
225
234
 
226
235
 
227
236
  def read_claude_oauth_token() -> str | None:
@@ -500,6 +509,7 @@ def _build_claude_env(
500
509
  env_b64 = base64.b64encode(json.dumps(env_snap).encode()).decode() if env_snap else ""
501
510
  custom_headers = "\n".join(
502
511
  [
512
+ f"x-matrx-key: {mx_key}",
503
513
  "x-matrx-agent-id: claude-cli",
504
514
  "x-matrx-provider: claude_code",
505
515
  f"x-matrx-session-id: {session_id}",
@@ -263,11 +263,13 @@ def _complete_codex_login() -> None:
263
263
 
264
264
 
265
265
  def _complete_claude_login(state: dict) -> tuple[dict, bool]:
266
- token = (read_claude_oauth_token() or "").strip()
267
- if token:
266
+ imported = (state.get("auth", {}).get("claude_code", {}).get("oauth_token") or "").strip()
267
+ if imported or claude_oauth_available():
268
268
  return state, False
269
269
  if not _is_interactive_terminal():
270
- raise ValueError("Claude login required. Run: claude auth login")
270
+ raise ValueError(
271
+ "Claude login required. Run: claude auth login"
272
+ )
271
273
 
272
274
  print("Claude login required.")
273
275
  if not _prompt_yes_no("Run `claude auth login` now?", default=True):
@@ -275,8 +277,7 @@ def _complete_claude_login(state: dict) -> tuple[dict, bool]:
275
277
 
276
278
  executable = find_executable("claude") or "claude"
277
279
  result = subprocess.run([executable, "auth", "login"], check=False)
278
- token = (read_claude_oauth_token() or "").strip()
279
- if result.returncode != 0 or not token:
280
+ if result.returncode != 0 or not claude_oauth_available():
280
281
  raise ValueError("Claude login did not complete successfully")
281
282
 
282
283
  return state, False
@@ -310,7 +311,11 @@ def _cmd_login(args) -> int:
310
311
  token = read_claude_oauth_token()
311
312
  if not token:
312
313
  print(
313
- f"No Claude OAuth token found at {claude_credentials_path()}",
314
+ (
315
+ f"No Claude OAuth token found at {claude_credentials_path()}. "
316
+ "If your Claude install no longer writes that file, use the browser-based "
317
+ "`mtrx claude` flow instead, or run `claude setup-token` and import that token."
318
+ ),
314
319
  file=sys.stderr,
315
320
  )
316
321
  return 1