skypilot-nightly 1.0.0.dev20251203__py3-none-any.whl → 1.0.0.dev20251210__py3-none-any.whl

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 (136) hide show
  1. sky/__init__.py +4 -2
  2. sky/adaptors/aws.py +1 -61
  3. sky/adaptors/slurm.py +478 -0
  4. sky/backends/backend_utils.py +45 -4
  5. sky/backends/cloud_vm_ray_backend.py +32 -33
  6. sky/backends/task_codegen.py +340 -2
  7. sky/catalog/__init__.py +0 -3
  8. sky/catalog/kubernetes_catalog.py +12 -4
  9. sky/catalog/slurm_catalog.py +243 -0
  10. sky/check.py +14 -3
  11. sky/client/cli/command.py +329 -22
  12. sky/client/sdk.py +56 -2
  13. sky/clouds/__init__.py +2 -0
  14. sky/clouds/cloud.py +7 -0
  15. sky/clouds/slurm.py +578 -0
  16. sky/clouds/ssh.py +2 -1
  17. sky/clouds/vast.py +10 -0
  18. sky/core.py +128 -36
  19. sky/dashboard/out/404.html +1 -1
  20. sky/dashboard/out/_next/static/KYAhEFa3FTfq4JyKVgo-s/_buildManifest.js +1 -0
  21. sky/dashboard/out/_next/static/chunks/3294.ddda8c6c6f9f24dc.js +1 -0
  22. sky/dashboard/out/_next/static/chunks/3850-fd5696f3bbbaddae.js +1 -0
  23. sky/dashboard/out/_next/static/chunks/6856-da20c5fd999f319c.js +1 -0
  24. sky/dashboard/out/_next/static/chunks/6990-09cbf02d3cd518c3.js +1 -0
  25. sky/dashboard/out/_next/static/chunks/9353-8369df1cf105221c.js +1 -0
  26. sky/dashboard/out/_next/static/chunks/pages/_app-68b647e26f9d2793.js +34 -0
  27. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-33f525539665fdfd.js +16 -0
  28. sky/dashboard/out/_next/static/chunks/pages/clusters/{[cluster]-abfcac9c137aa543.js → [cluster]-a7565f586ef86467.js} +1 -1
  29. sky/dashboard/out/_next/static/chunks/pages/{clusters-ee39056f9851a3ff.js → clusters-9e5d47818b9bdadd.js} +1 -1
  30. sky/dashboard/out/_next/static/chunks/pages/{config-dfb9bf07b13045f4.js → config-718cdc365de82689.js} +1 -1
  31. sky/dashboard/out/_next/static/chunks/pages/infra/{[context]-c0b5935149902e6f.js → [context]-12c559ec4d81fdbd.js} +1 -1
  32. sky/dashboard/out/_next/static/chunks/pages/{infra-aed0ea19df7cf961.js → infra-d187cd0413d72475.js} +1 -1
  33. sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-895847b6cf200b04.js +16 -0
  34. sky/dashboard/out/_next/static/chunks/pages/jobs/pools/{[pool]-9faf940b253e3e06.js → [pool]-8d0f4655400b4eb9.js} +2 -2
  35. sky/dashboard/out/_next/static/chunks/pages/{jobs-2072b48b617989c9.js → jobs-e5a98f17f8513a96.js} +1 -1
  36. sky/dashboard/out/_next/static/chunks/pages/plugins/[...slug]-4f46050ca065d8f8.js +1 -0
  37. sky/dashboard/out/_next/static/chunks/pages/{users-f42674164aa73423.js → users-2f7646eb77785a2c.js} +1 -1
  38. sky/dashboard/out/_next/static/chunks/pages/{volumes-b84b948ff357c43e.js → volumes-ef19d49c6d0e8500.js} +1 -1
  39. sky/dashboard/out/_next/static/chunks/pages/workspaces/{[name]-84a40f8c7c627fe4.js → [name]-96e0f298308da7e2.js} +1 -1
  40. sky/dashboard/out/_next/static/chunks/pages/{workspaces-531b2f8c4bf89f82.js → workspaces-cb4da3abe08ebf19.js} +1 -1
  41. sky/dashboard/out/_next/static/chunks/{webpack-64e05f17bf2cf8ce.js → webpack-fba3de387ff6bb08.js} +1 -1
  42. sky/dashboard/out/_next/static/css/c5a4cfd2600fc715.css +3 -0
  43. sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
  44. sky/dashboard/out/clusters/[cluster].html +1 -1
  45. sky/dashboard/out/clusters.html +1 -1
  46. sky/dashboard/out/config.html +1 -1
  47. sky/dashboard/out/index.html +1 -1
  48. sky/dashboard/out/infra/[context].html +1 -1
  49. sky/dashboard/out/infra.html +1 -1
  50. sky/dashboard/out/jobs/[job].html +1 -1
  51. sky/dashboard/out/jobs/pools/[pool].html +1 -1
  52. sky/dashboard/out/jobs.html +1 -1
  53. sky/dashboard/out/plugins/[...slug].html +1 -0
  54. sky/dashboard/out/users.html +1 -1
  55. sky/dashboard/out/volumes.html +1 -1
  56. sky/dashboard/out/workspace/new.html +1 -1
  57. sky/dashboard/out/workspaces/[name].html +1 -1
  58. sky/dashboard/out/workspaces.html +1 -1
  59. sky/data/mounting_utils.py +16 -2
  60. sky/global_user_state.py +3 -3
  61. sky/models.py +2 -0
  62. sky/optimizer.py +6 -5
  63. sky/provision/__init__.py +1 -0
  64. sky/provision/common.py +20 -0
  65. sky/provision/docker_utils.py +15 -2
  66. sky/provision/kubernetes/utils.py +42 -6
  67. sky/provision/provisioner.py +15 -6
  68. sky/provision/slurm/__init__.py +12 -0
  69. sky/provision/slurm/config.py +13 -0
  70. sky/provision/slurm/instance.py +572 -0
  71. sky/provision/slurm/utils.py +583 -0
  72. sky/provision/vast/instance.py +4 -1
  73. sky/provision/vast/utils.py +10 -6
  74. sky/serve/server/impl.py +1 -1
  75. sky/server/constants.py +1 -1
  76. sky/server/plugins.py +222 -0
  77. sky/server/requests/executor.py +5 -2
  78. sky/server/requests/payloads.py +12 -1
  79. sky/server/requests/request_names.py +2 -0
  80. sky/server/requests/requests.py +5 -1
  81. sky/server/requests/serializers/encoders.py +17 -0
  82. sky/server/requests/serializers/return_value_serializers.py +60 -0
  83. sky/server/server.py +78 -8
  84. sky/server/server_utils.py +30 -0
  85. sky/setup_files/dependencies.py +2 -0
  86. sky/skylet/attempt_skylet.py +13 -3
  87. sky/skylet/constants.py +34 -9
  88. sky/skylet/events.py +10 -4
  89. sky/skylet/executor/__init__.py +1 -0
  90. sky/skylet/executor/slurm.py +189 -0
  91. sky/skylet/job_lib.py +2 -1
  92. sky/skylet/log_lib.py +22 -6
  93. sky/skylet/log_lib.pyi +8 -6
  94. sky/skylet/skylet.py +5 -1
  95. sky/skylet/subprocess_daemon.py +2 -1
  96. sky/ssh_node_pools/constants.py +12 -0
  97. sky/ssh_node_pools/core.py +40 -3
  98. sky/ssh_node_pools/deploy/__init__.py +4 -0
  99. sky/{utils/kubernetes/deploy_ssh_node_pools.py → ssh_node_pools/deploy/deploy.py} +279 -504
  100. sky/ssh_node_pools/deploy/tunnel_utils.py +199 -0
  101. sky/ssh_node_pools/deploy/utils.py +173 -0
  102. sky/ssh_node_pools/server.py +11 -13
  103. sky/{utils/kubernetes/ssh_utils.py → ssh_node_pools/utils.py} +9 -6
  104. sky/templates/kubernetes-ray.yml.j2 +8 -0
  105. sky/templates/slurm-ray.yml.j2 +85 -0
  106. sky/templates/vast-ray.yml.j2 +1 -0
  107. sky/users/model.conf +1 -1
  108. sky/users/permission.py +24 -1
  109. sky/users/rbac.py +31 -3
  110. sky/utils/annotations.py +108 -8
  111. sky/utils/command_runner.py +197 -5
  112. sky/utils/command_runner.pyi +27 -4
  113. sky/utils/common_utils.py +18 -3
  114. sky/utils/kubernetes/kubernetes_deploy_utils.py +2 -94
  115. sky/utils/kubernetes/ssh-tunnel.sh +7 -376
  116. sky/utils/schemas.py +31 -0
  117. {skypilot_nightly-1.0.0.dev20251203.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/METADATA +48 -36
  118. {skypilot_nightly-1.0.0.dev20251203.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/RECORD +125 -107
  119. sky/dashboard/out/_next/static/96_E2yl3QAiIJGOYCkSpB/_buildManifest.js +0 -1
  120. sky/dashboard/out/_next/static/chunks/3294.20a8540fe697d5ee.js +0 -1
  121. sky/dashboard/out/_next/static/chunks/3850-ff4a9a69d978632b.js +0 -1
  122. sky/dashboard/out/_next/static/chunks/6856-8f27d1c10c98def8.js +0 -1
  123. sky/dashboard/out/_next/static/chunks/6990-9146207c4567fdfd.js +0 -1
  124. sky/dashboard/out/_next/static/chunks/9353-cff34f7e773b2e2b.js +0 -1
  125. sky/dashboard/out/_next/static/chunks/pages/_app-bde01e4a2beec258.js +0 -34
  126. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-792db96d918c98c9.js +0 -16
  127. sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-d66997e2bfc837cf.js +0 -16
  128. sky/dashboard/out/_next/static/css/0748ce22df867032.css +0 -3
  129. sky/utils/kubernetes/cleanup-tunnel.sh +0 -62
  130. /sky/dashboard/out/_next/static/{96_E2yl3QAiIJGOYCkSpB → KYAhEFa3FTfq4JyKVgo-s}/_ssgManifest.js +0 -0
  131. /sky/dashboard/out/_next/static/chunks/{1141-e6aa9ab418717c59.js → 1141-9c810f01ff4f398a.js} +0 -0
  132. /sky/dashboard/out/_next/static/chunks/{3800-7b45f9fbb6308557.js → 3800-b589397dc09c5b4e.js} +0 -0
  133. {skypilot_nightly-1.0.0.dev20251203.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/WHEEL +0 -0
  134. {skypilot_nightly-1.0.0.dev20251203.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/entry_points.txt +0 -0
  135. {skypilot_nightly-1.0.0.dev20251203.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/licenses/LICENSE +0 -0
  136. {skypilot_nightly-1.0.0.dev20251203.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/top_level.txt +0 -0
sky/core.py CHANGED
@@ -1211,6 +1211,7 @@ def enabled_clouds(workspace: Optional[str] = None,
1211
1211
  return [cloud.canonical_name() for cloud in cached_clouds]
1212
1212
  enabled_ssh_infras = []
1213
1213
  enabled_k8s_infras = []
1214
+ enabled_slurm_infras = []
1214
1215
  enabled_cloud_infras = []
1215
1216
  for cloud in cached_clouds:
1216
1217
  cloud_infra = cloud.expand_infras()
@@ -1218,10 +1219,16 @@ def enabled_clouds(workspace: Optional[str] = None,
1218
1219
  enabled_ssh_infras.extend(cloud_infra)
1219
1220
  elif isinstance(cloud, clouds.Kubernetes):
1220
1221
  enabled_k8s_infras.extend(cloud_infra)
1222
+ elif isinstance(cloud, clouds.Slurm):
1223
+ enabled_slurm_infras.extend(cloud_infra)
1221
1224
  else:
1222
1225
  enabled_cloud_infras.extend(cloud_infra)
1226
+ # We do not sort slurm infras alphabetically because the
1227
+ # default partition should appear first.
1228
+ # Ordering of slurm infras is enforced in Slurm implementation.
1223
1229
  all_infras = sorted(enabled_ssh_infras) + sorted(
1224
- enabled_k8s_infras) + sorted(enabled_cloud_infras)
1230
+ enabled_k8s_infras) + enabled_slurm_infras + sorted(
1231
+ enabled_cloud_infras)
1225
1232
  return all_infras
1226
1233
 
1227
1234
 
@@ -1232,7 +1239,14 @@ def realtime_kubernetes_gpu_availability(
1232
1239
  quantity_filter: Optional[int] = None,
1233
1240
  is_ssh: Optional[bool] = None
1234
1241
  ) -> List[Tuple[str, List[models.RealtimeGpuAvailability]]]:
1242
+ """Gets the real-time Kubernetes GPU availability.
1235
1243
 
1244
+ Returns:
1245
+ A list of tuples, where each tuple contains:
1246
+ - context (str): The Kubernetes context.
1247
+ - availability_list (List[models.RealtimeGpuAvailability]): A list
1248
+ of RealtimeGpuAvailability objects for that context.
1249
+ """
1236
1250
  if context is None:
1237
1251
  # Include contexts from both Kubernetes and SSH clouds
1238
1252
  kubernetes_contexts = clouds.Kubernetes.existing_allowed_contexts()
@@ -1314,6 +1328,119 @@ def realtime_kubernetes_gpu_availability(
1314
1328
  return availability_lists
1315
1329
 
1316
1330
 
1331
+ def realtime_slurm_gpu_availability(
1332
+ slurm_cluster_name: Optional[str] = None,
1333
+ name_filter: Optional[str] = None,
1334
+ quantity_filter: Optional[int] = None,
1335
+ env_vars: Optional[Dict[str, str]] = None,
1336
+ **kwargs) -> List[Tuple[str, List[models.RealtimeGpuAvailability]]]:
1337
+ """Gets Slurm real-time GPU availability grouped by partition.
1338
+
1339
+ This function calls the Slurm backend to fetch GPU info.
1340
+
1341
+ Args:
1342
+ name_filter: Optional name filter for GPUs.
1343
+ quantity_filter: Optional quantity filter for GPUs.
1344
+ env_vars: Environment variables (may be needed for backend).
1345
+ kwargs: Additional keyword arguments.
1346
+
1347
+ Returns:
1348
+ A list of tuples, where each tuple contains:
1349
+ - partition_name (str): The name of the Slurm partition.
1350
+ - availability_list (List[models.RealtimeGpuAvailability]): A list
1351
+ of RealtimeGpuAvailability objects for that partition.
1352
+ Example structure:
1353
+ [
1354
+ ('gpu_partition_1', [
1355
+ RealtimeGpuAvailability(gpu='V100', counts=[4, 8],
1356
+ capacity=16, available=10),
1357
+ RealtimeGpuAvailability(gpu='A100', counts=[8],
1358
+ capacity=8, available=0),
1359
+ ]),
1360
+ ('gpu_partition_2', [
1361
+ RealtimeGpuAvailability(gpu='V100', counts=[4],
1362
+ capacity=4, available=4),
1363
+ ])
1364
+ ]
1365
+
1366
+ Raises:
1367
+ ValueError: If Slurm is not configured or no matching GPUs are found.
1368
+ exceptions.NotSupportedError: If Slurm is not enabled or configured.
1369
+ """
1370
+ del env_vars, kwargs # Currently unused
1371
+
1372
+ if slurm_cluster_name is None:
1373
+ # Include contexts from both Kubernetes and SSH clouds
1374
+ slurm_cluster_names = clouds.Slurm.existing_allowed_clusters()
1375
+ else:
1376
+ slurm_cluster_names = [slurm_cluster_name]
1377
+
1378
+ # Optional: Check if Slurm is enabled first
1379
+ # enabled = global_user_state.get_enabled_clouds(
1380
+ # capability=sky_cloud.CloudCapability.COMPUTE)
1381
+ # if not clouds.Slurm() in enabled:
1382
+ # raise exceptions.NotSupportedError(
1383
+ # "Slurm is not enabled. Run 'sky check' to enable it.")
1384
+
1385
+ def realtime_slurm_gpu_availability_single(
1386
+ slurm_cluster_name: str) -> List[models.RealtimeGpuAvailability]:
1387
+ try:
1388
+ # This function now returns aggregated data per GPU type:
1389
+ # Tuple[Dict[str, List[InstanceTypeInfo]], Dict[str, int],
1390
+ # Dict[str, int]]
1391
+ # (qtys_map, total_capacity, total_available)
1392
+ accelerator_counts, total_capacity, total_available = (
1393
+ catalog.list_accelerator_realtime(
1394
+ gpus_only=True, # Ensure we only query for GPUs
1395
+ name_filter=name_filter,
1396
+ # Pass None for region_filter here; filtering happens
1397
+ # inside if needed, but we want all partitions returned
1398
+ # for grouping.
1399
+ region_filter=slurm_cluster_name,
1400
+ quantity_filter=quantity_filter,
1401
+ clouds='slurm',
1402
+ case_sensitive=False,
1403
+ ))
1404
+ except exceptions.NotSupportedError as e:
1405
+ logger.error(f'Failed to query Slurm GPU availability: {e}')
1406
+ raise
1407
+ except ValueError as e:
1408
+ # Re-raise ValueError if no GPUs are found matching the filters
1409
+ logger.error(f'Error querying Slurm GPU availability: {e}')
1410
+ raise
1411
+ except Exception as e:
1412
+ logger.error(
1413
+ 'Error querying Slurm GPU availability: '
1414
+ f'{common_utils.format_exception(e, use_bracket=True)}')
1415
+ raise ValueError(
1416
+ f'Error querying Slurm GPU availability: {e}') from e
1417
+
1418
+ # --- Format the output ---
1419
+ realtime_gpu_availability_list: List[
1420
+ models.RealtimeGpuAvailability] = []
1421
+ for gpu_type, _ in sorted(accelerator_counts.items()):
1422
+ realtime_gpu_availability_list.append(
1423
+ models.RealtimeGpuAvailability(
1424
+ gpu_type,
1425
+ accelerator_counts.pop(gpu_type),
1426
+ total_capacity[gpu_type],
1427
+ total_available[gpu_type],
1428
+ ))
1429
+ return realtime_gpu_availability_list
1430
+
1431
+ parallel_queried = subprocess_utils.run_in_parallel(
1432
+ realtime_slurm_gpu_availability_single, slurm_cluster_names)
1433
+ availability_lists: List[Tuple[str,
1434
+ List[models.RealtimeGpuAvailability]]] = []
1435
+ for slurm_cluster_name, queried in zip(slurm_cluster_names,
1436
+ parallel_queried):
1437
+ if len(queried) == 0:
1438
+ logger.debug(f'No gpus found in Slurm cluster {slurm_cluster_name}')
1439
+ continue
1440
+ availability_lists.append((slurm_cluster_name, queried))
1441
+ return availability_lists
1442
+
1443
+
1317
1444
  # =================
1318
1445
  # = Local Cluster =
1319
1446
  # =================
@@ -1330,41 +1457,6 @@ def local_down(name: Optional[str] = None) -> None:
1330
1457
  kubernetes_deploy_utils.teardown_local_cluster(name)
1331
1458
 
1332
1459
 
1333
- @usage_lib.entrypoint
1334
- def ssh_up(infra: Optional[str] = None, cleanup: bool = False) -> None:
1335
- """Deploys or tears down a Kubernetes cluster on SSH targets.
1336
-
1337
- Args:
1338
- infra: Name of the cluster configuration in ssh_node_pools.yaml.
1339
- If None, the first cluster in the file is used.
1340
- cleanup: If True, clean up the cluster instead of deploying.
1341
- """
1342
- kubernetes_deploy_utils.deploy_ssh_cluster(
1343
- cleanup=cleanup,
1344
- infra=infra,
1345
- )
1346
-
1347
-
1348
- @usage_lib.entrypoint
1349
- def ssh_status(context_name: str) -> Tuple[bool, str]:
1350
- """Check the status of an SSH Node Pool context.
1351
-
1352
- Args:
1353
- context_name: The SSH context name (e.g., 'ssh-my-cluster')
1354
-
1355
- Returns:
1356
- Tuple[bool, str]: (is_ready, reason)
1357
- - is_ready: True if the SSH Node Pool is ready, False otherwise
1358
- - reason: Explanation of the status
1359
- """
1360
- try:
1361
- is_ready, reason = clouds.SSH.check_single_context(context_name)
1362
- return is_ready, reason
1363
- except Exception as e: # pylint: disable=broad-except
1364
- return False, ('Failed to check SSH context: '
1365
- f'{common_utils.format_exception(e)}')
1366
-
1367
-
1368
1460
  def get_all_contexts() -> List[str]:
1369
1461
  """Get all available contexts from Kubernetes and SSH clouds.
1370
1462
 
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/dashboard/_next/static/css/0748ce22df867032.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/0748ce22df867032.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/dashboard/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/dashboard/_next/static/chunks/webpack-64e05f17bf2cf8ce.js" defer=""></script><script src="/dashboard/_next/static/chunks/framework-cf60a09ccd051a10.js" defer=""></script><script src="/dashboard/_next/static/chunks/main-f15ccb73239a3bf1.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_app-bde01e4a2beec258.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-c66a4e8afc46f17b.js" defer=""></script><script src="/dashboard/_next/static/96_E2yl3QAiIJGOYCkSpB/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/96_E2yl3QAiIJGOYCkSpB/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"96_E2yl3QAiIJGOYCkSpB","assetPrefix":"/dashboard","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/dashboard/_next/static/css/c5a4cfd2600fc715.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/c5a4cfd2600fc715.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/dashboard/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/dashboard/_next/static/chunks/webpack-fba3de387ff6bb08.js" defer=""></script><script src="/dashboard/_next/static/chunks/framework-cf60a09ccd051a10.js" defer=""></script><script src="/dashboard/_next/static/chunks/main-f15ccb73239a3bf1.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_app-68b647e26f9d2793.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-c66a4e8afc46f17b.js" defer=""></script><script src="/dashboard/_next/static/KYAhEFa3FTfq4JyKVgo-s/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/KYAhEFa3FTfq4JyKVgo-s/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"KYAhEFa3FTfq4JyKVgo-s","assetPrefix":"/dashboard","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -0,0 +1 @@
1
+ self.__BUILD_MANIFEST=function(s,c,a,e,t,u,f,n,i,o,j,b,r,k,d){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/pages/index-444f1804401f04ea.js"],"/_error":["static/chunks/pages/_error-c66a4e8afc46f17b.js"],"/clusters":["static/chunks/pages/clusters-9e5d47818b9bdadd.js"],"/clusters/[cluster]":[c,s,a,u,f,j,o,e,t,n,b,i,r,k,d,"static/chunks/6856-da20c5fd999f319c.js","static/chunks/1871-7e202677c42f43fe.js","static/chunks/pages/clusters/[cluster]-a7565f586ef86467.js"],"/clusters/[cluster]/[job]":[c,s,a,u,e,t,i,"static/chunks/pages/clusters/[cluster]/[job]-33f525539665fdfd.js"],"/config":["static/chunks/pages/config-718cdc365de82689.js"],"/infra":["static/chunks/pages/infra-d187cd0413d72475.js"],"/infra/[context]":["static/chunks/pages/infra/[context]-12c559ec4d81fdbd.js"],"/jobs":["static/chunks/pages/jobs-e5a98f17f8513a96.js"],"/jobs/pools/[pool]":[c,s,a,f,o,e,t,n,"static/chunks/pages/jobs/pools/[pool]-8d0f4655400b4eb9.js"],"/jobs/[job]":[c,s,a,u,f,o,e,t,n,i,"static/chunks/pages/jobs/[job]-895847b6cf200b04.js"],"/plugins/[...slug]":[s,"static/chunks/pages/plugins/[...slug]-4f46050ca065d8f8.js"],"/users":["static/chunks/pages/users-2f7646eb77785a2c.js"],"/volumes":["static/chunks/pages/volumes-ef19d49c6d0e8500.js"],"/workspace/new":["static/chunks/pages/workspace/new-3f88a1c7e86a3f86.js"],"/workspaces":["static/chunks/pages/workspaces-cb4da3abe08ebf19.js"],"/workspaces/[name]":[c,s,a,u,f,j,e,t,n,b,i,r,k,d,"static/chunks/1141-9c810f01ff4f398a.js","static/chunks/pages/workspaces/[name]-96e0f298308da7e2.js"],sortedPages:["/","/_app","/_error","/clusters","/clusters/[cluster]","/clusters/[cluster]/[job]","/config","/infra","/infra/[context]","/jobs","/jobs/pools/[pool]","/jobs/[job]","/plugins/[...slug]","/users","/volumes","/workspace/new","/workspaces","/workspaces/[name]"]}}("static/chunks/5739-d67458fcb1386c92.js","static/chunks/616-3d59f75e2ccf9321.js","static/chunks/6130-2be46d70a38f1e82.js","static/chunks/6989-01359c57e018caa4.js","static/chunks/3850-fd5696f3bbbaddae.js","static/chunks/7411-b15471acd2cba716.js","static/chunks/1272-1ef0bf0237faccdb.js","static/chunks/8969-452f9d5cbdd2dc73.js","static/chunks/9353-8369df1cf105221c.js","static/chunks/6212-7bd06f60ba693125.js","static/chunks/7359-c8d04e06886000b3.js","static/chunks/6990-09cbf02d3cd518c3.js","static/chunks/2260-7703229c33c5ebd5.js","static/chunks/3800-b589397dc09c5b4e.js","static/chunks/7615-019513abc55b3b47.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3294],{53294:function(e,s,t){t.r(s),t.d(s,{ContextDetails:function(){return A},GPUs:function(){return H},InfrastructureSection:function(){return E}});var a=t(85893),l=t(67294),r=t(55739);t(9353);var n=t(26409),o=t(98418),i=t(13626),c=t(23001),d=t(17853),m=t(32045),u=t(23266),h=t(68969),x=t(29326),g=t(50326),p=t(30803),f=t(42557),y=t(36185),j=t(69123);function b(e){let{isOpen:s,onClose:t,onSave:n,poolData:o=null,isLoading:i=!1}=e,[c,d]=(0,l.useState)(""),[m,u]=(0,l.useState)(""),[h,b]=(0,l.useState)("ubuntu"),[N,v]=(0,l.useState)(null),[w,S]=(0,l.useState)(""),[C,k]=(0,l.useState)({}),_=null!==o;(0,l.useEffect)(()=>{if(_&&o){var e,s,t;d(o.name||""),u(((null===(e=o.config)||void 0===e?void 0:e.hosts)||[]).join("\n")),b((null===(s=o.config)||void 0===s?void 0:s.user)||"ubuntu"),S((null===(t=o.config)||void 0===t?void 0:t.password)||"")}else d(""),u(""),b("ubuntu"),v(null),S("");k({})},[_,o]);let P=()=>{let e={};return c.trim()||(e.poolName="Pool name is required"),m.trim()||(e.hosts="At least one host is required"),h.trim()||(e.sshUser="SSH user is required"),N||w||(e.auth="Either SSH key file or password is required"),k(e),0===Object.keys(e).length},U=async()=>{if(!P())return;let e={hosts:m.split("\n").map(e=>e.trim()).filter(e=>e.length>0),user:h};try{if(N){let s=N.name;await (0,x.hY)(s,N),e.identity_file="~/.sky/ssh_keys/".concat(s)}w&&(e.password=w),n(c,e)}catch(e){console.error("Failed to upload SSH key:",e),k({...C,keyUpload:"Failed to upload SSH key"})}},D=()=>{i||t()};return(0,a.jsx)(g.Vq,{open:s,onOpenChange:D,children:(0,a.jsxs)(g.cZ,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,a.jsx)(g.fK,{children:(0,a.jsx)(g.$N,{children:_?"Edit SSH Node Pool: ".concat(null==o?void 0:o.name):"Add SSH Node Pool"})}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"poolName",children:"Pool Name"}),(0,a.jsx)(f.I,{id:"poolName",placeholder:"my-ssh-cluster",value:c,onChange:e=>d(e.target.value),disabled:_,className:"placeholder:text-gray-500 ".concat(C.poolName?"border-red-500":"")}),C.poolName&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:C.poolName})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"hosts",children:"Hosts (one per line)"}),(0,a.jsx)(j.g,{id:"hosts",placeholder:"192.168.1.10\n192.168.1.11\nhostname.example.com",value:m,onChange:e=>u(e.target.value),rows:6,className:"placeholder:text-gray-500 ".concat(C.hosts?"border-red-500":"")}),C.hosts&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:C.hosts})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"sshUser",children:"SSH User"}),(0,a.jsx)(f.I,{id:"sshUser",placeholder:"ubuntu",value:h,onChange:e=>b(e.target.value),className:"placeholder:text-gray-500 ".concat(C.sshUser?"border-red-500":"")}),C.sshUser&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:C.sshUser})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"keyFile",children:"SSH Private Key File"}),(0,a.jsx)(f.I,{id:"keyFile",type:"file",accept:".pem,.key,id_rsa,id_ed25519",onChange:e=>{var s;return v((null===(s=e.target.files)||void 0===s?void 0:s[0])||null)},className:"border-0 bg-transparent p-0 shadow-none focus:ring-0 file:mr-2 file:text-sm file:py-1 file:px-3 file:border file:border-gray-300 file:rounded file:bg-gray-50 hover:file:bg-gray-100 file:cursor-pointer"}),C.keyUpload&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:C.keyUpload})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y._,{htmlFor:"password",children:"Password (optional, if sudo requires a password)"}),(0,a.jsx)(f.I,{id:"password",type:"password",placeholder:"Leave empty if using passwordless sudo",value:w,onChange:e=>S(e.target.value),className:"placeholder:text-gray-500"})]}),C.auth&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:C.auth})]}),(0,a.jsxs)(g.cN,{children:[(0,a.jsx)(p.z,{variant:"outline",onClick:D,disabled:i,children:"Cancel"}),(0,a.jsx)(p.z,{onClick:U,disabled:i,className:"bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:i?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"Saving..."]}):_?"Update Pool":"Create Pool"})]})]})})}var N=t(6378),v=t(36856),w=t(51214),S=t(11163),C=t(41664),k=t.n(C),_=t(36989);t(37673);var P=t(88950);let U=w.nb.REFRESH_INTERVAL,D=w.MO.NAME_TRUNCATE_LENGTH,I=e=>{let{gpu:s,heightClass:t="h-4",wrapperClassName:l=""}=e,r=(null==s?void 0:s.gpu_total)||0,n=(null==s?void 0:s.gpu_not_ready)||0,o=(null==s?void 0:s.gpu_free)||0,i=Math.max(0,r-o-n),c="".concat(n," not ready"),d="".concat(i," used"),m="".concat(o," free"),u=r>0?e=>e/r*100:()=>0,h=u(n),x=u(i),g=u(o);return(0,a.jsxs)("div",{className:"bg-gray-100 rounded-md flex overflow-hidden shadow-sm ".concat(t," ").concat(l).trim(),children:[h>0&&(0,a.jsx)("div",{style:{width:"".concat(h,"%"),fontSize:"clamp(8px, 1.2vw, 12px)"},title:c,className:"bg-gray-400 h-full flex items-center justify-center text-white font-medium overflow-hidden whitespace-nowrap px-1",children:h>15&&c}),x>0&&(0,a.jsx)("div",{style:{width:"".concat(x,"%"),fontSize:"clamp(8px, 1.2vw, 12px)"},title:d,className:"bg-yellow-500 h-full flex items-center justify-center text-white font-medium overflow-hidden whitespace-nowrap px-1",children:x>15&&d}),g>0&&(0,a.jsx)("div",{style:{width:"".concat(g,"%"),fontSize:"clamp(8px, 1.2vw, 12px)"},title:m,className:"bg-green-700 h-full flex items-center justify-center text-white font-medium overflow-hidden whitespace-nowrap px-1",children:g>15&&m})]})};function E(e){let{title:s,isLoading:t,isDataLoaded:l,contexts:n,gpus:o,groupedPerContextGPUs:i,groupedPerNodeGPUs:c,handleContextClick:d,contextStats:m={},jobsData:u={},isJobsDataLoading:h=!0,isSSH:x=!1,isSlurm:g=!1,actionButton:p=null,contextWorkspaceMap:f={},contextErrors:y={}}=e,j=n||[];return t&&0===j.length?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:s}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsxs)("span",{className:"text-gray-500",children:["Loading ",s,"..."]})]})]})}):l&&0===j.length?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:s}),p]}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["No ",s," found or ",s," is not configured."]})]})}):j.length>0?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:s}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[j.length," ",1===j.length?x?"pool":g?"cluster":"context":x?"pools":g?"clusters":"contexts"]})]}),p]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Name"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Jobs"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Nodes"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"GPU Types"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"#GPUs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(j.length>5?"max-h-[250px] overflow-y-auto block":""),children:j.map(e=>{var s,t;let n=i[e]||[],o=c[e]||[],g=n.reduce((e,s)=>e+(s.gpu_total||0),0),p=x?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e),j=m[p]||{clusters:0,jobs:0},b=Object.keys(m).length>0&&m[p]||l,N=i&&Object.keys(i).length>0||l,v=c&&Object.keys(c).length>0||l,w=N?Object.keys(n.reduce((e,s)=>(e[s.gpu_name]=(e[s.gpu_name]||0)+(s.gpu_total||0),e),{})).join(", "):null,S=x?e.replace(/^ssh-/,""):e,C=f[e]||[],k=C.length>1?" (workspaces: ".concat(C.join(", "),")"):"";return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3",children:(0,a.jsx)(_.Md,{content:"".concat(S).concat(k),className:"text-sm text-muted-foreground",children:(0,a.jsxs)("span",{className:"text-blue-600 hover:underline cursor-pointer",onClick:()=>d(e),children:[S.length>D?"".concat(S.substring(0,Math.floor((D-3)/2)),"...").concat(S.substring(S.length-Math.ceil((D-3)/2))):S,k&&(0,a.jsx)("span",{className:"text-xs text-gray-500 ml-1",children:k})]})})}),(0,a.jsx)("td",{className:"p-3",children:b?j.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:j.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:12})})}),(0,a.jsx)("td",{className:"p-3",children:h?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:(0,a.jsx)(r.Z,{size:12})}):(null===(s=u[p])||void 0===s?void 0:s.jobs)?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:null===(t=u[p])||void 0===t?void 0:t.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:v?(0,a.jsx)("span",{className:0===o.length&&y[e]?"text-gray-400":"",title:0===o.length&&y[e]?y[e]:"",children:0===o.length&&y[e]?"0*":o.length}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})}),(0,a.jsx)("td",{className:"p-3",children:N?w||"-":(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})}),(0,a.jsx)("td",{className:"p-3",children:N?g:(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})})]},e)})})]})})}),o&&o.length>0&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4 whitespace-nowrap",children:["GPU",(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs font-medium whitespace-nowrap",children:[o.reduce((e,s)=>e+s.gpu_free,0)," ","of"," ",o.reduce((e,s)=>e+s.gpu_total,0)," ","free"]})]}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Requestable"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/2",children:(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)("span",{children:"Utilization"})})})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(o.length>5?"max-h-[250px] overflow-y-auto block":""),children:o.map(e=>{let s=i?Object.values(i).flat().filter(s=>{if(s.gpu_name!==e.gpu_name)return!1;if(g)return!0;let t=s.context||s.cluster;return!!t&&(x?t.startsWith("ssh-"):!t.startsWith("ssh-"))}).map(e=>e.gpu_requestable_qty_per_node).filter((e,s,t)=>t.indexOf(e)===s).join(", "):"-";return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"p-3 font-medium w-24 whitespace-nowrap",children:e.gpu_name}),(0,a.jsxs)("td",{className:"p-3 text-xs text-gray-600",children:[s||"-"," / node"]}),(0,a.jsx)("td",{className:"p-3 w-2/3",children:(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsx)(I,{gpu:e,heightClass:"h-5",wrapperClassName:"flex-1 min-w-[100px] w-full"})})})]},e.gpu_name)})})]})})})]})]})}):null}function A(e){let{contextName:s,gpusInContext:t,nodesInContext:n}=e,o=s.startsWith("ssh-"),[i,c]=(0,l.useState)([]),[m,u]=(0,l.useState)("$__all"),[h,x]=(0,l.useState)({from:"now-1h",to:"now"}),[g,p]=(0,l.useState)(!1),[f,y]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{y(await (0,d.TO)())})()},[]);let j=(0,l.useCallback)(async()=>{if(f){p(!0);try{let e=(0,d.ki)(),t="in-cluster"===s?"^$":s,a="query="+encodeURIComponent('group by (node) (DCGM_FI_DEV_GPU_TEMP{cluster=~"'.concat(t,'"} or label_replace(amd_gpu_gfx_activity{cluster=~"').concat(t,'"}, "node", "$1", "hostname", "(.*)"))')),l="/api/datasources/proxy/1/api/v1/query?".concat(a);try{let s=await fetch("".concat(e).concat(l),{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(s.ok){let e=await s.json();if(e.data&&e.data.result&&e.data.result.length>0){let s=e.data.result.map(e=>e.metric.node).filter(Boolean).sort();c(s),console.log("Successfully fetched hosts for cluster ".concat(t||"in-cluster",":"),s)}else console.log("No nodes found for this cluster"),c([])}else console.log("HTTP ".concat(s.status," from ").concat(l,": ").concat(s.statusText)),c([])}catch(e){console.log("Failed to fetch from ".concat(l,":"),e),c([])}}catch(e){console.error("Error fetching available hosts:",e),c([])}finally{p(!1)}}},[f,s]);(0,l.useEffect)(()=>{f&&n&&n.length>0&&j()},[n,f,j]);let b=e=>{let t=(0,d.ki)(),a="in-cluster"===s?"^$":s;return"".concat(t,"/d-solo/skypilot-dcgm-cluster-dashboard/skypilot-dcgm-kubernetes-cluster-dashboard?orgId=1&timezone=browser&var-datasource=prometheus&var-host=").concat(encodeURIComponent(m),"&var-gpu=$__all&var-cluster=").concat(encodeURIComponent(a),"&refresh=5s&theme=light&from=").concat(encodeURIComponent(h.from),"&to=").concat(encodeURIComponent(h.to),"&panelId=").concat(e,"&__feature.dashboardSceneSolo")},N=e=>{x({"15m":{from:"now-15m",to:"now"},"1h":{from:"now-1h",to:"now"},"6h":{from:"now-6h",to:"now"},"24h":{from:"now-24h",to:"now"},"7d":{from:"now-7d",to:"now"}}[e])};return(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm h-full",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)("h4",{className:"text-lg font-semibold",children:"Available GPUs"})}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:t.map(e=>(0,a.jsxs)("div",{className:"p-3 bg-gray-50 rounded-md border border-gray-200 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-1.5 flex-wrap",children:[(0,a.jsxs)("div",{className:"font-medium text-gray-800 text-sm",children:[e.gpu_name,(0,a.jsxs)("span",{className:"text-xs text-gray-500 ml-2",children:["(Requestable: ",e.gpu_requestable_qty_per_node," / node)"]})]}),(0,a.jsxs)("span",{className:"text-xs font-medium",children:[e.gpu_free," free / ",e.gpu_total," total"]})]}),(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(I,{gpu:e,heightClass:"h-4",wrapperClassName:"w-full"})})]},e.gpu_name))}),n&&n.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Nodes"}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-100",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Node"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"IP Address"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"GPU"}),(0,a.jsx)("th",{className:"p-3 text-right font-medium text-gray-600",children:"Availability"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:n.map((e,s)=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.node_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.ip_address||"-"}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.gpu_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-right text-gray-700",children:!1===e.is_ready?"0 of ".concat(e.gpu_total," free (Node NotReady)"):"".concat(e.gpu_free," of ").concat(e.gpu_total," free")})]},"".concat(e.node_name,"-").concat(s)))})]})})]}),f&&t&&t.length>0&&!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4 mt-6",children:"GPU Metrics"}),(0,a.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[n&&n.length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"host-select",className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Node:"}),(0,a.jsxs)("select",{id:"host-select",value:m,onChange:e=>{u(e.target.value)},disabled:g,className:"px-3 py-1 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-sky-blue focus:border-transparent",children:[(0,a.jsx)("option",{value:"$__all",children:"All Nodes"}),i.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),g&&(0,a.jsx)("div",{className:"ml-2",children:(0,a.jsx)(r.Z,{size:16})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,a.jsx)("div",{className:"flex gap-1",children:[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}].map(e=>(0,a.jsx)("button",{onClick:()=>N(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(h.from==="now-".concat(e.value)&&"now"===h.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})]}),(0,a.jsx)("div",{className:"mt-2 text-xs text-gray-500",children:n&&n.length>0?(0,a.jsxs)(a.Fragment,{children:["Showing:"," ","$__all"===m?"All nodes":m," ","• Time: ",h.from," to ",h.to,i.length>0&&(0,a.jsxs)("span",{children:[" ","• ",i.length," nodes available"]})]}):(0,a.jsxs)(a.Fragment,{children:["Cluster:"," ",o?s.replace(/^ssh-/,""):s," ","• Time: ",h.from," to ",h.to," • Showing metrics for all nodes in cluster"]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("6"),width:"100%",height:"400",frameBorder:"0",title:"GPU Utilization",className:"rounded"},"gpu-util-".concat(m,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("18"),width:"100%",height:"400",frameBorder:"0",title:"GPU Memory",className:"rounded"},"gpu-memory-".concat(m,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("10"),width:"100%",height:"400",frameBorder:"0",title:"GPU Power Consumption",className:"rounded"},"gpu-power-".concat(m,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("12"),width:"100%",height:"400",frameBorder:"0",title:"GPU Temperature",className:"rounded"},"gpu-temp-".concat(m,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("22"),width:"100%",height:"400",frameBorder:"0",title:"CPU Utilization",className:"rounded"},"cpu-util-".concat(m,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("21"),width:"100%",height:"400",frameBorder:"0",title:"Memory Utilization",className:"rounded"},"memory-util-".concat(m,"-").concat(h.from,"-").concat(h.to))})})]})]})]})})})}function F(e){var s;let{poolName:t,gpusInContext:i,nodesInContext:c,handleDeploySSHPool:d,handleEditSSHPool:m,handleDeleteSSHPool:u,poolConfig:h}=e,[f,y]=(0,l.useState)(null),[j,b]=(0,l.useState)(!0),[N,v]=(0,l.useState)({isOpen:!1,action:null,loading:!1}),[w,S]=(0,l.useState)({isOpen:!1,logs:"",isStreaming:!1,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});(0,l.useEffect)(()=>{(async()=>{try{b(!0);let e=await (0,x.IS)(t);y(e)}catch(e){console.error("Failed to fetch SSH Node Pool status:",e),y({pool_name:t,status:"Error",reason:"Failed to fetch status"})}finally{b(!1)}})()},[t]);let{deployDisabled:C}=(()=>{if(!f)return{deployDisabled:!0};let e=f.status;return"Ready"===e?{deployDisabled:!0}:"Error"===e?{deployDisabled:!0}:{deployDisabled:!1}})(),k=async()=>{v({...N,loading:!0});try{if("deploy"===N.action){v({isOpen:!1,action:null,loading:!1}),S({isOpen:!0,logs:"",isStreaming:!0,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});try{let e=(await d(t)).request_id;S(s=>({...s,requestId:e}));let s=new AbortController;await (0,x.wJ)({requestId:e,signal:s.signal,onNewLog:e=>{S(s=>({...s,logs:s.logs+e}))}}),S(e=>({...e,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!0})),setTimeout(async()=>{(async()=>{try{let e=await (0,x.IS)(t);y(e)}catch(e){console.error("Failed to fetch SSH Node Pool status after deployment:",e)}})()},1e3)}catch(e){console.error("Deployment failed:",e),S(s=>({...s,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!1,logs:s.logs+"\nDeployment failed: ".concat(e.message)}))}}else if("delete"===N.action){v({isOpen:!1,action:null,loading:!1}),S({isOpen:!0,logs:"",isStreaming:!0,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});try{let e=(await (0,x.ez)(t)).request_id;S(s=>({...s,requestId:e})),e&&await (0,x.mF)({requestId:e,signal:null,onNewLog:e=>{S(s=>({...s,logs:s.logs+e}))},operationType:"down"}),await u(t),S(e=>({...e,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!0,logs:e.logs+"\nSSH Node Pool teardown completed successfully."}))}catch(e){console.error("Down operation failed:",e),S(s=>({...s,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!1,logs:s.logs+"\nTeardown failed: ".concat(e.message)}))}}}catch(e){console.error("Action failed:",e),v({...N,loading:!1})}},_=()=>{v({isOpen:!1,action:null,loading:!1})},P=()=>{S({isOpen:!1,logs:"",isStreaming:!1,deploymentComplete:!1,deploymentSuccess:!1,requestId:null}),w.deploymentComplete&&setTimeout(()=>{(async()=>{try{let e=await (0,x.IS)(t);y(e)}catch(e){console.error("Failed to refresh status:",e)}})()},1e3)},U="deploy"===N.action?{title:"Deploy SSH Node Pool",description:'Are you sure you want to deploy SSH Node Pool "'.concat(t,'"?'),details:["• Set up SkyPilot runtime on the configured SSH hosts","• Install required components and dependencies","• Make the node pool available for workloads","","This process may take a few minutes to complete."]}:{title:"Delete SSH Node Pool",description:'Are you sure you want to delete SSH Node Pool "'.concat(t,'"?'),details:["• Clean up any deployed resources","• Remove the SSH Node Pool configuration"]};return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"SSH Node Pool Details"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("button",{className:"px-3 py-1 text-sm border rounded flex items-center ".concat(C?"border-gray-300 bg-gray-100 text-gray-400 cursor-not-allowed":"border-green-300 bg-green-50 text-green-700 hover:bg-green-100"),onClick:C?void 0:()=>{v({isOpen:!0,action:"deploy",loading:!1})},disabled:C,children:[(0,a.jsx)(n.Z,{className:"w-4 h-4 mr-2"}),"Deploy"]}),(0,a.jsxs)("button",{className:"px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50 flex items-center text-red-600 hover:text-red-700",onClick:()=>{v({isOpen:!0,action:"delete",loading:!1})},children:[(0,a.jsx)(o.Z,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Pool Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:t})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Nodes"}),(0,a.jsx)("div",{className:"text-base mt-1",children:c?c.length:0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:j?(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading..."})]}):f?(0,a.jsx)(e=>{let{status:s,reason:t}=e,l="Ready"===s,r="Not Ready"===s?"Click Deploy to set up this node pool":t;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium ".concat(l?"bg-green-100":"bg-red-100"," ").concat(l?"text-green-800":"text-red-800"),children:s}),!l&&r&&(0,a.jsxs)("span",{className:"text-sm text-gray-600",children:["(",r,")"]})]})},{status:f.status,reason:f.reason}):(0,a.jsx)("span",{className:"text-gray-500",children:"Unknown"})})]})]})})]})}),(0,a.jsx)(A,{contextName:"ssh-".concat(t),gpusInContext:i,nodesInContext:c}),(0,a.jsx)(g.Vq,{open:N.isOpen,onOpenChange:_,children:(0,a.jsxs)(g.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(g.fK,{className:"",children:[(0,a.jsx)(g.$N,{className:"",children:U.title}),(0,a.jsx)(g.Be,{className:"",children:U.description})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"text-sm text-gray-600 space-y-1",children:[(0,a.jsx)("p",{className:"font-medium mb-2",children:"This will:"}),U.details.map((e,s)=>(0,a.jsx)("p",{className:""===e?"pt-2":"",children:e},s))]})}),(0,a.jsxs)(g.cN,{className:"",children:[(0,a.jsx)(p.z,{variant:"outline",onClick:_,disabled:N.loading,className:"",children:"Cancel"}),(0,a.jsx)(p.z,{onClick:k,disabled:N.loading,className:"deploy"===N.action?"bg-green-600 hover:bg-green-700 text-white":"bg-red-600 hover:bg-red-700 text-white",children:N.loading?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"deploy"===N.action?"Deploying...":"Deleting..."]}):"deploy"===N.action?"Deploy":"Delete"})]})]})}),(0,a.jsx)(g.Vq,{open:w.isOpen,onOpenChange:w.isStreaming?void 0:P,children:(0,a.jsxs)(g.cZ,{className:"sm:max-w-4xl max-h-[80vh]",children:[(0,a.jsxs)(g.fK,{className:"",children:[(0,a.jsxs)(g.$N,{className:"",children:["Deploying SSH Node Pool: ",t]}),(0,a.jsx)(g.Be,{className:"",children:w.isStreaming?"Deployment in progress. Do not close this dialog.":w.deploymentSuccess?"Deployment completed successfully!":"Deployment completed with errors."})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"bg-black text-green-400 p-4 rounded-md font-mono text-sm max-h-96 overflow-y-auto",children:[(0,a.jsx)("pre",{className:"whitespace-pre-wrap",children:(s=w.logs)?s.split("\n").map(e=>(e=e.replace(/\x1b\[[0-9;]*m/g,"")).match(/^D \d{2}-\d{2} \d{2}:\d{2}:\d{2}/)?null:e=(e=e.replace(/├──/g,"├─")).replace(/└──/g,"└─")).filter(e=>null!==e&&""!==e.trim()).join("\n"):""}),w.isStreaming&&(0,a.jsxs)("div",{className:"flex items-center mt-2",children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2 text-green-400"}),(0,a.jsx)("span",{className:"text-green-400",children:"Streaming logs..."})]})]})}),(0,a.jsx)(g.cN,{className:"",children:(0,a.jsx)(p.z,{onClick:P,disabled:w.isStreaming,className:w.deploymentSuccess?"bg-green-600 hover:bg-green-700 text-white":w.deploymentComplete&&!w.deploymentSuccess?"bg-red-600 hover:bg-red-700 text-white":"bg-gray-600 hover:bg-gray-700 text-white",children:w.isStreaming?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"Deploying..."]}):"Close"})})]})})]})}function H(){let[e,s]=(0,l.useState)(!0),[t,n]=(0,l.useState)(!0),[o,d]=(0,l.useState)(!0),g=l.useRef(null),p=(0,c.X)(),[f,y]=(0,l.useState)(!1),[j,w]=(0,l.useState)(!1),C=(0,S.useRouter)(),[_,D]=(0,l.useState)([]),[I,H]=(0,l.useState)([]),[M,z]=(0,l.useState)([]),[L,R]=(0,l.useState)([]),[G,q]=(0,l.useState)([]),[O,Z]=(0,l.useState)([]),[T,W]=(0,l.useState)([]),[B,J]=(0,l.useState)([]),[K,$]=(0,l.useState)(0),[V,X]=(0,l.useState)(0),[Q,Y]=(0,l.useState)({}),[ee,es]=(0,l.useState)({}),[et,ea]=(0,l.useState)({}),[el,er]=(0,l.useState)({}),[en,eo]=(0,l.useState)("all"),[ei,ec]=(0,l.useState)([]),[ed,em]=(0,l.useState)({}),[eu,eh]=(0,l.useState)(!1),[ex,eg]=(0,l.useState)(null),[ep,ef]=(0,l.useState)(!1),[ey,ej]=(0,l.useState)(!0),[eb,eN]=(0,l.useState)({}),[ev,ew]=(0,l.useState)(null),eS=l.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0},{showLoadingIndicators:t=!0,forceRefresh:a=!1}=e;t&&(s(!0),n(!0),ef(!0),ej(!0));try{async function l(e){await eC(e),await eP(e)}await Promise.all([l(a),e_(a),ek(a)])}catch(e){console.error("Error in fetchData:",e),er({}),D([]),H([]),z([]),R([]),Y({}),es({}),ea({}),ec([]),y(!0),s(!1),J([]),$(0),X(0),w(!0),em({}),ef(!1),eN({}),ej(!1)}finally{t&&(s(!1),n(!1),ef(!1),ej(!1)),o&&t&&d(!1)}},[o]),eC=async e=>{try{let t=e?await (0,m.Xg)():await N.default.get(m.Xg);if(t){let{workspaces:e,allContextNames:a,allGPUs:l,perContextGPUs:r,perNodeGPUs:n,allSlurmGPUs:o,perClusterSlurmGPUs:i,perNodeSlurmGPUs:c,contextStats:d,contextWorkspaceMap:m,contextErrors:u}=t;er(e||{}),D(a||[]),H(l||[]),z(r||[]),R(n||[]),q(o||[]),Z(i||[]),W(c||[]),Y(d||{}),es(m||{}),ea(u||{});let h=Object.keys(e||{});ec(h.sort()),y(!0),s(!1)}else null===t&&(er({}),D([]),H([]),z([]),R([]),q([]),Z([]),W([]),Y({}),es({}),ea({}),ec([]),y(!0),s(!1))}catch(e){console.error("Error in fetchKubernetesData:",e),er({}),D([]),H([]),z([]),R([]),q([]),Z([]),W([]),Y({}),es({}),ea({}),ec([]),y(!0),s(!1)}},ek=async e=>{try{let s=e?await (0,h.getManagedJobs)({allUsers:!0,skipFinished:!0,fields:["cloud","region"]}):await N.default.get(h.getManagedJobs,[{allUsers:!0,skipFinished:!0,fields:["cloud","region"]}]),t=(null==s?void 0:s.jobs)||[];eN(await (0,m.R8)(t)),ej(!1)}catch(e){console.error("Error in fetchManagedJobsData:",e),eN({}),ej(!1)}},e_=async e=>{try{let s=e?await (0,m.ef)():await N.default.get(m.ef,[e]);s?(J(s.clouds||[]),$(s.totalClouds||0),X(s.enabledClouds||0),w(!0)):null===s&&(J([]),$(0),X(0),w(!0))}catch(e){console.error("Error in fetchCloudData:",e),J([]),$(0),X(0),w(!0)}},eP=async e=>{try{let s=e?await (0,x.It)():await N.default.get(x.It);em(s),ef(!1)}catch(e){console.error("Failed to fetch SSH Node Pools:",e),em({}),ef(!1)}},eU=(e,s)=>{eg({name:e,config:s}),eh(!0)},eD=async e=>{try{await (0,x.MV)(e),await eP(),ew(null),C.push("/infra")}catch(e){throw console.error("Failed to delete SSH Node Pool:",e),e}},eI=async e=>{try{await (0,x._x)(e)}catch(e){throw console.error("Failed to deploy SSH Node Pool:",e),e}},eE=async(e,s)=>{ef(!0);try{let t={...ed};t[e]=s,await (0,x.Ri)(t),await eP(),eh(!1)}catch(e){console.error("Failed to save SSH Node Pool:",e),alert("Failed to save SSH Node Pool. Please try again.")}finally{ef(!1)}};(0,l.useEffect)(()=>{g.current=eS},[eS]),(0,l.useEffect)(()=>{(async()=>{await v.ZP.preloadForPage("infra"),eS({showLoadingIndicators:!0})})()},[]),(0,l.useEffect)(()=>{let e=!0,s=setInterval(()=>{e&&g.current&&"visible"===window.document.visibilityState&&g.current({showLoadingIndicators:!1})},U);return()=>{e=!1,clearInterval(s)}},[]),(0,l.useEffect)(()=>()=>{y(!1),w(!1),ef(!1),d(!0),ej(!1)},[]);let eA=()=>{N.default.invalidate(u.getClusters),N.default.invalidate(h.getManagedJobs,[{allUsers:!0,skipFinished:!0,fields:["cloud","region"]}]),N.default.invalidate(m.Xg),N.default.invalidate(m.ef,[!1]),N.default.invalidate(x.It),g.current&&g.current({showLoadingIndicators:!0,forceRefresh:!0})};(0,l.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"r"===e.key&&(e.preventDefault(),eA())};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[]),(I||[]).length,(I||[]).reduce((e,s)=>e+s.gpu_total,0),(I||[]).reduce((e,s)=>e+s.gpu_free,0);let eF=l.useMemo(()=>M?M.reduce((e,s)=>{let{context:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[M]),eH=l.useCallback(e=>"all"===en?e:e.filter(e=>(ee[e]||[]).includes(en)),[en,ee]),eM=l.useMemo(()=>{if("all"===en){let e=new Set;return Object.values(el).forEach(s=>{s.clouds&&Array.isArray(s.clouds)&&s.clouds.forEach(s=>{let t=s.toLowerCase().split("/")[0];e.add(t)})}),Array.from(e)}{let e=el[en];if(!e||!e.clouds||!Array.isArray(e.clouds))return[];let s=new Set;return e.clouds.forEach(e=>{let t=e.toLowerCase().split("/")[0];s.add(t)}),Array.from(s)}},[en,el]),ez=l.useMemo(()=>B&&0!==B.length?B.filter(e=>eM.includes(e.name.toLowerCase())):[],[B,eM]),eL=l.useMemo(()=>ez.length,[ez]),eR=l.useMemo(()=>_&&Array.isArray(_)?eH(_.filter(e=>e.startsWith("ssh-"))):[],[_,eH]),eG=l.useMemo(()=>_&&Array.isArray(_)?eH(_.filter(e=>!e.startsWith("ssh-"))):[],[_,eH]),eq=l.useMemo(()=>{if(!M||!I)return[];let e=new Set;return M.forEach(s=>{s.context.startsWith("ssh-")&&e.add(s.gpu_name)}),I.filter(s=>e.has(s.gpu_name))},[I,M]),eO=l.useMemo(()=>{if(!M||!I)return[];let e=new Set;return M.forEach(s=>{s.context.startsWith("ssh-")||e.add(s.gpu_name)}),I.filter(s=>e.has(s.gpu_name))},[I,M]),eZ=l.useMemo(()=>O&&Array.isArray(O)?[...new Set(O.map(e=>e.cluster))].sort():[],[O]),eT=l.useMemo(()=>O?O.reduce((e,s)=>{let{cluster:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[O]),eW=l.useMemo(()=>T?T.reduce((e,s)=>{let{cluster:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[T]),eB=l.useMemo(()=>L?L.reduce((e,s)=>{let{context:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[L]);(0,l.useEffect)(()=>{C.isReady&&C.query.context&&ew(decodeURIComponent(Array.isArray(C.query.context)?C.query.context[0]:C.query.context))},[C.isReady,C.query.context]);let eJ=e=>{ew(e);let s="/infra/".concat(encodeURIComponent(e));C.asPath!==s&&C.push(s)},eK=s=>{let t=eF[s]||[],l=eB[s]||[];if(e&&!f)return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]});if(s.startsWith("ssh-")){let e=s.replace(/^ssh-/,"");return(0,a.jsx)(F,{poolName:e,gpusInContext:t,nodesInContext:l,handleDeploySSHPool:eI,handleEditSSHPool:eU,handleDeleteSSHPool:eD,poolConfig:ed[e]})}return(0,a.jsx)(A,{contextName:s,gpusInContext:t,nodesInContext:l})},e$=()=>t&&(!B||0===B.length)?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Cloud"}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading Cloud..."})]})]})}):(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Cloud"}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[eL," of ",K," enabled"]})]}),ez&&0!==ez.length?(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-32",children:"Cloud"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Jobs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:ez.map(e=>{let s=j&&void 0!==e.clusters&&void 0!==e.jobs;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 font-medium text-gray-700",children:e.name}),(0,a.jsx)("td",{className:"p-3",children:s?e.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:e.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})}),(0,a.jsx)("td",{className:"p-3",children:s?e.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:e.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(r.Z,{size:16})})})]},e.name)})})]})}):(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"all"===en?"No enabled clouds available.":'No enabled clouds for workspace "'.concat(en,'".')})]})}),eV=()=>(0,a.jsx)(E,{title:"SSH Node Pool",isLoading:e,isDataLoaded:f,contexts:eR,gpus:eq,groupedPerContextGPUs:eF,groupedPerNodeGPUs:eB,handleContextClick:eJ,contextStats:Q,jobsData:eb,isJobsDataLoading:ey,isSSH:!0,contextWorkspaceMap:ee,contextErrors:et,actionButton:null}),eX=()=>(0,a.jsx)(E,{title:"Kubernetes",isLoading:e,isDataLoaded:f,contexts:eG,gpus:eO,groupedPerContextGPUs:eF,groupedPerNodeGPUs:eB,handleContextClick:eJ,contextStats:Q,jobsData:eb,isJobsDataLoading:ey,isSSH:!1,contextWorkspaceMap:ee,contextErrors:et}),eQ=()=>(0,a.jsx)(E,{title:"Slurm",isLoading:e,isDataLoaded:f,contexts:eZ,gpus:G,groupedPerContextGPUs:eT,groupedPerNodeGPUs:eW,handleContextClick:eJ,contextStats:{},jobsData:{},isJobsDataLoading:!1,isSSH:!1,isSlurm:!0,contextWorkspaceMap:{}}),eY=e||t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(k(),{href:"/infra",className:"text-sky-blue hover:underline ".concat(ev?"":"cursor-default"),children:"Infrastructure"}),ev&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),ev.startsWith("ssh-")?(0,a.jsx)(k(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"SSH Node Pool"}):(0,a.jsx)(k(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"Kubernetes"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)("span",{className:"text-sky-blue",children:ev.startsWith("ssh-")?ev.replace(/^ssh-/,""):ev})]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[ei.length>0&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 mr-2",children:"Workspace:"}),(0,a.jsxs)(P.Ph,{value:en,onValueChange:eo,children:[(0,a.jsx)(P.i4,{className:"w-40 h-8 text-sm",children:(0,a.jsx)(P.ki,{})}),(0,a.jsxs)(P.Bw,{children:[(0,a.jsx)(P.Ql,{value:"all",children:"All Workspaces"}),ei.map(e=>(0,a.jsx)(P.Ql,{value:e,children:e},e))]})]})]}),eY&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(r.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,a.jsxs)("button",{onClick:eA,disabled:eY,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 mr-1.5"}),!p&&"Refresh"]})]})]}),(()=>{if(ev)return e&&!f?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):eK(ev);let s=[];s.push({name:"Slurm",render:eQ,hasActivity:eZ.length>0,priority:1}),s.push({name:"Kubernetes",render:eX,hasActivity:eG.length>0,priority:2}),s.push({name:"Cloud",render:e$,hasActivity:V>0,priority:3}),s.push({name:"SSH Node Pool",render:eV,hasActivity:eR.length>0&&function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.some(e=>{let t=Q[s?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e)]||{clusters:0,jobs:0};return t.clusters>0||t.jobs>0})}(eR,!0),priority:4});let t=s.sort((e,s)=>e.hasActivity!==s.hasActivity?e.hasActivity?-1:1:e.priority-s.priority);return(0,a.jsx)(a.Fragment,{children:t.map((e,s)=>(0,a.jsx)(l.Fragment,{children:e.render()},s))})})(),(0,a.jsx)(b,{isOpen:eu,onClose:()=>eh(!1),onSave:eE,poolData:ex,isLoading:ep})]})}},42557:function(e,s,t){t.d(s,{I:function(){return n}});var a=t(85893),l=t(67294),r=t(32350);let n=l.forwardRef((e,s)=>{let{className:t,type:l,...n}=e;return(0,a.jsx)("input",{type:l,className:(0,r.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...n})});n.displayName="Input"},36185:function(e,s,t){t.d(s,{_:function(){return c}});var a=t(85893),l=t(67294),r=t(49102),n=t(12003),o=t(32350);let i=(0,n.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(r.f,{ref:s,className:(0,o.cn)(i(),t),...l})});c.displayName=r.f.displayName},69123:function(e,s,t){t.d(s,{g:function(){return n}});var a=t(85893),l=t(67294),r=t(32350);let n=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...l})});n.displayName="Textarea"},17853:function(e,s,t){t.d(s,{TO:function(){return r},ki:function(){return n}});let a=null,l=null,r=async()=>null!==a?a:l||(l=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),s=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return 200==s.status}catch(e){return console.debug("Grafana availability check failed:",e),a=!1,!1}finally{l=null}})()),n=()=>"".concat(window.location.origin,"/grafana")}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3850],{53850:function(r,t,n){n.d(t,{E9:function(){return k},J$:function(){return x},PC:function(){return g},Ps:function(){return s},QT:function(){return w},Vp:function(){return d},W2:function(){return h},Ye:function(){return u},_m:function(){return L},aD:function(){return p},eU:function(){return c},fp:function(){return l},fy:function(){return v},h0:function(){return j},mU:function(){return f},oy:function(){return y},r7:function(){return a}});var e=n(85893);n(67294);var o=n(88507),i=n(28586);function s(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})})}function h(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function x(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function u(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M6 12l4 4 8-8"})})}function l(r){return(0,e.jsxs)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),(0,e.jsx)("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})]})}function c(r){return(0,e.jsxs)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("ellipse",{cx:"12",cy:"4",rx:"8",ry:"2"}),(0,e.jsx)("ellipse",{cx:"12",cy:"20",rx:"8",ry:"2"}),(0,e.jsx)("path",{d:"M4 4v16"}),(0,e.jsx)("path",{d:"M20 4v16"}),(0,e.jsx)("path",{d:"M9 9h6"}),(0,e.jsx)("path",{d:"M9 12h6"}),(0,e.jsx)("path",{d:"M9 15h6"})]})}function w(r){return(0,e.jsxs)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,e.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,e.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,e.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}function d(r){return(0,e.jsxs)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"}),(0,e.jsx)("rect",{width:"20",height:"14",x:"2",y:"6",rx:"2"})]})}function g(r){return(0,e.jsxs)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",ry:"2"}),(0,e.jsx)("rect",{x:"9",y:"9",width:"6",height:"6"}),(0,e.jsx)("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),(0,e.jsx)("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),(0,e.jsx)("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),(0,e.jsx)("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),(0,e.jsx)("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),(0,e.jsx)("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),(0,e.jsx)("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),(0,e.jsx)("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]})}function j(r){return(0,e.jsxs)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,e.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,e.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function v(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}function a(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function f(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{transform:"scale(0.85) translate(1.8, 1.8)",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})})}function k(r){return(0,e.jsx)("svg",{...r,stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsxs)("g",{children:[(0,e.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,e.jsx)("path",{d:"M3 18.5V5a3 3 0 0 1 3-3h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5A3.5 3.5 0 0 1 3 18.5zM19 20v-3H6.5a1.5 1.5 0 0 0 0 3H19zM10 4H6a1 1 0 0 0-1 1v10.337A3.486 3.486 0 0 1 6.5 15H19V4h-2v8l-3.5-2-3.5 2V4z"})]})})}let p=o.Z,y=i.Z;function L(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"m21 2-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0 3 3L22 7l-3-3m-3.5 3.5L19 4"})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6856],{32045:function(e,t,o){o.d(t,{R8:function(){return u},Xg:function(){return l},ef:function(){return n}});var r=o(93225),a=o(47145),s=o(94545);async function n(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(await Promise.resolve().then(o.bind(o,6378))).default,{getClusters:s}=await Promise.resolve().then(o.bind(o,23266)),{getManagedJobs:n}=await Promise.resolve().then(o.bind(o,68969)),{getWorkspaces:l,getEnabledClouds:c}=await Promise.resolve().then(o.bind(o,17324));try{let o={jobs:[]};try{o=await t.get(n,[{allUsers:!0,skipFinished:!0,fields:["cloud","region"]}])}catch(e){console.error("Error fetching managed jobs:",e)}let i=(null==o?void 0:o.jobs)||[],u=[];try{u=await t.get(s)}catch(e){console.error("Error fetching clusters:",e)}let d=u||[],g=[];try{if(e){console.log("Force refreshing clouds by running sky check...");try{let e=await a.x.post("/check",{});if(!e.ok){let t="Failed to run sky check with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID");if(!t)throw Error("No request ID received from server for sky check");let o=await a.x.get("/api/get?request_id=".concat(t));if(!o.ok){let e="Failed to get sky check result with status ".concat(o.status,", error: ").concat(o.statusText);throw Error(e)}let r=await o.json();console.log("Sky check completed:",r)}catch(e){console.error("Error running sky check:",e)}}let o=await t.get(l),r=Object.keys(o||{});if(0===r.length)console.warn("No accessible workspaces found"),g=[];else{let e=new Set;await Promise.all(r.map(async o=>{try{let r=await t.get(c,[o,!1]);Array.isArray(r)&&r.forEach(t=>{t&&e.add(t.toLowerCase())})}catch(e){console.error("Error fetching enabled clouds for workspace ".concat(o,":"),e)}})),g=Array.from(e),console.log("Aggregated enabled clouds across all workspaces:",g)}}catch(e){console.error("Error fetching enabled clouds:",e),g=[]}let f={};r.$m.forEach(e=>{let t=g.includes(e.toLowerCase());f[e]={name:e,clusters:0,jobs:0,enabled:t}}),d.forEach(e=>{if(e.cloud){let t=e.cloud;f[t]&&(f[t].clusters+=1,f[t].enabled=!0)}}),i.forEach(e=>{if(e.cloud){let t=e.cloud;f[t]&&(f[t].jobs+=1,f[t].enabled=!0)}});let h=r.$m.length,p=Object.values(f).filter(e=>e.enabled).length;return{clouds:Object.values(f).filter(e=>e.enabled).sort((e,t)=>e.name.localeCompare(t.name)),totalClouds:h,enabledClouds:p}}catch(e){throw console.error("Error fetching cloud infrastructure:",e),e}}async function l(){try{console.log("[DEBUG] Starting workspace-aware infrastructure fetch");let{getWorkspaces:e}=await Promise.resolve().then(o.bind(o,17324));console.log("[DEBUG] About to call getWorkspaces()");let t=await e();if(console.log("[DEBUG] Workspaces data received:",t),console.log("[DEBUG] Number of accessible workspaces:",Object.keys(t||{}).length),console.log("[DEBUG] Workspace names:",Object.keys(t||{})),!t||0===Object.keys(t).length)return console.log("[DEBUG] No accessible workspaces found - returning empty result"),{workspaces:{},allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],allSlurmGPUs:[],perClusterSlurmGPUs:[],perNodeSlurmGPUs:[],contextStats:{},contextWorkspaceMap:{},contextErrors:{}};let{getEnabledClouds:r}=await Promise.resolve().then(o.bind(o,17324)),a={},s=[],n={};await Promise.allSettled(Object.entries(t).map(async e=>{let[t,o]=e;console.log("Fetching infrastructure for workspace: ".concat(t));try{console.log("[DEBUG] Fetching enabled clouds for workspace: ".concat(t));let e=await r(t,!0);console.log("[DEBUG] Expanded clouds for ".concat(t,":"),e),a[t]={config:o,clouds:e,contexts:[]},console.log("[DEBUG] Processing expandedClouds for ".concat(t,":"),e),e&&Array.isArray(e)?e.forEach(e=>{if(console.log("[DEBUG] Processing infraItem: ".concat(e)),e.toLowerCase().startsWith("kubernetes/")){let o=e.replace(/^kubernetes\//i,"");console.log("[DEBUG] Extracted kubernetes context: ".concat(o)),s.push(o),n[o]||(n[o]=[]),n[o].includes(t)||n[o].push(t),a[t].contexts.push(o)}else if(e.toLowerCase().startsWith("ssh/")){let o=e.replace(/^ssh\//i,""),r="ssh-".concat(o);console.log("[DEBUG] Extracted SSH context: ".concat(r)),s.push(r),n[r]||(n[r]=[]),n[r].includes(t)||n[r].push(t),a[t].contexts.push(r)}}):console.log("[DEBUG] No expanded clouds or not an array for ".concat(t))}catch(e){throw console.error("Failed to fetch infrastructure for workspace ".concat(t,":"),e),e}}));let{getClusters:l}=await Promise.resolve().then(o.bind(o,23266)),i=(await Promise.resolve().then(o.bind(o,6378))).default,u=[];try{u=await i.get(l)}catch(e){console.error("Error fetching clusters:",e)}let g=u||[],f={};try{f=await d(g)}catch(e){console.error("Error fetching context clusters:",e)}let p=[...new Set(s)].filter(e=>e&&"string"==typeof e),m={allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextErrors:{}};try{m=await c(p)}catch(e){console.error("Error fetching Kubernetes GPUs:",e)}let _={allSlurmGPUs:[],perClusterSlurmGPUs:[],perNodeSlurmGPUs:[]};try{_=await h(),console.log("[DEBUG] Slurm GPU data in infra.jsx:",_)}catch(e){console.error("Error fetching Slurm GPUs:",e)}let w={workspaces:a,allContextNames:[...new Set(s)].sort(),allGPUs:m.allGPUs||[],perContextGPUs:m.perContextGPUs||[],perNodeGPUs:m.perNodeGPUs||[],allSlurmGPUs:_.allSlurmGPUs||[],perClusterSlurmGPUs:_.perClusterSlurmGPUs||[],perNodeSlurmGPUs:_.perNodeSlurmGPUs||[],contextStats:f,contextWorkspaceMap:n,contextErrors:m.contextErrors||{}};return console.log("[DEBUG] Final result:",w),console.log("[DEBUG] All contexts found:",s),console.log("[DEBUG] Context workspace map:",n),w}catch(e){throw console.error("[DEBUG] Failed to fetch workspace infrastructure:",e),console.error("[DEBUG] Error stack:",e.stack),e}}async function c(e){try{var t,o,r,a,s,n,l;if(!e||0===e.length)return{allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextErrors:{}};let c={},u={},d={},g={},f=await Promise.allSettled(e.map(e=>i(e))),h={};for(let o=0;o<e.length;o++){let r=f[o];if("fulfilled"===r.status)h[e[o]]=r.value,console.log("[CONTEXT_DEBUG] Context node info result:",e[o],r.value);else{let a=(null===(t=r.reason)||void 0===t?void 0:t.message)||"string"==typeof r.reason&&r.reason||"Context may be unavailable or timed out";console.warn("Failed to get node info for context ".concat(e[o],":"),a),h[e[o]]={},g[e[o]]=a}}for(let t of e){let e=h[t]||{};if(e&&Object.keys(e).length>0){let a={};for(let s in e){let n=e[s];if(!n){console.warn("No node data for node ".concat(s," in context ").concat(t));continue}let l=n.accelerator_type||"-",c=(null===(o=n.total)||void 0===o?void 0:o.accelerator_count)||0,i=(null===(r=n.free)||void 0===r?void 0:r.accelerators_available)||0,u=!1!==n.is_ready;c>0&&(a[l]||(a[l]={gpu_name:l,gpu_requestable_qty_per_node:0,gpu_total:0,gpu_free:0,gpu_not_ready:0,context:t}),a[l].gpu_total+=c,a[l].gpu_free+=i,!1===u&&(a[l].gpu_not_ready+=c),a[l].gpu_requestable_qty_per_node=c)}for(let e in u[t]=Object.values(a),a)e in c?(c[e].gpu_total+=a[e].gpu_total,c[e].gpu_free+=a[e].gpu_free,c[e].gpu_not_ready+=a[e].gpu_not_ready):c[e]={gpu_total:a[e].gpu_total,gpu_free:a[e].gpu_free,gpu_not_ready:a[e].gpu_not_ready,gpu_name:e}}else u[t]=[]}for(let t of e){let e=h[t];if(e&&Object.keys(e).length>0)for(let o in e){let r=e[o];if(!r){console.warn("No node data for node ".concat(o," in context ").concat(t));continue}let i=r.accelerator_type||"-",g=null!==(n=null===(a=r.total)||void 0===a?void 0:a.accelerator_count)&&void 0!==n?n:0,f=null!==(l=null===(s=r.free)||void 0===s?void 0:s.accelerators_available)&&void 0!==l?l:0,h=!1!==r.is_ready;d["".concat(t,"/").concat(o)]={node_name:r.name||o,gpu_name:i,gpu_total:g,gpu_free:f,ip_address:r.ip_address||null,context:t,is_ready:h},"-"===i||!u[t]||u[t].some(e=>e.gpu_name===i)||(i in c||(c[i]={gpu_total:0,gpu_free:0,gpu_not_ready:0,gpu_name:i}),u[t].find(e=>e.gpu_name===i)||u[t].push({gpu_name:i,gpu_not_ready:0,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:t}))}}return console.log("[CONTEXT_DEBUG] All GPUs summary:",c),console.log("[CONTEXT_DEBUG] Per context GPUs data:",u),console.log("[CONTEXT_DEBUG] Per node GPUs data:",d),console.log("[CONTEXT_DEBUG] Context errors:",g),{allGPUs:Object.values(c).sort((e,t)=>(e.gpu_name||"").localeCompare(t.gpu_name||"")),perContextGPUs:Object.values(u).flat().sort((e,t)=>(e.context||"").localeCompare(t.context||"")||(e.gpu_name||"").localeCompare(t.gpu_name||"")),perNodeGPUs:Object.values(d).sort((e,t)=>(e.context||"").localeCompare(t.context||"")||(e.node_name||"").localeCompare(t.node_name||"")||(e.gpu_name||"").localeCompare(t.gpu_name||"")),contextErrors:g}}catch(e){throw console.error("[infra.jsx] Error in getKubernetesGPUsFromContexts:",e),e}}async function i(e){try{let t=await a.x.post("/kubernetes_node_info",{context:e});if(!t.ok){let o="Failed to get kubernetes node info for context ".concat(e," with status ").concat(t.status,", error: ").concat(t.statusText);throw Error(o)}let o=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("x-request-id");if(!o)throw Error("No request ID received from server for kubernetes node info");let r=await a.x.get("/api/get?request_id=".concat(o));if(!r.ok){let t=await (0,s.oN)(r),o="Failed to get kubernetes node info result for context ".concat(e," with status ").concat(r.status,", error: ").concat(t);throw Error(o)}let n=await r.json();return(n.return_value?JSON.parse(n.return_value):{}).node_info_dict||{}}catch(t){throw console.warn("[infra.jsx] Context ".concat(e," unavailable or timed out:"),t.message),t}}async function u(e){try{let t={};return e.forEach(e=>{let o=null;if("Kubernetes"===e.cloud)(o=e.region)&&(o="kubernetes/".concat(o));else if("SSH"===e.cloud&&(o=e.region)){let e=o.startsWith("ssh-")?o.substring(4):o;o="ssh/".concat(e)}o&&(t[o]||(t[o]={clusters:0,jobs:0}),t[o].jobs+=1)}),t}catch(e){throw console.error("=== Error in getContextJobs ===",e),e}}async function d(e){try{let t={};return e.forEach(e=>{let o=null;if("Kubernetes"===e.cloud)(o=e.region)&&(o="kubernetes/".concat(o));else if("SSH"===e.cloud&&(o=e.region)){let e=o.startsWith("ssh-")?o.substring(4):o;o="ssh/".concat(e)}o&&(t[o]||(t[o]={clusters:0,jobs:0}),t[o].clusters+=1)}),t}catch(e){throw console.error("=== Error in getContextClusters ===",e),e}}async function g(){try{let e=await a.x.post("/slurm_gpu_availability",{});if(!e.ok){let t="Failed to get slurm cluster GPUs with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)throw Error("No request ID received from server for slurm cluster GPUs");let o=await a.x.get("/api/get?request_id=".concat(t));if(500===o.status){try{let e=await o.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Slurm cluster GPUs:",t.message)}catch(e){console.error("Error parsing JSON for Slurm error:",e)}}catch(e){console.error("Error parsing JSON for Slurm 500 response:",e)}return[]}if(!o.ok){let e="Failed to get slurm cluster GPUs result with status ".concat(o.status);throw Error(e)}let r=await o.json();return r.return_value?JSON.parse(r.return_value):[]}catch(e){return console.error("Error fetching Slurm cluster GPUs:",e),[]}}async function f(){try{let e=await a.x.get("/slurm_node_info");if(!e.ok){let t="Failed to get slurm node info with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)throw Error("No request ID received from server for slurm node info");let o=await a.x.get("/api/get?request_id=".concat(t));if(500===o.status){try{let e=await o.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Slurm per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON for Slurm node error:",e)}}catch(e){console.error("Error parsing JSON for Slurm node 500 response:",e)}return[]}if(!o.ok){let e="Failed to get slurm node info result with status ".concat(o.status);throw Error(e)}let r=await o.json();return r.return_value?JSON.parse(r.return_value):[]}catch(e){return console.error("Error fetching Slurm per node GPUs:",e),[]}}async function h(){try{let e=await g(),t=await f(),o={},r={},a={};for(let t of e){let e=t[0];for(let a of t[1]){let t=a[0],s=a[1].join(", "),n=a[2],l=a[3];t in o?(o[t].gpu_total+=n,o[t].gpu_free+=l):o[t]={gpu_total:n,gpu_free:l,gpu_name:t},r["".concat(e,"#").concat(t)]={gpu_name:t,gpu_requestable_qty_per_node:s,gpu_total:n,gpu_free:l,cluster:e}}}for(let e of t){let t=e.slurm_cluster_name||"default";a["".concat(t,"/").concat(e.node_name,"/").concat(e.gpu_type||"-")]={node_name:e.node_name,gpu_name:e.gpu_type||"-",gpu_total:e.total_gpus||0,gpu_free:e.free_gpus||0,cluster:t,partition:e.partition||"default"}}return{allSlurmGPUs:Object.values(o).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perClusterSlurmGPUs:Object.values(r).sort((e,t)=>e.cluster.localeCompare(t.cluster)||e.gpu_name.localeCompare(t.gpu_name)),perNodeSlurmGPUs:Object.values(a).sort((e,t)=>(e.cluster||"").localeCompare(t.cluster||"")||(e.node_name||"").localeCompare(t.node_name||"")||(e.gpu_name||"").localeCompare(t.gpu_name||""))}}catch(e){return console.error("Error fetching Slurm GPUs:",e),{allSlurmGPUs:[],perClusterSlurmGPUs:[],perNodeSlurmGPUs:[]}}}},29326:function(e,t,o){o.d(t,{IS:function(){return d},It:function(){return s},MV:function(){return l},Ri:function(){return n},_x:function(){return i},ez:function(){return u},hY:function(){return c},mF:function(){return f},wJ:function(){return g}});var r=o(93225),a=o(15821);async function s(){try{let e=await fetch("".concat(r.f4,"/ssh_node_pools"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return console.error("Error fetching SSH Node Pools:",e),{}}}async function n(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error updating SSH Node Pools:",e),e}}async function l(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e),{method:"DELETE",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error deleting SSH Node Pool:",e),e}}async function c(e,t){try{let o=new FormData;o.append("key_name",e),o.append("key_file",t);let a=await fetch("".concat(r.f4,"/ssh_node_pools/keys"),{method:"POST",body:o});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));return await a.json()}catch(e){throw console.error("Error uploading SSH key:",e),e}}async function i(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/deploy"),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error deploying SSH Node Pool:",e),e}}async function u(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/down"),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error tearing down SSH Node Pool:",e),e}}async function d(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/status"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error fetching SSH Node Pool status:",e),e}}async function g(e){let t,{requestId:o,signal:s,onNewLog:n}=e,l=Date.now(),c=new Promise(e=>{let o=()=>{let r=Date.now()-l;r>=3e5?e({timeout:!0}):t=setTimeout(o,3e5-r)};t=setTimeout(o,3e5)}),i=(async()=>{try{let e=await fetch("".concat(r.f4,"/api/stream?request_id=").concat(o,"&format=plain&tail=").concat(1e3,"&follow=true"),{method:"GET",headers:{"Content-Type":"application/json"},...s?{signal:s}:{}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let a=e.body.getReader();try{for(;;){let{done:e,value:t}=await a.read();if(e)break;l=Date.now();let o=new TextDecoder().decode(t);n(o)}}finally{a.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),u=await Promise.race([i,c]);if(t&&clearTimeout(t),u.timeout){(0,a.C)("SSH deployment log stream timed out after ".concat(300,"s of inactivity"),"warning");return}}async function f(e){let t,{requestId:o,signal:s,onNewLog:n,operationType:l="operation"}=e,c=Date.now(),i=new Promise(e=>{let o=()=>{let r=Date.now()-c;r>=3e5?e({timeout:!0}):t=setTimeout(o,3e5-r)};t=setTimeout(o,3e5)}),u=(async()=>{try{let e=await fetch("".concat(r.f4,"/api/stream?request_id=").concat(o,"&format=plain&tail=").concat(1e3,"&follow=true"),{method:"GET",headers:{"Content-Type":"application/json"},...s?{signal:s}:{}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let a=e.body.getReader();try{for(;;){let{done:e,value:t}=await a.read();if(e)break;c=Date.now();let o=new TextDecoder().decode(t);n(o)}}finally{a.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),d=await Promise.race([u,i]);if(t&&clearTimeout(t),d.timeout){(0,a.C)("SSH ".concat(l," log stream timed out after ").concat(300,"s of inactivity"),"warning");return}}},53081:function(e,t,o){o.d(t,{R:function(){return a}});var r=o(47145);async function a(){try{let e=await r.x.get("/users");if(!e.ok)throw Error("Failed to fetch users with status ".concat(e.status));return(await e.json()).map(e=>({userId:e.id,username:e.name,role:e.role,created_at:e.created_at}))||[]}catch(e){throw console.error("Failed to fetch users:",e),e}}},19238:function(e,t,o){o.d(t,{C:function(){return s},w:function(){return n}});var r=o(47145),a=o(94545);async function s(){try{return(await r.x.fetch("/volumes",{},"GET")).map(e=>{var t,o,r;let a=e.cloud||"";return e.region&&(a+="/".concat(e.region)),e.zone&&(a+="/".concat(e.zone)),{name:e.name,launched_at:e.launched_at,user_hash:e.user_hash,user_name:e.user_name||"-",workspace:e.workspace||"-",last_attached_at:e.last_attached_at,status:e.status,type:e.type,cloud:e.cloud,region:e.region,zone:e.zone,infra:a,size:"".concat(e.size,"Gi"),config:e.config,storage_class:(null===(t=e.config)||void 0===t?void 0:t.storage_class_name)||"-",access_mode:(null===(o=e.config)||void 0===o?void 0:o.access_mode)||"-",namespace:(null===(r=e.config)||void 0===r?void 0:r.namespace)||"-",name_on_cloud:e.name_on_cloud,usedby_pods:e.usedby_pods,usedby_clusters:e.usedby_clusters}})||[]}catch(e){throw console.error("Failed to fetch volumes:",e),e}}async function n(e){let t="";try{let o=await r.x.post("/volumes/delete",{names:[e]});if(!o.ok)return console.error("Initial API request to delete volume failed with status ".concat(o.status)),{success:!1,msg:"Failed to delete volume with status ".concat(o.status)};let s=o.headers.get("X-SkyPilot-Request-ID")||o.headers.get("X-Request-ID");if(!s)return console.error("No request ID received from server for deleting volume"),{success:!1,msg:"No request ID received from server for deleting volume"};let n=await r.x.get("/api/get?request_id=".concat(s));if(!n.ok){let e=await (0,a.oN)(n);return t="Failed to delete volume with status ".concat(n.status,", error: ").concat(e),console.error(t),{success:!1,msg:t}}return{success:!0}}catch(e){return console.error(t="Failed to delete volume: ".concat(e)),{success:!1,msg:t}}}},36856:function(e,t,o){var r=o(6378),a=o(23266),s=o(68969),n=o(17324),l=o(53081),c=o(19238),i=o(32045),u=o(29326);let d={base:{getClusters:{fn:a.getClusters,args:[]},getManagedJobs:{fn:s.aT,args:[{allUsers:!0}]},getWorkspaces:{fn:n.getWorkspaces,args:[]},getUsers:{fn:l.R,args:[]},getCloudInfrastructure:{fn:i.ef,args:[!1]},getSSHNodePools:{fn:u.It,args:[]},getVolumes:{fn:c.C,args:[]}},dynamic:{getEnabledClouds:{fn:n.getEnabledClouds,requiresWorkspaces:!0}},pages:{clusters:["getClusters","getWorkspaces"],jobs:["getManagedJobs","getClusters","getWorkspaces","getUsers"],infra:["getClusters","getManagedJobs","getCloudInfrastructure","getSSHNodePools"],workspaces:["getWorkspaces","getClusters","getManagedJobs","getEnabledClouds"],users:["getUsers","getClusters","getManagedJobs"],volumes:["getVolumes"]}};class g{async preloadForPage(e,t){let{backgroundPreload:o=!0,force:r=!1}=t||{};if(!d.pages[e]){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,r),o&&this._backgroundPreloadOtherPages(e)}catch(t){console.error("[CachePreloader] Error preloading for page ".concat(e,":"),t)}}async _loadPageData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=d.pages[e],a=[];for(let e of o)if(d.base[e]){let{fn:o,args:s}=d.base[e];t&&r.default.invalidate(o,s),a.push(r.default.get(o,s).then(e=>(this._markAsPreloaded(o,s),e)))}else"getEnabledClouds"===e&&a.push(this._loadEnabledCloudsForAllWorkspaces(t));await Promise.allSettled(a),console.log("[CachePreloader] Loaded data for page: ".concat(e))}async _loadEnabledCloudsForAllWorkspaces(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&r.default.invalidate(n.getWorkspaces);let t=await r.default.get(n.getWorkspaces),o=Object.keys(t||{}).map(t=>(e&&r.default.invalidate(n.getEnabledClouds,[t]),r.default.get(n.getEnabledClouds,[t])));await Promise.allSettled(o)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=new Set(d.pages[e]),o=new Set;Object.keys(d.pages).filter(t=>t!==e).forEach(e=>{d.pages[e].forEach(e=>{t.has(e)||o.add(e)})}),console.log("[CachePreloader] Background preloading ".concat(o.size," unique functions: ").concat(Array.from(o).join(", "))),Promise.allSettled(Array.from(o).map(async e=>{try{if(d.base[e]){let{fn:t,args:o}=d.base[e];await r.default.get(t,o),this._markAsPreloaded(t,o)}else"getEnabledClouds"===e&&await this._loadEnabledCloudsForAllWorkspaces(!1);console.log("[CachePreloader] Background loaded function: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for function ".concat(e,":"),t)}})).then(()=>{this.isPreloading=!1,console.log("[CachePreloader] Background preloading complete")})}async preloadBaseFunctions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];console.log("[CachePreloader] Preloading all base functions");let t=Object.entries(d.base).map(t=>{let[o,{fn:a,args:s}]=t;return e&&r.default.invalidate(a,s),r.default.get(a,s).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(o,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...r.default.getStats(),isPreloading:this.isPreloading}}wasRecentlyPreloaded(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._generateKey(e,t),r=this.recentlyPreloaded.get(o);if(!r)return!1;let a=Date.now()-r<this.PRELOAD_GRACE_PERIOD;return a||this.recentlyPreloaded.delete(o),a}_markAsPreloaded(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._generateKey(e,t);this.recentlyPreloaded.set(o,Date.now())}_generateKey(e,t){let o=e.toString(),r=this._simpleHash(o),a=t.length>0?JSON.stringify(t):"";return"".concat(r,"_").concat(a)}_simpleHash(e){let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t+e.charCodeAt(o);return t>>>0}clearCache(){r.default.clear(),this.isPreloading=!1,this.preloadPromises.clear(),this.recentlyPreloaded.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map,this.recentlyPreloaded=new Map,this.PRELOAD_GRACE_PERIOD=5e3}}let f=new g;r.default.setPreloader(f),t.ZP=f}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6990,2350],{30803:function(e,r,t){t.d(r,{z:function(){return i}});var o=t(85893),a=t(67294),s=t(88426),n=t(12003),c=t(32350);let l=(0,n.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),i=a.forwardRef((e,r)=>{let{className:t,variant:a,size:n,asChild:i=!1,...u}=e,d=i?s.g7:"button";return(0,o.jsx)(d,{className:(0,c.cn)(l({variant:a,size:n,className:t})),ref:r,...u})});i.displayName="Button"},37673:function(e,r,t){t.d(r,{Ol:function(){return i},Zb:function(){return l},aY:function(){return f},ll:function(){return u}});var o=t(85893),a=t(67294),s=t(45697),n=t.n(s),c=t(32350);let l=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...s,children:a})});l.displayName="Card",l.propTypes={className:n().string,children:n().node};let i=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("flex flex-col space-y-1.5 p-6",t),...s,children:a})});i.displayName="CardHeader",i.propTypes={className:n().string,children:n().node};let u=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("h3",{ref:r,className:(0,c.cn)("text-2xl font-semibold leading-none tracking-tight",t),...s,children:a})});u.displayName="CardTitle",u.propTypes={className:n().string,children:n().node};let d=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("p",{ref:r,className:(0,c.cn)("text-sm text-muted-foreground",t),...s,children:a})});d.displayName="CardDescription",d.propTypes={className:n().string,children:n().node};let f=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("p-6 pt-0",t),...s,children:a})});f.displayName="CardContent",f.propTypes={className:n().string,children:n().node};let p=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("flex items-center p-6 pt-0",t),...s,children:a})});p.displayName="CardFooter",p.propTypes={className:n().string,children:n().node}},17324:function(e,r,t){t.d(r,{MB:function(){return l},eA:function(){return c},getEnabledClouds:function(){return s},getWorkspaces:function(){return a},iE:function(){return u},rF:function(){return d},zl:function(){return i}});var o=t(47145);async function a(){try{let e=await o.x.get("/workspaces");if(!e.ok)throw Error("Error scheduling getWorkspaces: ".concat(e.statusText," (status ").concat(e.status,")"));let r=e.headers.get("X-Skypilot-Request-ID");if(!r){console.warn("X-Skypilot-Request-ID header not found in /workspaces response. Attempting to find request_id in response body as a fallback.");try{let t=await e.json();if(t&&t.request_id)r=t.request_id,console.log("Found request_id in /workspaces response body (fallback):",r);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /workspaces.")}catch(r){let e=r.message||"Error processing fallback for request_id from /workspaces response body.";throw console.error("Error in /workspaces request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!r)throw Error("Failed to obtain X-Skypilot-Request-ID from /workspaces response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching workspace data with request_id: ".concat(r));let t=await o.x.get("/api/get?request_id=".concat(r));if(!t.ok){let e="Error fetching workspace data for request ID ".concat(r,": ").concat(t.statusText," (status ").concat(t.status,")");try{let o=await t.json();if(o&&o.detail){let t=o.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching workspace data for request ID ".concat(r,": ").concat(t)}}catch(e){}throw Error(e)}let a=await t.json();if(console.log("[Connector Debug] Full resultData from /api/get:",a),"FAILED"===a.status){let e="Unknown error during task execution";if(a.error)"string"==typeof a.error?e=a.error:"object"==typeof a.error&&(e=a.error.message||a.error.detail||JSON.stringify(a.error));else if(a.result&&a.result.error)"string"==typeof a.result.error?e=a.result.error:"object"==typeof a.result.error&&(e=a.result.error.message||a.result.error.detail||JSON.stringify(a.result.error));else if(a.return_value)try{let r=JSON.parse(a.return_value);r.error&&(e="string"==typeof r.error?r.error:r.error.message||r.error.detail||JSON.stringify(r.error))}catch(r){(a.return_value.includes("Error")||a.return_value.includes("Cannot"))&&(e=a.return_value)}throw Error(e)}let s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed workspace data from return_value:",s)}catch(e){throw console.error("Failed to parse workspace data from return_value:",e,"Raw return_value:",a.return_value),Error("Failed to parse workspace data for request ID ".concat(r,": ").concat(e.message))}else a.result&&(console.warn("Using resultData.result as fallback for status ".concat(a.status)),s=a.result);return console.log("Effectively fetched workspace data (to be returned):",s),s||{}}catch(e){throw console.error("Failed to fetch workspaces (in getWorkspaces function):",e.message,e.stack),e}}async function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{let t="/enabled_clouds",a=new URLSearchParams;e&&a.append("workspace",e),r&&a.append("expand","true"),a.toString()&&(t+="?".concat(a.toString()));let s=await o.x.get(t);if(!s.ok)throw Error("Error scheduling getEnabledClouds: ".concat(s.statusText," (status ").concat(s.status,")"));let n=s.headers.get("X-Skypilot-Request-ID");if(!n){console.warn("X-Skypilot-Request-ID header not found in /enabled_clouds response. Attempting to find request_id in response body as a fallback.");try{let e=await s.json();if(e&&e.request_id)n=e.request_id,console.log("Found request_id in /enabled_clouds response body (fallback):",n);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /enabled_clouds.")}catch(r){let e=r.message||"Error processing fallback for request_id from /enabled_clouds response body.";throw console.error("Error in /enabled_clouds request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!n)throw Error("Failed to obtain X-Skypilot-Request-ID from /enabled_clouds response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching enabled_clouds data with request_id: ".concat(n));let c=await o.x.get("/api/get?request_id=".concat(n));if(!c.ok){let e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(c.statusText," (status ").concat(c.status,")");try{let r=await c.json();if(r&&r.detail){let t=r.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(t)}}catch(e){}throw Error(e)}let l=await c.json();if(console.log("[Connector Debug] Full resultData from /api/get for enabled_clouds:",l),"FAILED"===l.status){let e=l.error||l.result&&l.result.error||"Unknown error during task execution for enabled_clouds";throw Error("Fetching enabled_clouds data failed for request ID ".concat(n,": ").concat(e))}let i=[];if("SUCCEEDED"===l.status&&l.return_value)try{i=JSON.parse(l.return_value),console.log("Successfully parsed enabled_clouds data for workspace ".concat(e,":"),i)}catch(e){throw console.error("Failed to parse enabled_clouds data from return_value:",e,"Raw return_value:",l.return_value),Error("Failed to parse enabled_clouds data for request ID ".concat(n,": ").concat(e.message))}else l.result&&(console.warn("Using resultData.result as fallback for enabled_clouds status ".concat(l.status)),i=l.result);return Array.isArray(i)?i:[]}catch(e){throw console.error("Failed to fetch enabled_clouds (in getEnabledClouds function):",e.message,e.stack),e}}async function n(e,r){console.log("Polling for ".concat(r," task completion with request_id: ").concat(e));let t=await o.x.get("/api/get?request_id=".concat(e));if(!t.ok){let o="Error fetching ".concat(r," data for request ID ").concat(e,": ").concat(t.statusText," (status ").concat(t.status,")");try{let e=await t.json();if(console.error("[Error Debug] ".concat(r," HTTP error response:"),JSON.stringify(e,null,2)),e&&e.detail){if("object"==typeof e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t&&t.message)o="".concat(r," failed: ").concat(t.message);else if(t&&"object"==typeof t){let e=t.type||JSON.stringify(t);o="".concat(r," failed: ").concat(e)}}catch(t){o="".concat(r," failed: ").concat(e.detail.error)}else if("string"==typeof e.detail)o="".concat(r," failed: ").concat(e.detail);else{let t=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[o,a]of Object.entries(e)){let e=t(a,r?"".concat(r,".").concat(o):o);if(e)return e}return null},a=t(e.detail);a&&(o="".concat(r," failed: ").concat(a))}}}catch(e){console.error("[Error Debug] Failed to parse error response:",e)}throw Error(o)}let a=await t.json();if(console.log("[Connector Debug] ".concat(r," resultData:"),a),"FAILED"===a.status){console.error("[Error Debug] ".concat(r," failed. Full resultData:"),JSON.stringify(a,null,2)),console.error("[Error Debug] resultData.error:",a.error),console.error("[Error Debug] resultData.result:",a.result),console.error("[Error Debug] resultData.return_value:",a.return_value);let e="Unknown error during ".concat(r," task execution");if(a.error)"string"==typeof a.error?e=a.error:"object"==typeof a.error&&(e=a.error.message||a.error.detail||JSON.stringify(a.error));else if(a.result&&a.result.error)"string"==typeof a.result.error?e=a.result.error:"object"==typeof a.result.error&&(e=a.result.error.message||a.result.error.detail||JSON.stringify(a.result.error));else if(a.return_value)try{let r=JSON.parse(a.return_value);r.error&&(e="string"==typeof r.error?r.error:r.error.message||r.error.detail||JSON.stringify(r.error))}catch(r){a.return_value&&(a.return_value.includes("Error")||a.return_value.includes("Cannot"))&&(e=a.return_value)}if(e==="Unknown error during ".concat(r," task execution")){let r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[o,a]of Object.entries(e)){let e=r(a,t?"".concat(t,".").concat(o):o);if(e)return e}return null},t=r(a);t&&(e=t)}throw Error(e)}let s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed ".concat(r," data:"),s)}catch(t){throw console.error("Failed to parse ".concat(r," data from return_value:"),t,"Raw return_value:",a.return_value),Error("Failed to parse ".concat(r," data for request ID ").concat(e,": ").concat(t.message))}else a.result&&(console.warn("Using resultData.result as fallback for ".concat(r," status ").concat(a.status)),s=a.result);return s}async function c(e,r){try{console.log("Updating workspace ".concat(e," with config:"),r);let t=await o.x.post("/workspaces/update",{workspace_name:e,config:r});if(!t.ok)throw Error("Error scheduling updateWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let a=t.headers.get("X-Skypilot-Request-ID");if(!a)throw Error("Failed to obtain request ID for updateWorkspace");return await n(a,"updateWorkspace")}catch(e){throw console.error("Failed to update workspace:",e),e}}let l=async(e,r)=>{try{let t=await o.x.post("/workspaces/create",{workspace_name:e,config:r});if(!t.ok)throw await t.text(),Error("Error scheduling createWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let a=t.headers.get("X-Skypilot-Request-ID");if(!a)throw Error("Failed to obtain request ID for createWorkspace");return await n(a,"createWorkspace")}catch(e){throw console.error("Failed to create workspace:",e),e}};async function i(e){try{console.log("Deleting workspace ".concat(e));let r=await o.x.post("/workspaces/delete",{workspace_name:e});if(!r.ok)throw Error("Error scheduling deleteWorkspace: ".concat(r.statusText," (status ").concat(r.status,")"));let t=r.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for deleteWorkspace");console.log("[Delete Debug] Got request ID for deleteWorkspace: ".concat(t));try{let e=await n(t,"deleteWorkspace");return console.log("[Delete Debug] deleteWorkspace completed successfully:",e),e}catch(e){throw console.error("[Delete Debug] deleteWorkspace failed with error:",e),console.error("[Delete Debug] Error message:",e.message),e}}catch(e){throw console.error("Failed to delete workspace:",e),e}}async function u(){try{console.log("Getting entire SkyPilot configuration");let e=await o.x.get("/workspaces/config");if(!e.ok)throw Error("Error scheduling getConfig: ".concat(e.statusText," (status ").concat(e.status,")"));let r=e.headers.get("X-Skypilot-Request-ID");if(!r)throw Error("Failed to obtain request ID for getConfig");return await n(r,"getConfig")}catch(e){throw console.error("Failed to get config:",e),e}}async function d(e){try{console.log("Updating entire SkyPilot configuration with config:",e);let r=await o.x.post("/workspaces/config",{config:e});if(!r.ok)throw Error("Error scheduling updateConfig: ".concat(r.statusText," (status ").concat(r.status,")"));let t=r.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for updateConfig");return await n(t,"updateConfig")}catch(e){throw console.error("Failed to update config:",e),e}}},32350:function(e,r,t){t.d(r,{cn:function(){return s}});var o=t(90512),a=t(98388);function s(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return(0,a.m6)((0,o.W)(r))}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9353],{9353:function(e,t,r){r.r(t),r.d(t,{Layout:function(){return v}});var s=r(85893),n=r(67294),a=r(66235),l=r(23001),i=r(43767),o=r(33067),c=r(26409),d=r(94849),x=r(6556);function u(){let{startTour:e}=(0,d.r)(),{shouldShowTourPrompt:t,markTourCompleted:r}=(0,x.n)(),[a,l]=(0,n.useState)(!1),[u,m]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(m(!0),t){let e=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(e)}},[t]);let h=()=>{l(!1),r()};return u&&t&&a?(0,s.jsx)("div",{className:"fixed top-20 right-6 z-50 max-w-sm",children:(0,s.jsxs)("div",{className:"bg-white rounded-md shadow-lg border border-gray-200 p-4 transform transition-all duration-300 ease-out",children:[(0,s.jsx)("button",{onClick:h,className:"absolute top-3 right-3 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full p-1 transition-all duration-150","aria-label":"Dismiss notification",children:(0,s.jsx)(i.Z,{className:"w-3 h-3"})}),(0,s.jsxs)("div",{className:"pr-6",children:[(0,s.jsxs)("div",{className:"flex items-start mb-3",children:[(0,s.jsx)("div",{className:"flex items-center justify-center w-7 h-7 bg-blue-50 rounded-full mr-3 mt-0.5",children:(0,s.jsx)(o.Z,{className:"w-3.5 h-3.5 text-blue-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-gray-900 mb-1",children:"Welcome to SkyPilot!"}),(0,s.jsx)("p",{className:"text-sm text-gray-600 leading-relaxed",children:"New to the dashboard? Take a quick guided tour to discover all the features."})]})]}),(0,s.jsxs)("div",{className:"flex space-x-2 ml-10",children:[(0,s.jsxs)("button",{onClick:()=>{l(!1),e()},className:"flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm font-medium rounded hover:bg-blue-700 transition-colors duration-150",children:[(0,s.jsx)(c.Z,{className:"w-3 h-3 mr-1.5"}),"Start Tour"]}),(0,s.jsx)("button",{onClick:h,className:"px-3 py-1.5 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded transition-colors duration-150",children:"Maybe Later"})]})]})]})}):null}var m=r(19185);function h(e){let{children:t,text:r}=e,[a,l]=(0,n.useState)(!1);return(0,s.jsxs)("div",{className:"relative",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[t,a&&(0,s.jsx)("div",{className:"absolute top-0 right-0 transform -translate-y-full -translate-x-2 mb-2 px-2 py-1 bg-gray-700 text-white text-xs rounded-md shadow-lg whitespace-nowrap z-50",children:r})]})}function f(){let{startTour:e}=(0,d.r)();return(0,s.jsx)(h,{text:"Start a tour",children:(0,s.jsx)("button",{onClick:e,className:"fixed bottom-4 right-4 bg-transparent text-gray-400 p-2 rounded-full hover:text-gray-500 focus:outline-none","aria-label":"Start Tour",children:(0,s.jsx)(m.Z,{className:"h-5 w-5"})})})}let p=(0,n.createContext)(void 0);function g(e){let{children:t}=e,[r,a]=(0,n.useState)(!1),l=(0,n.useCallback)(()=>{a(!0)},[]),i=(0,n.useCallback)(()=>{a(!1)},[]);return(0,s.jsx)(p.Provider,{value:{isUpgrading:r,reportUpgrade:l,clearUpgrade:i},children:t})}function b(){let e=(0,n.useContext)(p);if(!e)throw Error("useUpgradeDetection must be used within UpgradeDetectionProvider");return e}function j(){let{isUpgrading:e}=b();return e?(0,s.jsx)("div",{className:"fixed top-[56px] left-0 right-0 z-40 bg-yellow-50 border-b border-yellow-200",children:(0,s.jsx)("div",{className:"max-w-7xl mx-auto py-3 px-4 sm:px-6 lg:px-8",children:(0,s.jsx)("div",{className:"flex items-center justify-center",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsxs)("svg",{className:"h-5 w-5 text-yellow-600 mr-2 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,s.jsx)("span",{className:"text-sm font-medium text-yellow-800",children:"Your SkyPilot deployment is undergoing upgrades. Refresh in a few moments."})]})})})}):null}function y(e){let{children:t,highlighted:r}=e;(0,l.X)();let{reportUpgrade:i,clearUpgrade:o,isUpgrading:c}=b();return(0,n.useEffect)(()=>{window.__upgradeInterceptorInstalled||(window.fetch=function(e,t){let r=window.fetch;return async function(s,n){let a;try{a=await r(s,n)}catch(e){throw e}try{if(function(e){let t;try{t="string"==typeof e?e:e.url}catch(e){return!1}return["/_next/static/","/_next/image",".js",".mjs",".css",".woff",".woff2",".ttf",".eot",".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].some(e=>t.includes(e))}(s))return a;if(503===a.status){let t=a.clone();try{let r=await t.json();r.detail&&(r.detail.includes("shutting down")||r.detail.includes("try again later"))&&e()}catch(e){console.debug("Non-JSON 503 response, ignoring.")}}else(a.ok||a.status>=200&&a.status<300)&&t()}catch(e){console.error("Error in upgrade detection interceptor:",e)}return a}}(i,o),window.__upgradeInterceptorInstalled=!0)},[i,o]),(0,s.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,s.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 shadow-sm",children:(0,s.jsx)(a.Du,{})}),(0,s.jsx)(j,{}),(0,s.jsx)("div",{className:"transition-all duration-200 ease-in-out min-h-screen",style:{paddingTop:c?"112px":"56px"},children:(0,s.jsx)("main",{className:"p-6",children:t})}),(0,s.jsx)(u,{}),(0,s.jsx)(f,{})]})}function v(e){return(0,s.jsx)(g,{children:(0,s.jsx)(a.Hn,{children:(0,s.jsx)(y,{...e})})})}},66235:function(e,t,r){r.d(t,{Ap:function(){return y},Du:function(){return v},Hn:function(){return j}});var s=r(85893),n=r(67294),a=r(25675),l=r.n(a),i=r(11163),o=r(41664),c=r.n(o),d=r(53850),x=r(40355),u=r(6021),m=r(93225),h=r(36989),f=r(23001),p=r(23800);let g={key:d._m,server:d.QT,briefcase:d.Vp,chip:d.PC,book:d.E9,users:d.oy,volume:d.eU},b=(0,n.createContext)(null);function j(e){let{children:t}=e,[r,a]=(0,n.useState)(!0),[l,i]=(0,n.useState)(!1),[o,c]=(0,n.useState)(null),[d,x]=(0,n.useState)(null),u=window.location.origin,h="".concat(u).concat(m.f4);return(0,n.useEffect)(()=>{fetch("".concat(h,"/api/health")).then(e=>e.json()).then(e=>{e.user&&e.user.name&&(c(e.user.name),(async()=>{try{let e=await fetch("".concat(h,"/users/role"));if(e.ok){let t=await e.json();t.role&&x(t.role)}}catch(e){console.log("Could not fetch user role:",e)}})())}).catch(e=>{console.error("Error fetching user data:",e)})},[h]),(0,s.jsx)(b.Provider,{value:{isSidebarOpen:r,toggleSidebar:()=>{a(e=>!e)},isMobileSidebarOpen:l,toggleMobileSidebar:()=>{i(e=>!e)},userEmail:o,userRole:d},children:t})}function y(){let e=(0,n.useContext)(b);if(!e)throw Error("useSidebar must be used within a SidebarProvider");return e}function v(){let e,t;let r=(0,i.useRouter)(),a=(0,f.X)(),{userEmail:o,userRole:b,isMobileSidebarOpen:j,toggleMobileSidebar:v}=y(),[N,w]=(0,n.useState)(!1),[k,C]=(0,n.useState)(null),{ungrouped:S,groups:E}=(0,p.d7)(),_=(0,p.x1)(),W=(0,n.useRef)(null),z=(0,n.useRef)(null),L=(0,n.useRef)(null);(0,n.useEffect)(()=>{function e(e){W.current&&!W.current.contains(e.target)&&w(!1),z.current&&!z.current.contains(e.target)&&!e.target.closest(".mobile-menu-button")&&j&&v(),L.current&&!L.current.contains(e.target)&&C(null)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[W,j,v]);let U=e=>"/workspaces"===e?r.pathname.startsWith("/workspaces")||r.pathname.startsWith("/workspace"):r.pathname.startsWith(e),H=e=>{let t=U(e);return"inline-flex items-center border-b-2 ".concat(t?"border-transparent text-blue-600":"border-transparent hover:text-blue-600"," ").concat(a?"px-2 py-1":"px-1 pt-1 space-x-2")},M=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!t&&U(e);return"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(r?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600")},P=(e,t)=>{let r=g[e];return r?n.createElement(r,{className:t}):e},D=e=>(0,s.jsxs)(s.Fragment,{children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none mr-1","aria-hidden":"true",children:P(e.icon,"w-4 h-4")}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{children:e.label}),e.badge&&(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-wide bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded-full",children:e.badge})]})]}),T=e=>{if("string"!=typeof e)return e;let t=_.find(t=>t.path===e);if(!t||!t.path.startsWith("/plugins"))return e;let r=t.path.replace(/^\/+/,"").split("/").slice(1).filter(Boolean);return{pathname:"/plugins/[...slug]",query:r.length?{slug:r}:{}}},F=e=>e.external?(0,s.jsx)("a",{href:e.href,target:e.target,rel:e.rel,className:"inline-flex items-center border-b-2 border-transparent px-1 pt-1 space-x-2 text-gray-700 hover:text-blue-600",children:D(e)},e.id):(0,s.jsx)(c(),{href:T(e.href),className:H(e.href),prefetch:!1,children:D(e)},e.id),R=e=>{let t=(0,s.jsxs)(s.Fragment,{children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none mr-2","aria-hidden":"true",children:P(e.icon,"w-5 h-5")}),(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{children:e.label}),e.badge&&(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-wide bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded-full",children:e.badge})]})]});return e.external?(0,s.jsx)("a",{href:e.href,target:e.target,rel:e.rel,className:M(e.href,!0),onClick:v,children:t},e.id):(0,s.jsx)(c(),{href:T(e.href),className:M(e.href),onClick:v,prefetch:!1,children:t},e.id)},Z=(e,t)=>{let r=k===e;return(0,s.jsxs)("div",{className:"relative",ref:L,children:[(0,s.jsxs)("button",{onClick:()=>C(r?null:e),className:"inline-flex items-center align-middle border-b-2 px-1 pt-1 space-x-1 ".concat(r?"text-blue-600 border-blue-600":"border-transparent text-gray-700 hover:text-blue-600"),children:[(0,s.jsx)("span",{children:e}),(0,s.jsx)("svg",{className:"w-4 h-4 transition-transform ".concat(r?"rotate-180":""),fill:"currentColor",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})]}),r&&(0,s.jsx)("div",{className:"absolute top-full left-0 mt-1 min-w-[8rem] bg-white rounded-md shadow-lg border border-gray-200 z-50",children:(0,s.jsx)("div",{className:"py-1",children:t.map(e=>(0,s.jsx)(c(),{href:T(e.href),className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition-colors",onClick:()=>C(null),prefetch:!1,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none",children:P(e.icon,"w-4 h-4")}),(0,s.jsx)("span",{children:e.label})]})},e.id))})})]},e)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed top-0 left-0 right-0 bg-white z-30 h-14 px-4 border-b border-gray-200 shadow-sm",children:(0,s.jsxs)("div",{className:"flex items-center justify-between h-full",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-4 mr-4 md:mr-6",children:[a&&(0,s.jsx)("button",{onClick:v,className:"mobile-menu-button p-2 rounded-md text-gray-600 hover:text-blue-600 hover:bg-gray-100 transition-colors","aria-label":"Toggle mobile menu",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:j?"M6 18L18 6M6 6l12 12":"M4 6h16M4 12h16M4 18h16"})})}),(0,s.jsx)(c(),{href:"/",className:"flex items-center px-1 pt-1 h-full",prefetch:!1,children:(0,s.jsx)("div",{className:"h-20 w-20 flex items-center justify-center",children:(0,s.jsx)(l(),{src:"".concat(m.GW,"/skypilot.svg"),alt:"SkyPilot Logo",width:80,height:80,priority:!0,className:"w-full h-full object-contain"})})})]}),!a&&(0,s.jsxs)("div",{className:"flex items-center space-x-2 md:space-x-4 mr-6",children:[(0,s.jsxs)(c(),{href:"/clusters",className:H("/clusters"),prefetch:!1,children:[(0,s.jsx)(d.QT,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Clusters"})]}),(0,s.jsxs)(c(),{href:"/jobs",className:H("/jobs"),prefetch:!1,children:[(0,s.jsx)(d.Vp,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Jobs"})]}),(0,s.jsxs)(c(),{href:"/volumes",className:H("/volumes"),prefetch:!1,children:[(0,s.jsx)(d.eU,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Volumes"})]}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"}),(0,s.jsxs)(c(),{href:"/infra",className:H("/infra"),prefetch:!1,children:[(0,s.jsx)(d.PC,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Infra"})]}),(0,s.jsxs)(c(),{href:"/workspaces",className:H("/workspaces"),prefetch:!1,children:[(0,s.jsx)(d.E9,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Workspaces"})]}),(0,s.jsxs)(c(),{href:"/users",className:H("/users"),prefetch:!1,children:[(0,s.jsx)(d.oy,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Users"})]})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-1 ml-auto",children:[!a&&(0,s.jsxs)(s.Fragment,{children:[S.map(e=>F(e)),Object.entries(E).map(e=>{let[t,r]=e;return Z(t,r)}),(0,s.jsx)(h.WH,{content:"Documentation",className:"text-sm text-muted-foreground",children:(0,s.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center align-middle border-b-2 border-transparent px-1 pt-1 space-x-1 text-gray-600 hover:text-blue-600 transition-colors duration-150 cursor-pointer",title:"Docs",children:[(0,s.jsx)("span",{className:"leading-none",children:"Docs"}),(0,s.jsx)(d.h0,{className:"w-3.5 h-3.5"})]})}),(0,s.jsx)(h.WH,{content:"GitHub Repository",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"GitHub",children:(0,s.jsx)(d.fy,{className:"w-5 h-5"})})}),(0,s.jsx)(h.WH,{content:"Join Slack",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Slack",children:(0,s.jsx)(d.mU,{className:"w-5 h-5"})})}),(0,s.jsx)(h.WH,{content:"Leave Feedback",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://github.com/skypilot-org/skypilot/issues/new",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Leave Feedback",children:(0,s.jsx)(d.aD,{className:"w-5 h-5"})})}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6"}),(0,s.jsx)(h.WH,{content:"Configuration",className:"text-sm text-muted-foreground",children:(0,s.jsx)(c(),{href:"/config",className:"inline-flex items-center justify-center p-2 rounded-full transition-colors duration-150 cursor-pointer ".concat(U("/config")?"text-blue-600 hover:bg-gray-100":"text-gray-600 hover:bg-gray-100"),title:"Configuration",prefetch:!1,children:(0,s.jsx)(x.Z,{className:"w-5 h-5"})})})]}),o&&(0,s.jsxs)("div",{className:"relative",ref:W,children:[(0,s.jsx)("button",{onClick:()=>w(!N),className:"inline-flex items-center justify-center rounded-full transition-colors duration-150 cursor-pointer hover:ring-2 hover:ring-blue-200",title:"User Profile",children:(0,s.jsx)("div",{className:"".concat(a?"w-6 h-6 text-xs":"w-7 h-7 text-sm"," bg-blue-600 text-white rounded-full flex items-center justify-center font-medium hover:bg-blue-700 transition-colors"),children:o?o.includes("@")?o.split("@")[0].charAt(0).toUpperCase():o.charAt(0).toUpperCase():"?"})}),N&&(0,s.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-50 border border-gray-200",children:[(e=o,t=null,o&&o.includes("@")&&(e=o.split("@")[0],t=o),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"px-4 pt-2 pb-1 text-sm font-medium text-gray-900",children:e}),t&&(0,s.jsx)("div",{className:"px-4 pt-0 pb-1 text-xs text-gray-500",children:t}),b&&(0,s.jsx)("div",{className:"px-4 pt-0 pb-2 text-xs",children:"admin"===b?(0,s.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,s.jsx)(d.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,s.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,s.jsx)(u.Z,{className:"w-3 h-3 mr-1"}),"User"]})})]})),(0,s.jsx)("div",{className:"border-t border-gray-200 mx-1 my-1"}),(0,s.jsx)(c(),{href:"/users",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-blue-600",onClick:()=>w(!1),prefetch:!1,children:"See all users"})]})]})]}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"})]})}),a&&(0,s.jsxs)(s.Fragment,{children:[j&&(0,s.jsx)("div",{className:"fixed top-14 left-0 right-0 bottom-0 bg-black bg-opacity-50 z-40",onClick:v}),(0,s.jsx)("div",{ref:z,className:"fixed top-14 left-0 h-[calc(100vh-56px)] w-64 bg-white border-r border-gray-200 shadow-lg z-50 transform transition-transform duration-300 ease-in-out ".concat(j?"translate-x-0":"-translate-x-full"),children:(0,s.jsx)("nav",{className:"flex-1 overflow-y-auto py-6",children:(0,s.jsxs)("div",{className:"px-4 space-y-1",children:[(0,s.jsxs)(c(),{href:"/clusters",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/clusters")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.QT,{className:"w-5 h-5 mr-3"}),"Clusters"]}),(0,s.jsxs)(c(),{href:"/jobs",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/jobs")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.Vp,{className:"w-5 h-5 mr-3"}),"Jobs"]}),(0,s.jsxs)(c(),{href:"/volumes",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/volumes")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.eU,{className:"w-5 h-5 mr-3"}),"Volumes"]}),(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),(0,s.jsxs)(c(),{href:"/infra",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/infra")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.PC,{className:"w-5 h-5 mr-3"}),"Infra"]}),(0,s.jsxs)(c(),{href:"/workspaces",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/workspaces")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.E9,{className:"w-5 h-5 mr-3"}),"Workspaces"]}),(0,s.jsxs)(c(),{href:"/users",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/users")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.oy,{className:"w-5 h-5 mr-3"}),"Users"]}),(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),S.map(e=>R(e)),Object.entries(E).map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:t}),r.map(e=>R(e))]},t)}),(S.length>0||Object.keys(E).length>0)&&(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),(0,s.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:v,children:[(0,s.jsx)(d.h0,{className:"w-5 h-5 mr-3"}),"Documentation"]}),(0,s.jsxs)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:v,children:[(0,s.jsx)(d.fy,{className:"w-5 h-5 mr-3"}),"GitHub"]}),(0,s.jsxs)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:v,children:[(0,s.jsx)(d.mU,{className:"w-5 h-5 mr-3"}),"Slack"]}),(0,s.jsxs)(c(),{href:"/config",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/config")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(x.Z,{className:"w-5 h-5 mr-3"}),"Configuration"]})]})})})]})]})}},23001:function(e,t,r){r.d(t,{X:function(){return n}});var s=r(67294);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let t=()=>{r(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}}}]);