erdo 0.1.4__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.
Potentially problematic release.
This version of erdo might be problematic. Click here for more details.
- erdo/__init__.py +35 -0
- erdo/_generated/__init__.py +18 -0
- erdo/_generated/actions/__init__.py +32 -0
- erdo/_generated/actions/analysis.py +67 -0
- erdo/_generated/actions/bot.py +124 -0
- erdo/_generated/actions/codeexec.py +172 -0
- erdo/_generated/actions/llm.py +104 -0
- erdo/_generated/actions/memory.py +252 -0
- erdo/_generated/actions/resource_definitions.py +194 -0
- erdo/_generated/actions/utils.py +397 -0
- erdo/_generated/actions/webparser.py +109 -0
- erdo/_generated/actions/websearch.py +75 -0
- erdo/_generated/condition/__init__.py +504 -0
- erdo/_generated/internal.py +51 -0
- erdo/_generated/internal_actions.py +79 -0
- erdo/_generated/parameters.py +17 -0
- erdo/_generated/secrets.py +17 -0
- erdo/_generated/template_functions.py +55 -0
- erdo/_generated/types.py +2514 -0
- erdo/actions/__init__.py +40 -0
- erdo/cli_entry.py +73 -0
- erdo/conditions/__init__.py +11 -0
- erdo/install_cli.py +140 -0
- erdo/integrations.py +131 -0
- erdo/py.typed +1 -0
- erdo/state.py +376 -0
- erdo/template.py +136 -0
- erdo/types.py +1142 -0
- erdo-0.1.4.dist-info/METADATA +344 -0
- erdo-0.1.4.dist-info/RECORD +33 -0
- erdo-0.1.4.dist-info/WHEEL +4 -0
- erdo-0.1.4.dist-info/entry_points.txt +2 -0
- erdo-0.1.4.dist-info/licenses/LICENSE +22 -0
erdo/actions/__init__.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
|
|
2
|
+
# Generated by: erdo gen-client
|
|
3
|
+
"""
|
|
4
|
+
Actions module re-exports.
|
|
5
|
+
|
|
6
|
+
This module provides clean access to all action services from the top level.
|
|
7
|
+
Users can import like: from erdo.actions import llm, bot, memory
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# Import all services as modules
|
|
11
|
+
from .._generated.actions import analysis # noqa: F401
|
|
12
|
+
from .._generated.actions import bot # noqa: F401
|
|
13
|
+
from .._generated.actions import codeexec # noqa: F401
|
|
14
|
+
from .._generated.actions import llm # noqa: F401
|
|
15
|
+
from .._generated.actions import memory # noqa: F401
|
|
16
|
+
from .._generated.actions import resource_definitions # noqa: F401
|
|
17
|
+
from .._generated.actions import utils # noqa: F401
|
|
18
|
+
from .._generated.actions import webparser # noqa: F401
|
|
19
|
+
from .._generated.actions import websearch # noqa: F401
|
|
20
|
+
|
|
21
|
+
# Import internal actions explicitly
|
|
22
|
+
from .._generated.internal_actions import ( # noqa: F401
|
|
23
|
+
checkpoint_attempt,
|
|
24
|
+
refresh_resource,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Make all services available for import
|
|
28
|
+
__all__ = [
|
|
29
|
+
"checkpoint_attempt",
|
|
30
|
+
"refresh_resource",
|
|
31
|
+
"analysis",
|
|
32
|
+
"bot",
|
|
33
|
+
"llm",
|
|
34
|
+
"resource_definitions",
|
|
35
|
+
"utils",
|
|
36
|
+
"codeexec",
|
|
37
|
+
"memory",
|
|
38
|
+
"webparser",
|
|
39
|
+
"websearch",
|
|
40
|
+
]
|
erdo/cli_entry.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""CLI entry point that executes the downloaded Erdo CLI binary."""
|
|
3
|
+
|
|
4
|
+
import platform
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Optional
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_binary_path() -> Path:
|
|
13
|
+
"""Get the path to the CLI binary."""
|
|
14
|
+
package_dir = Path(__file__).parent
|
|
15
|
+
bin_dir = package_dir / "bin"
|
|
16
|
+
|
|
17
|
+
# Determine binary name based on platform
|
|
18
|
+
if platform.system().lower() == "windows":
|
|
19
|
+
binary_name = "erdo.exe"
|
|
20
|
+
else:
|
|
21
|
+
binary_name = "erdo"
|
|
22
|
+
|
|
23
|
+
return bin_dir / binary_name
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def find_system_cli() -> Optional[str]:
|
|
27
|
+
"""Find erdo CLI in system PATH, excluding pyenv shims."""
|
|
28
|
+
erdo_path = shutil.which("erdo")
|
|
29
|
+
if erdo_path and "pyenv/shims" not in erdo_path:
|
|
30
|
+
return erdo_path
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def main() -> None:
|
|
35
|
+
"""Main CLI entry point."""
|
|
36
|
+
# First, check if erdo is available in system PATH
|
|
37
|
+
system_cli = find_system_cli()
|
|
38
|
+
if system_cli:
|
|
39
|
+
try:
|
|
40
|
+
result = subprocess.run([system_cli] + sys.argv[1:])
|
|
41
|
+
sys.exit(result.returncode)
|
|
42
|
+
except Exception as e:
|
|
43
|
+
print(f"Error executing system CLI: {e}")
|
|
44
|
+
# Fall through to try local binary
|
|
45
|
+
|
|
46
|
+
# Check for local binary
|
|
47
|
+
binary_path = get_binary_path()
|
|
48
|
+
if not binary_path.exists():
|
|
49
|
+
try:
|
|
50
|
+
from .install_cli import download_and_install_cli
|
|
51
|
+
|
|
52
|
+
download_and_install_cli()
|
|
53
|
+
except Exception as e:
|
|
54
|
+
print(f"Failed to download CLI: {e}")
|
|
55
|
+
print(
|
|
56
|
+
"Please manually download from: https://github.com/erdoai/homebrew-tap/releases"
|
|
57
|
+
)
|
|
58
|
+
sys.exit(1)
|
|
59
|
+
|
|
60
|
+
# Execute the local binary with all arguments
|
|
61
|
+
try:
|
|
62
|
+
result = subprocess.run([str(binary_path)] + sys.argv[1:])
|
|
63
|
+
sys.exit(result.returncode)
|
|
64
|
+
except FileNotFoundError:
|
|
65
|
+
print(f"Error: CLI binary not found at {binary_path}")
|
|
66
|
+
sys.exit(1)
|
|
67
|
+
except Exception as e:
|
|
68
|
+
print(f"Error executing CLI: {e}")
|
|
69
|
+
sys.exit(1)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
if __name__ == "__main__":
|
|
73
|
+
main()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
|
|
2
|
+
# Generated by: erdo gen-client
|
|
3
|
+
"""
|
|
4
|
+
Conditions module for clean imports.
|
|
5
|
+
|
|
6
|
+
This module re-exports all condition classes from the generated condition module
|
|
7
|
+
so users can import like: from erdo.conditions import IsSuccess, And
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# Re-export all condition classes from _generated
|
|
11
|
+
from .._generated.condition import * # noqa: F403,F401
|
erdo/install_cli.py
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Post-install script to download Erdo CLI binary from GitHub releases."""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import platform
|
|
6
|
+
import shutil
|
|
7
|
+
import urllib.request
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_platform_info():
|
|
12
|
+
"""Get platform and architecture information."""
|
|
13
|
+
system = platform.system().lower()
|
|
14
|
+
machine = platform.machine().lower()
|
|
15
|
+
|
|
16
|
+
# Normalize architecture names
|
|
17
|
+
if machine in ["x86_64", "amd64"]:
|
|
18
|
+
arch = "amd64"
|
|
19
|
+
elif machine in ["aarch64", "arm64"]:
|
|
20
|
+
arch = "arm64"
|
|
21
|
+
else:
|
|
22
|
+
raise RuntimeError(f"Unsupported architecture: {machine}")
|
|
23
|
+
|
|
24
|
+
# Map platform names
|
|
25
|
+
if system == "darwin":
|
|
26
|
+
platform_name = "darwin"
|
|
27
|
+
elif system == "linux":
|
|
28
|
+
platform_name = "linux"
|
|
29
|
+
elif system == "windows":
|
|
30
|
+
platform_name = "windows"
|
|
31
|
+
else:
|
|
32
|
+
raise RuntimeError(f"Unsupported platform: {system}")
|
|
33
|
+
|
|
34
|
+
return platform_name, arch
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_download_url(version="latest"):
|
|
38
|
+
"""Get the download URL for the CLI binary."""
|
|
39
|
+
platform_name, arch = get_platform_info()
|
|
40
|
+
|
|
41
|
+
# Construct the binary name based on GoReleaser naming convention
|
|
42
|
+
if platform_name == "windows":
|
|
43
|
+
binary_name = f"erdo-cli_Windows_{arch}.zip"
|
|
44
|
+
else:
|
|
45
|
+
# For Unix-like systems, use tar.gz
|
|
46
|
+
if arch == "amd64":
|
|
47
|
+
arch_name = "x86_64"
|
|
48
|
+
else:
|
|
49
|
+
arch_name = arch
|
|
50
|
+
|
|
51
|
+
platform_title = platform_name.title()
|
|
52
|
+
binary_name = f"erdo-cli_{platform_title}_{arch_name}.tar.gz"
|
|
53
|
+
|
|
54
|
+
base_url = "https://github.com/erdoai/homebrew-tap/releases"
|
|
55
|
+
if version == "latest":
|
|
56
|
+
return f"{base_url}/latest/download/{binary_name}"
|
|
57
|
+
else:
|
|
58
|
+
return f"{base_url}/download/{version}/{binary_name}"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def download_and_install_cli():
|
|
62
|
+
"""Download and install the CLI binary."""
|
|
63
|
+
try:
|
|
64
|
+
# Get the installation directory
|
|
65
|
+
package_dir = Path(__file__).parent
|
|
66
|
+
bin_dir = package_dir / "bin"
|
|
67
|
+
bin_dir.mkdir(exist_ok=True)
|
|
68
|
+
|
|
69
|
+
platform_name, arch = get_platform_info()
|
|
70
|
+
|
|
71
|
+
# Determine the final binary name
|
|
72
|
+
if platform_name == "windows":
|
|
73
|
+
binary_name = "erdo.exe"
|
|
74
|
+
else:
|
|
75
|
+
binary_name = "erdo"
|
|
76
|
+
|
|
77
|
+
binary_path = bin_dir / binary_name
|
|
78
|
+
|
|
79
|
+
# Skip if binary already exists
|
|
80
|
+
if binary_path.exists():
|
|
81
|
+
print(f"Erdo CLI already installed at {binary_path}")
|
|
82
|
+
return
|
|
83
|
+
|
|
84
|
+
print("Downloading Erdo CLI...")
|
|
85
|
+
download_url = get_download_url()
|
|
86
|
+
|
|
87
|
+
# Download the archive
|
|
88
|
+
archive_path = bin_dir / "erdo-cli-archive"
|
|
89
|
+
urllib.request.urlretrieve(download_url, archive_path)
|
|
90
|
+
|
|
91
|
+
# Extract the binary
|
|
92
|
+
if platform_name == "windows":
|
|
93
|
+
import zipfile
|
|
94
|
+
|
|
95
|
+
with zipfile.ZipFile(archive_path, "r") as zip_ref:
|
|
96
|
+
# Extract erdo.exe from the zip
|
|
97
|
+
for file_info in zip_ref.filelist:
|
|
98
|
+
if file_info.filename.endswith("erdo.exe"):
|
|
99
|
+
with (
|
|
100
|
+
zip_ref.open(file_info) as source,
|
|
101
|
+
open(binary_path, "wb") as target,
|
|
102
|
+
):
|
|
103
|
+
shutil.copyfileobj(source, target)
|
|
104
|
+
break
|
|
105
|
+
else:
|
|
106
|
+
import tarfile
|
|
107
|
+
|
|
108
|
+
with tarfile.open(archive_path, "r:gz") as tar_ref:
|
|
109
|
+
# Extract erdo binary from the tar.gz
|
|
110
|
+
for member in tar_ref.getmembers():
|
|
111
|
+
if member.name.endswith("/erdo") or member.name == "erdo":
|
|
112
|
+
with (
|
|
113
|
+
tar_ref.extractfile(member) as source,
|
|
114
|
+
open(binary_path, "wb") as target,
|
|
115
|
+
):
|
|
116
|
+
shutil.copyfileobj(source, target)
|
|
117
|
+
break
|
|
118
|
+
|
|
119
|
+
# Make executable on Unix-like systems
|
|
120
|
+
if platform_name != "windows":
|
|
121
|
+
os.chmod(binary_path, 0o755)
|
|
122
|
+
|
|
123
|
+
# Clean up the archive
|
|
124
|
+
archive_path.unlink()
|
|
125
|
+
|
|
126
|
+
print(f"✓ Erdo CLI installed to {binary_path}")
|
|
127
|
+
|
|
128
|
+
# Add to PATH instructions
|
|
129
|
+
print("\nTo use the CLI globally, add the following to your PATH:")
|
|
130
|
+
print(f'export PATH="{bin_dir}:$PATH"')
|
|
131
|
+
|
|
132
|
+
except Exception as e:
|
|
133
|
+
print(f"Warning: Failed to download Erdo CLI: {e}")
|
|
134
|
+
print(
|
|
135
|
+
"You can manually download it from: https://github.com/erdoai/homebrew-tap/releases"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if __name__ == "__main__":
|
|
140
|
+
download_and_install_cli()
|
erdo/integrations.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Integration base classes for defining integration configurations in Python
|
|
2
|
+
"""
|
|
3
|
+
Integration configuration framework for defining integration configs alongside agents.
|
|
4
|
+
|
|
5
|
+
This module provides base classes for defining integration configurations in Python,
|
|
6
|
+
which can then be synced to the backend alongside agents.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Any, Dict, Optional
|
|
10
|
+
|
|
11
|
+
from ._generated.types import IntegrationConfig, IntegrationDefinition
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Helper function to create integration configurations
|
|
15
|
+
def create_integration_config(**kwargs) -> IntegrationConfig:
|
|
16
|
+
"""Create an IntegrationConfig with the provided parameters."""
|
|
17
|
+
# Extract metadata
|
|
18
|
+
source = kwargs.pop("source", "python")
|
|
19
|
+
file_path = kwargs.pop("file_path", None)
|
|
20
|
+
|
|
21
|
+
# Create IntegrationDefinition with remaining parameters
|
|
22
|
+
definition = IntegrationDefinition(**kwargs)
|
|
23
|
+
|
|
24
|
+
return IntegrationConfig(definition=definition, source=source, file_path=file_path)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# Base class that acts like IntegrationConfig but handles initialization better
|
|
28
|
+
class IntegrationConfigClass:
|
|
29
|
+
"""Base class for integration configurations using auto-generated types."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, **kwargs):
|
|
32
|
+
"""Initialize with integration definition parameters."""
|
|
33
|
+
# Extract metadata
|
|
34
|
+
self._source = kwargs.pop("source", "python")
|
|
35
|
+
self._file_path = kwargs.pop("file_path", None)
|
|
36
|
+
|
|
37
|
+
# Create the definition with remaining kwargs
|
|
38
|
+
self._definition = IntegrationDefinition(**kwargs)
|
|
39
|
+
|
|
40
|
+
# Create the actual IntegrationConfig instance
|
|
41
|
+
self._config = IntegrationConfig(
|
|
42
|
+
definition=self._definition, source=self._source, file_path=self._file_path
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
46
|
+
"""Convert to dictionary for syncing to backend."""
|
|
47
|
+
return self._config.to_dict()
|
|
48
|
+
|
|
49
|
+
@property
|
|
50
|
+
def definition(self) -> IntegrationDefinition:
|
|
51
|
+
"""Access the underlying definition."""
|
|
52
|
+
return self._definition
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def config(self) -> IntegrationConfig:
|
|
56
|
+
"""Access the underlying IntegrationConfig."""
|
|
57
|
+
return self._config
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# Helper functions for common credential schemas
|
|
61
|
+
def oauth_credential_schema() -> Dict[str, Any]:
|
|
62
|
+
"""Helper to create standard OAuth credential schema"""
|
|
63
|
+
return {
|
|
64
|
+
"access_token": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "OAuth access token",
|
|
67
|
+
"required": True,
|
|
68
|
+
"source": "integration_credentials",
|
|
69
|
+
},
|
|
70
|
+
"refresh_token": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "OAuth refresh token",
|
|
73
|
+
"required": False,
|
|
74
|
+
"source": "integration_credentials",
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def database_credential_schema() -> Dict[str, Any]:
|
|
80
|
+
"""Helper to create standard database credential schema"""
|
|
81
|
+
return {
|
|
82
|
+
"host": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"description": "Database host",
|
|
85
|
+
"required": True,
|
|
86
|
+
"source": "integration_credentials",
|
|
87
|
+
},
|
|
88
|
+
"port": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"description": "Database port",
|
|
91
|
+
"required": True,
|
|
92
|
+
"source": "integration_credentials",
|
|
93
|
+
},
|
|
94
|
+
"database": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Database name",
|
|
97
|
+
"required": True,
|
|
98
|
+
"source": "integration_credentials",
|
|
99
|
+
},
|
|
100
|
+
"username": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"description": "Database username",
|
|
103
|
+
"required": True,
|
|
104
|
+
"source": "integration_credentials",
|
|
105
|
+
},
|
|
106
|
+
"password": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"description": "Database password",
|
|
109
|
+
"required": True,
|
|
110
|
+
"source": "integration_credentials",
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def api_key_credential_schema(
|
|
116
|
+
key_name: str = "api_key", header_name: Optional[str] = None
|
|
117
|
+
) -> Dict[str, Any]:
|
|
118
|
+
"""Helper to create standard API key credential schema"""
|
|
119
|
+
schema = {
|
|
120
|
+
key_name: {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "API Key for authentication",
|
|
123
|
+
"required": True,
|
|
124
|
+
"source": "integration_credentials",
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if header_name:
|
|
129
|
+
schema[key_name]["header"] = header_name
|
|
130
|
+
|
|
131
|
+
return schema
|
erdo/py.typed
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|