onex-cli 1.10.2__tar.gz → 1.10.3__tar.gz

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 (98) hide show
  1. {onex_cli-1.10.2/onex_cli.egg-info → onex_cli-1.10.3}/PKG-INFO +1 -1
  2. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/__init__.py +1 -1
  3. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/mcp/server.py +82 -44
  4. {onex_cli-1.10.2 → onex_cli-1.10.3/onex_cli.egg-info}/PKG-INFO +1 -1
  5. {onex_cli-1.10.2 → onex_cli-1.10.3}/CHANGELOG.md +0 -0
  6. {onex_cli-1.10.2 → onex_cli-1.10.3}/LICENSE +0 -0
  7. {onex_cli-1.10.2 → onex_cli-1.10.3}/MANIFEST.in +0 -0
  8. {onex_cli-1.10.2 → onex_cli-1.10.3}/README.md +0 -0
  9. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/__main__.py +0 -0
  10. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/__init__.py +0 -0
  11. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/create.py +0 -0
  12. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/create_e2e.py +0 -0
  13. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/debug.py +0 -0
  14. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/deploy.py +0 -0
  15. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/dev.py +0 -0
  16. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/env.py +0 -0
  17. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/es.py +0 -0
  18. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/init.py +0 -0
  19. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/invoke.py +0 -0
  20. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/login.py +0 -0
  21. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/logout.py +0 -0
  22. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/logs.py +0 -0
  23. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/mcp.py +0 -0
  24. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/platform.py +0 -0
  25. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/provision.py +0 -0
  26. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/reload.py +0 -0
  27. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/replay.py +0 -0
  28. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/status.py +0 -0
  29. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/switch.py +0 -0
  30. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/test.py +0 -0
  31. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/trace.py +0 -0
  32. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/undeploy.py +0 -0
  33. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/validate.py +0 -0
  34. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/commands/vpn.py +0 -0
  35. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/config.py +0 -0
  36. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/mcp/__init__.py +0 -0
  37. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/mcp/tools/__init__.py +0 -0
  38. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/runtime/__init__.py +0 -0
  39. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/runtime/local_runtime.py +0 -0
  40. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/schema/__init__.py +0 -0
  41. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/schema/service_descriptor.py +0 -0
  42. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/schema/validator.py +0 -0
  43. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/README.md.j2 +0 -0
  44. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/__init__.py.j2 +0 -0
  45. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/service.yml.j2 +0 -0
  46. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/src/__init__.py.j2 +0 -0
  47. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/src/apis/__init__.py.j2 +0 -0
  48. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/src/models/__init__.py.j2 +0 -0
  49. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/src/models/schemas.py.j2 +0 -0
  50. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/src/repositories/__init__.py.j2 +0 -0
  51. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/crud-service/src/services/__init__.py.j2 +0 -0
  52. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/e2e/data_service.yml.j2 +0 -0
  53. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/e2e/test_service_e2e.py.j2 +0 -0
  54. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/event-driven/README.md.j2 +0 -0
  55. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/event-driven/__init__.py.j2 +0 -0
  56. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/event-driven/service.yml.j2 +0 -0
  57. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/event-driven/src/__init__.py.j2 +0 -0
  58. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/event-driven/src/triggers/__init__.py.j2 +0 -0
  59. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/event-driven/src/triggers/events.py.j2 +0 -0
  60. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/event-driven/src/triggers/schedules.py.j2 +0 -0
  61. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-minimal/README.md.j2 +0 -0
  62. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-minimal/go.mod.j2 +0 -0
  63. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-minimal/main.go.j2 +0 -0
  64. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-minimal/service.yml.j2 +0 -0
  65. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-rest-api/README.md.j2 +0 -0
  66. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-rest-api/go.mod.j2 +0 -0
  67. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-rest-api/handlers/items.go.j2 +0 -0
  68. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-rest-api/main.go.j2 +0 -0
  69. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/go-rest-api/service.yml.j2 +0 -0
  70. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/minimal/README.md.j2 +0 -0
  71. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/minimal/__init__.py.j2 +0 -0
  72. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/minimal/service.yml.j2 +0 -0
  73. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/minimal/src/__init__.py.j2 +0 -0
  74. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/minimal/src/apis/__init__.py.j2 +0 -0
  75. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/minimal/src/apis/hello.py.j2 +0 -0
  76. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/rest-api/README.md.j2 +0 -0
  77. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/rest-api/__init__.py.j2 +0 -0
  78. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/rest-api/service.yml.j2 +0 -0
  79. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/rest-api/src/__init__.py.j2 +0 -0
  80. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/rest-api/src/apis/__init__.py.j2 +0 -0
  81. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/templates/rest-api/src/apis/handlers.py.j2 +0 -0
  82. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/utils/__init__.py +0 -0
  83. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/utils/auth.py +0 -0
  84. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/utils/crypto.py +0 -0
  85. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/utils/email.py +0 -0
  86. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/utils/helpers.py +0 -0
  87. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/vpn/__init__.py +0 -0
  88. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/vpn/platform_detector.py +0 -0
  89. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/vpn/setup_vpn.py +0 -0
  90. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex/vpn/wireguard_manager.py +0 -0
  91. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex_cli.egg-info/SOURCES.txt +0 -0
  92. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex_cli.egg-info/dependency_links.txt +0 -0
  93. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex_cli.egg-info/entry_points.txt +0 -0
  94. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex_cli.egg-info/requires.txt +0 -0
  95. {onex_cli-1.10.2 → onex_cli-1.10.3}/onex_cli.egg-info/top_level.txt +0 -0
  96. {onex_cli-1.10.2 → onex_cli-1.10.3}/setup.cfg +0 -0
  97. {onex_cli-1.10.2 → onex_cli-1.10.3}/setup.py +0 -0
  98. {onex_cli-1.10.2 → onex_cli-1.10.3}/tests/test_mcp_logs_e2e.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onex-cli
3
- Version: 1.10.2
3
+ Version: 1.10.3
4
4
  Summary: Official CLI for deploying and managing services on OneXEOS Platform (Windows, macOS, Linux)
5
5
  Home-page: https://github.com/onexeos/onex-cli
6
6
  Author: OneXEOS Platform Team
@@ -1,2 +1,2 @@
1
1
  # OneXEOS Services CLI
2
- __version__ = "1.10.2"
2
+ __version__ = "1.10.3"
@@ -425,45 +425,88 @@ async def onex_trace(
425
425
  platform_url = _get_platform_url(env)
426
426
 
427
427
  try:
428
- # Retry once on 503 (Loki transiently unavailable) or timeout
429
- resp = None
430
- for attempt in range(2):
431
- try:
432
- resp = await _authenticated_request(
433
- 'get',
434
- f"{platform_url}/_internal/trace/{trace_id}",
435
- env,
436
- timeout=15
437
- )
438
- if resp.status_code != 503 or attempt == 1:
439
- break
440
- import asyncio
441
- await asyncio.sleep(2)
442
- except httpx.TimeoutException:
443
- if attempt == 1:
444
- return f"Request timed out connecting to {platform_url} after retries"
445
- import asyncio
446
- await asyncio.sleep(2)
447
-
448
- if resp is None:
449
- return f"Request timed out connecting to {platform_url}"
428
+ # Query Loki directly bypasses gateway auth and its internal Loki timeout
429
+ from urllib.parse import urlparse
430
+ parsed = urlparse(platform_url)
431
+ loki_url = f"http://{parsed.hostname}:3100"
450
432
 
451
- if resp.status_code == 200:
452
- data = resp.json()
453
- if json_output:
454
- return json.dumps(data, indent=2)
433
+ from datetime import datetime, timedelta
434
+ now = datetime.now()
435
+ start_ns = int((now - timedelta(hours=24)).timestamp() * 1e9)
436
+ end_ns = int(now.timestamp() * 1e9)
437
+ query = f'{{trace_id="{trace_id}"}}'
455
438
 
456
- timeline = data.get('timeline', [])
457
- total_logs = data.get('total_logs', 0)
439
+ async with httpx.AsyncClient(timeout=10) as client:
440
+ resp = await client.get(
441
+ f"{loki_url}/loki/api/v1/query_range",
442
+ params={
443
+ 'query': query,
444
+ 'start': str(start_ns),
445
+ 'end': str(end_ns),
446
+ 'limit': 1000
447
+ }
448
+ )
458
449
 
459
- if total_logs == 0:
460
- return (
461
- f"No logs found for trace_id: {trace_id}\n"
462
- "This could mean:\n"
463
- " - Request hasn't been processed yet\n"
464
- " - Trace_id is incorrect\n"
465
- " - Logs have expired (older than 24 hours)"
466
- )
450
+ if resp.status_code != 200:
451
+ return f"Loki query failed: HTTP {resp.status_code}"
452
+
453
+ loki_data = resp.json()
454
+ if loki_data.get('status') != 'success':
455
+ return f"Loki query failed: {loki_data}"
456
+
457
+ # Parse Loki results into timeline format
458
+ results = loki_data.get('data', {}).get('result', [])
459
+ timeline = []
460
+ for result in results:
461
+ stream = result.get('stream', {})
462
+ for value in result.get('values', []):
463
+ timestamp_ns, log_line = value
464
+ try:
465
+ log_data = json.loads(log_line)
466
+ except Exception:
467
+ log_data = {'message': log_line}
468
+
469
+ component = stream.get('component') or stream.get('service') or log_data.get('service') or 'unknown'
470
+ log_event = stream.get('log_event') or stream.get('event', '')
471
+ method = stream.get('method', log_data.get('method', ''))
472
+ path = stream.get('path', log_data.get('path', ''))
473
+ message = log_data.get('message', log_line)
474
+ status_code = log_data.get('status_code')
475
+ duration_ms = log_data.get('duration_ms') or log_data.get('execution_time_ms')
476
+ error = log_data.get('error')
477
+ if not error and message and ' | ' in message:
478
+ error = message.split(' | ', 1)[1]
479
+
480
+ timeline.append({
481
+ 'timestamp': int(timestamp_ns) // 1000000,
482
+ 'component': component,
483
+ 'level': stream.get('level', log_data.get('level', 'INFO')).upper(),
484
+ 'event': log_data.get('event', log_event),
485
+ 'message': message,
486
+ 'method': method,
487
+ 'path': path,
488
+ 'status_code': status_code,
489
+ 'duration_ms': duration_ms,
490
+ 'error': error,
491
+ 'data': log_data,
492
+ })
493
+
494
+ timeline.sort(key=lambda x: x['timestamp'])
495
+ total_logs = len(timeline)
496
+
497
+ data = {'trace_id': trace_id, 'total_logs': total_logs, 'timeline': timeline}
498
+
499
+ if json_output:
500
+ return json.dumps(data, indent=2)
501
+
502
+ if total_logs == 0:
503
+ return (
504
+ f"No logs found for trace_id: {trace_id}\n"
505
+ "This could mean:\n"
506
+ " - Request hasn't been processed yet\n"
507
+ " - Trace_id is incorrect\n"
508
+ " - Logs have expired (older than 24 hours)"
509
+ )
467
510
 
468
511
  # Extract request metadata from first/last logs
469
512
  req_method = ''
@@ -590,15 +633,10 @@ async def onex_trace(
590
633
 
591
634
  return "\n".join(lines)
592
635
 
593
- elif resp.status_code == 401:
594
- return f"Authentication failed. Run: onex login --env {env}"
595
- elif resp.status_code == 503:
596
- return "Loki service unavailable. Make sure observability stack is running."
597
- else:
598
- return f"Failed to query trace: HTTP {resp.status_code}"
599
-
600
636
  except httpx.ConnectError:
601
- return f"Cannot connect to platform at {platform_url}. Make sure platform is running."
637
+ return f"Cannot connect to Loki at {loki_url}. Make sure observability stack is running."
638
+ except httpx.TimeoutException:
639
+ return f"Loki query timed out at {loki_url}. Loki may be overloaded."
602
640
  except Exception as e:
603
641
  return f"Error querying trace: {e}"
604
642
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onex-cli
3
- Version: 1.10.2
3
+ Version: 1.10.3
4
4
  Summary: Official CLI for deploying and managing services on OneXEOS Platform (Windows, macOS, Linux)
5
5
  Home-page: https://github.com/onexeos/onex-cli
6
6
  Author: OneXEOS Platform Team
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes