nebu 0.1.70__py3-none-any.whl → 0.1.72__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.
- nebu/orign.py +70 -0
- nebu/processors/decorate.py +33 -25
- {nebu-0.1.70.dist-info → nebu-0.1.72.dist-info}/METADATA +1 -1
- {nebu-0.1.70.dist-info → nebu-0.1.72.dist-info}/RECORD +7 -6
- {nebu-0.1.70.dist-info → nebu-0.1.72.dist-info}/WHEEL +0 -0
- {nebu-0.1.70.dist-info → nebu-0.1.72.dist-info}/licenses/LICENSE +0 -0
- {nebu-0.1.70.dist-info → nebu-0.1.72.dist-info}/top_level.txt +0 -0
nebu/orign.py
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
import os
|
2
|
+
from dataclasses import dataclass
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
import yaml
|
6
|
+
|
7
|
+
|
8
|
+
@dataclass
|
9
|
+
class OrignServerConfig:
|
10
|
+
"""
|
11
|
+
Python equivalent of the Rust ServerConfig struct.
|
12
|
+
"""
|
13
|
+
|
14
|
+
name: Optional[str] = None
|
15
|
+
api_key: Optional[str] = None
|
16
|
+
server: Optional[str] = None
|
17
|
+
auth_server: Optional[str] = None
|
18
|
+
|
19
|
+
|
20
|
+
def get_orign_server() -> Optional[str]:
|
21
|
+
"""
|
22
|
+
Get the Orign server URL from environment variables.
|
23
|
+
"""
|
24
|
+
env = os.environ.get("ORIGN_SERVER") or os.environ.get("ORIGIN_SERVER")
|
25
|
+
if env:
|
26
|
+
return env
|
27
|
+
|
28
|
+
path = _get_config_file_path()
|
29
|
+
path_exists = os.path.exists(path)
|
30
|
+
|
31
|
+
# Load from disk or create a default
|
32
|
+
if path_exists:
|
33
|
+
try:
|
34
|
+
with open(path, "r") as yaml_file:
|
35
|
+
data = yaml.safe_load(yaml_file) or {}
|
36
|
+
# Convert each server entry into a ServerConfig
|
37
|
+
servers_data = data.get("servers", [])
|
38
|
+
# Ensure data is a list and elements are dicts before comprehension
|
39
|
+
if isinstance(servers_data, list):
|
40
|
+
servers = [
|
41
|
+
OrignServerConfig(**srv)
|
42
|
+
for srv in servers_data
|
43
|
+
if isinstance(srv, dict)
|
44
|
+
]
|
45
|
+
else:
|
46
|
+
servers = [] # Or handle error appropriately
|
47
|
+
current_server = data.get("current_server")
|
48
|
+
|
49
|
+
for srv in servers:
|
50
|
+
if srv.name == current_server:
|
51
|
+
return srv.server
|
52
|
+
|
53
|
+
return None
|
54
|
+
except (yaml.YAMLError, TypeError, FileNotFoundError) as e:
|
55
|
+
# Handle potential issues during loading or parsing
|
56
|
+
print(
|
57
|
+
f"Warning: Could not load or parse config file '{path}': {e}. Starting with default config."
|
58
|
+
)
|
59
|
+
return None
|
60
|
+
|
61
|
+
return None
|
62
|
+
|
63
|
+
|
64
|
+
def _get_config_file_path() -> str:
|
65
|
+
"""
|
66
|
+
Return the path to ~/.agentsea/orign.yaml
|
67
|
+
"""
|
68
|
+
home = os.path.expanduser("~")
|
69
|
+
config_dir = os.path.join(home, ".agentsea")
|
70
|
+
return os.path.join(config_dir, "orign.yaml")
|
nebu/processors/decorate.py
CHANGED
@@ -37,6 +37,7 @@ from nebu.containers.models import (
|
|
37
37
|
)
|
38
38
|
from nebu.data import Bucket
|
39
39
|
from nebu.meta import V1ResourceMetaRequest
|
40
|
+
from nebu.orign import get_orign_server
|
40
41
|
from nebu.processors.models import (
|
41
42
|
Message,
|
42
43
|
V1Scale,
|
@@ -444,31 +445,38 @@ def processor(
|
|
444
445
|
# --- Get API Key ---
|
445
446
|
print("[DEBUG Decorator] Loading Nebu configuration...")
|
446
447
|
try:
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
)
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
448
|
+
pass
|
449
|
+
# config = GlobalConfig.read()
|
450
|
+
# current_server = config.get_current_server_config()
|
451
|
+
# if not current_server or not current_server.api_key:
|
452
|
+
# raise ValueError("Nebu server configuration or API key not found.")
|
453
|
+
# api_key = current_server.api_key
|
454
|
+
# print("[DEBUG Decorator] Nebu API key loaded successfully.")
|
455
|
+
|
456
|
+
# # Add additional environment variables from current configuration
|
457
|
+
# all_env.append(V1EnvVar(key="AGENTSEA_API_KEY", value=api_key))
|
458
|
+
|
459
|
+
# # Get server URL and auth server URL from current configuration
|
460
|
+
# server_url = (
|
461
|
+
# current_server.server
|
462
|
+
# if current_server
|
463
|
+
# else GlobalConfig.get_server_url()
|
464
|
+
# )
|
465
|
+
# auth_server_url = current_server.auth_server if current_server else None
|
466
|
+
|
467
|
+
# if server_url:
|
468
|
+
# all_env.append(V1EnvVar(key="NEBULOUS_SERVER", value=server_url))
|
469
|
+
|
470
|
+
# if auth_server_url:
|
471
|
+
# all_env.append(
|
472
|
+
# V1EnvVar(key="AGENTSEA_AUTH_SERVER", value=auth_server_url)
|
473
|
+
# )
|
474
|
+
|
475
|
+
# orign_server = get_orign_server()
|
476
|
+
# if orign_server:
|
477
|
+
# all_env.append(V1EnvVar(key="ORIGN_SERVER", value=orign_server))
|
478
|
+
# else:
|
479
|
+
# print("[DEBUG Decorator] No Orign server found. Not setting...")
|
472
480
|
|
473
481
|
except Exception as e:
|
474
482
|
print(f"ERROR: Failed to load Nebu configuration or API key: {e}")
|
@@ -4,6 +4,7 @@ nebu/cache.py,sha256=jmluqvWnE9N8uNq6nppXSxEJK7DKWaB79GicaGg9KmY,4718
|
|
4
4
|
nebu/config.py,sha256=C5Jt9Bd0i0HrgzBSVNJ-Ml3KwX_gaYbYYZEtNL2gvJg,7031
|
5
5
|
nebu/data.py,sha256=X0aAJYuHNVcTCRHpIDDm546HwMqIZpv40lGrozlL41A,39797
|
6
6
|
nebu/meta.py,sha256=CzFHMND9seuewzq9zNNx9WTr6JvrCBExe7BLqDSr7lM,745
|
7
|
+
nebu/orign.py,sha256=SkVfHgpadwik58KCZCrjdV5EHY0dhpEhDvijzLxY11Y,2052
|
7
8
|
nebu/builders/builder.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
9
|
nebu/builders/models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
10
|
nebu/containers/container.py,sha256=yb7KaPTVXnEEAlrpdlUi4HNqF6P7z9bmwAILGlq6iqU,13502
|
@@ -13,15 +14,15 @@ nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,251
|
|
13
14
|
nebu/namespaces/models.py,sha256=EqUOpzhVBhvJw2P92ONDUbIgC31M9jMmcaG5vyOrsWg,497
|
14
15
|
nebu/namespaces/namespace.py,sha256=Q_EDH7BgQrTkaDh_l4tbo22qpq-uARfIk8ZPBLjITGY,4967
|
15
16
|
nebu/processors/consumer.py,sha256=wFxPwLXCrRM8eD4nd6pQsGW46e06rbkoF5YZihodjVk,33857
|
16
|
-
nebu/processors/decorate.py,sha256=
|
17
|
+
nebu/processors/decorate.py,sha256=U_ogaebtVrQP9WqpSx32R-Sw4yLVl16Jajg5kIGz90I,54048
|
17
18
|
nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
|
18
19
|
nebu/processors/models.py,sha256=y40HoW-MEzDWB2dm_tsYlUy3Nf3s6eiLC0iGO9BoNog,3956
|
19
20
|
nebu/processors/processor.py,sha256=PsLs-Oo0bcvqoDKHErpOaic25y8uvTQ8KxtyFwLptW0,16165
|
20
21
|
nebu/processors/remote.py,sha256=TeAIPGEMqnDIb7H1iett26IEZrBlcbPB_-DSm6jcH1E,1285
|
21
22
|
nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
|
22
23
|
nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
|
-
nebu-0.1.
|
24
|
-
nebu-0.1.
|
25
|
-
nebu-0.1.
|
26
|
-
nebu-0.1.
|
27
|
-
nebu-0.1.
|
24
|
+
nebu-0.1.72.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
25
|
+
nebu-0.1.72.dist-info/METADATA,sha256=_ny8BqaWyiBInGJNxNMYgX7utIMTFIZL5a6h7MTNI6o,1731
|
26
|
+
nebu-0.1.72.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
27
|
+
nebu-0.1.72.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
|
28
|
+
nebu-0.1.72.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|