agent-handler-sdk 0.1.1__py3-none-any.whl → 0.1.3__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 agent-handler-sdk might be problematic. Click here for more details.
- agent_handler_sdk/__init__.py +2 -0
- agent_handler_sdk/auth.py +19 -0
- agent_handler_sdk/cli.py +13 -21
- agent_handler_sdk/templates/connector/metadata.yaml.tpl +3 -0
- {agent_handler_sdk-0.1.1.dist-info → agent_handler_sdk-0.1.3.dist-info}/METADATA +1 -1
- {agent_handler_sdk-0.1.1.dist-info → agent_handler_sdk-0.1.3.dist-info}/RECORD +8 -7
- {agent_handler_sdk-0.1.1.dist-info → agent_handler_sdk-0.1.3.dist-info}/WHEEL +0 -0
- {agent_handler_sdk-0.1.1.dist-info → agent_handler_sdk-0.1.3.dist-info}/entry_points.txt +0 -0
agent_handler_sdk/__init__.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# agent_handler_sdk/auth.py
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AuthContext:
|
|
7
|
+
"""
|
|
8
|
+
Auth context for tool execution that provides secure access to secrets.
|
|
9
|
+
|
|
10
|
+
This class provides an isolated container for secrets during tool execution.
|
|
11
|
+
Each tool execution should receive its own instance.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, secrets: Optional[dict[str, str]] = None):
|
|
15
|
+
self._secrets = secrets or {}
|
|
16
|
+
|
|
17
|
+
def get(self, key: str, default: Optional[str] = None) -> Optional[str]:
|
|
18
|
+
"""Get a secret value by key"""
|
|
19
|
+
return self._secrets.get(key, default)
|
agent_handler_sdk/cli.py
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Any
|
|
4
4
|
import importlib.resources as pkg_resources
|
|
5
|
-
|
|
6
|
-
try:
|
|
7
|
-
# Python 3.11+
|
|
8
|
-
import tomllib as toml # type: ignore
|
|
9
|
-
except ImportError:
|
|
10
|
-
# For older versions
|
|
11
|
-
import tomli as toml
|
|
5
|
+
from agent_handler_sdk import __version__ as sdk_version
|
|
12
6
|
|
|
13
7
|
# Use str() to convert Traversable to string path
|
|
14
8
|
TEMPLATE_DIR = Path(str(pkg_resources.files("agent_handler_sdk"))) / "templates" / "connector"
|
|
15
|
-
SDK_ROOT = Path(__file__).parent.parent # adjust if your structure is different
|
|
16
9
|
|
|
17
10
|
|
|
18
11
|
def get_sdk_version() -> str:
|
|
19
|
-
|
|
20
|
-
data = toml.loads(pyproject.read_text(encoding="utf-8"))
|
|
21
|
-
# if you use Poetry format:
|
|
22
|
-
return str(data["tool"]["poetry"]["version"])
|
|
12
|
+
return sdk_version
|
|
23
13
|
|
|
24
14
|
|
|
25
15
|
def render_template(filename: str, **context: Any) -> str:
|
|
@@ -34,13 +24,13 @@ def render_template(filename: str, **context: Any) -> str:
|
|
|
34
24
|
|
|
35
25
|
def scaffold_connector() -> int:
|
|
36
26
|
"""
|
|
37
|
-
Usage: ahs-scaffold <
|
|
27
|
+
Usage: ahs-scaffold <slug> [--target-dir <dir>]
|
|
38
28
|
|
|
39
29
|
Creates:
|
|
40
|
-
<target-dir>/connectors/<
|
|
30
|
+
<target-dir>/connectors/<slug>/
|
|
41
31
|
pyproject.toml
|
|
42
32
|
metadata.yaml
|
|
43
|
-
<
|
|
33
|
+
<slug>_connector/
|
|
44
34
|
__init__.py
|
|
45
35
|
tools/
|
|
46
36
|
handlers.py
|
|
@@ -52,7 +42,9 @@ def scaffold_connector() -> int:
|
|
|
52
42
|
print(scaffold_connector.__doc__)
|
|
53
43
|
sys.exit(1)
|
|
54
44
|
|
|
55
|
-
|
|
45
|
+
slug = args[0]
|
|
46
|
+
# Generate human-readable name by replacing hyphens with spaces and capitalizing words
|
|
47
|
+
human_readable_name = " ".join(word.capitalize() for word in slug.replace("-", " ").split())
|
|
56
48
|
target = Path(".")
|
|
57
49
|
if "--target-dir" in args:
|
|
58
50
|
idx = args.index("--target-dir")
|
|
@@ -60,8 +52,8 @@ def scaffold_connector() -> int:
|
|
|
60
52
|
|
|
61
53
|
version = get_sdk_version()
|
|
62
54
|
|
|
63
|
-
base = target / "connectors" /
|
|
64
|
-
pkg_dir = base / f"{
|
|
55
|
+
base = target / "connectors" / slug
|
|
56
|
+
pkg_dir = base / f"{slug}_connector"
|
|
65
57
|
tools_dir = pkg_dir / "tools"
|
|
66
58
|
tests_dir = base / "tests"
|
|
67
59
|
|
|
@@ -81,8 +73,8 @@ def scaffold_connector() -> int:
|
|
|
81
73
|
|
|
82
74
|
# Render each template with both name & version
|
|
83
75
|
for tpl_name, out_path in files_to_render.items():
|
|
84
|
-
content = render_template(tpl_name, name=
|
|
76
|
+
content = render_template(tpl_name, name=slug, version=version, human_readable_name=human_readable_name)
|
|
85
77
|
out_path.write_text(content, encoding="utf-8")
|
|
86
78
|
|
|
87
|
-
print(f"Scaffolded connector '{
|
|
79
|
+
print(f"Scaffolded connector '{slug}' (SDK v{version}) at {base}")
|
|
88
80
|
return 0
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
agent_handler_sdk/__init__.py,sha256=
|
|
2
|
-
agent_handler_sdk/
|
|
1
|
+
agent_handler_sdk/__init__.py,sha256=QAAV_YdhBAP5P3DVB0fZfjV6jJnLnRwKBYvGixzrIRI,56
|
|
2
|
+
agent_handler_sdk/auth.py,sha256=OC24JhY0qiQbx8rM7sRPwz4gpsZGd3c-zxZ6uLoEwp0,579
|
|
3
|
+
agent_handler_sdk/cli.py,sha256=gQWq5kmtaOWiO4v8suu-5k-mA5pQOL1zIBEkmMj94Ho,2496
|
|
3
4
|
agent_handler_sdk/connector.py,sha256=IhCfxZ9-ah1fgQsHHYD2Ip9CzOG6Sok6C6dbKA-iOWU,3395
|
|
4
5
|
agent_handler_sdk/exceptions.py,sha256=78LAytptKzrK2Vo1QsucnDlXFIH7pKDOz-K1Jwi5kdQ,98
|
|
5
6
|
agent_handler_sdk/invocation.py,sha256=0mn_arvbMncrWqrXtKcH2wjfWlXP49VtcJhAekFGxkw,2054
|
|
@@ -7,12 +8,12 @@ agent_handler_sdk/registry.py,sha256=NecI41OSK37YAlFPeKf2bONqyoKrUq7GJ5eMuQ8kb1w
|
|
|
7
8
|
agent_handler_sdk/templates/connector/README.md.tpl,sha256=KrCFKwrYSVxHJu6PK-03USpDellO-FYXsfUdOZS7gB4,646
|
|
8
9
|
agent_handler_sdk/templates/connector/handlers.py.tpl,sha256=bijFfajA3o0M4x33UAEOnf9958lszTM6OuykolST3fQ,132
|
|
9
10
|
agent_handler_sdk/templates/connector/init.py.tpl,sha256=oTrEFARFfcsMOmaJ_A5dKfierKSSzwDLg9PdrlgXXi0,361
|
|
10
|
-
agent_handler_sdk/templates/connector/metadata.yaml.tpl,sha256=
|
|
11
|
+
agent_handler_sdk/templates/connector/metadata.yaml.tpl,sha256=imIElqfomfMHFp-dFEPwbuWixKO9HIkkwSmIRYva46c,225
|
|
11
12
|
agent_handler_sdk/templates/connector/pyproject.toml.tpl,sha256=QddVTsMbKcj6iV0svcWxb_hk3bJ74F2sXKYeQpi0l9I,652
|
|
12
13
|
agent_handler_sdk/templates/connector/test_handlers.py.tpl,sha256=ptV4Ci-5C1Edr7e3FHqM4yj6d2H-Qi4cBI3MXQZIimk,696
|
|
13
14
|
agent_handler_sdk/tool.py,sha256=s7xMRoB_HwtSkeeuGqkbZzp6Rt9kI4KVUxpULeIrLn8,4292
|
|
14
15
|
agent_handler_sdk/utils.py,sha256=oFSfocf0PqbeOz9LH0kgBfegDFRSNeh9LPS19esNOXY,7219
|
|
15
|
-
agent_handler_sdk-0.1.
|
|
16
|
-
agent_handler_sdk-0.1.
|
|
17
|
-
agent_handler_sdk-0.1.
|
|
18
|
-
agent_handler_sdk-0.1.
|
|
16
|
+
agent_handler_sdk-0.1.3.dist-info/METADATA,sha256=sqTnLCiGhmgRD0k5DkvLl1MCVVEVumkPs9_1kWWAiJY,536
|
|
17
|
+
agent_handler_sdk-0.1.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
18
|
+
agent_handler_sdk-0.1.3.dist-info/entry_points.txt,sha256=QGDWaLUjKDHhNb4ZpvSj1MrrlQWozz1QuqLecdWAEYA,73
|
|
19
|
+
agent_handler_sdk-0.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|