agstack 1.8.2__tar.gz → 1.8.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agstack-1.8.2 → agstack-1.8.4}/PKG-INFO +2 -2
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/tool_node.py +5 -2
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/tool.py +4 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/security/crypt.py +4 -7
- {agstack-1.8.2 → agstack-1.8.4}/agstack.egg-info/PKG-INFO +2 -2
- {agstack-1.8.2 → agstack-1.8.4}/agstack.egg-info/requires.txt +1 -1
- {agstack-1.8.2 → agstack-1.8.4}/pyproject.toml +2 -2
- {agstack-1.8.2 → agstack-1.8.4}/LICENSE +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/README.md +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/config/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/config/logger.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/config/manager.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/config/types.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/contexts.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/decorators.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/events.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/exceptions.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/fastapi/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/fastapi/exception.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/fastapi/middleware.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/fastapi/offline.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/fastapi/sse.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/infra/db/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/infra/es/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/infra/kg/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/infra/mq/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/client.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/agent.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/context.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/event.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/exceptions.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/factory.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/flow.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/loader.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/agent_node.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/base.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/detect_node.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/llm_chat_node.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/llm_embed_node.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/llm_rerank_node.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/nodes/python_node.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/records.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/registry.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/sandbox.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/flow/state.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/prompts.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/llm/token.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/schema.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/security/__init__.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/security/casbin.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack/status.py +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack.egg-info/SOURCES.txt +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack.egg-info/dependency_links.txt +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/agstack.egg-info/top_level.txt +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/setup.cfg +0 -0
- {agstack-1.8.2 → agstack-1.8.4}/tests/test_flow_io.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agstack
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.4
|
|
4
4
|
Summary: Production-ready toolkit for building FastAPI and LLM applications
|
|
5
5
|
Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
6
6
|
Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
@@ -28,7 +28,7 @@ Requires-Dist: jwcrypto>=1.5.6
|
|
|
28
28
|
Requires-Dist: loguru>=0.7.3
|
|
29
29
|
Requires-Dist: nebula3-python>=3.8.3
|
|
30
30
|
Requires-Dist: openai>=2.28.0
|
|
31
|
-
Requires-Dist:
|
|
31
|
+
Requires-Dist: bcrypt>=4.0.0
|
|
32
32
|
Requires-Dist: pycasbin>=2.8.0
|
|
33
33
|
Requires-Dist: pydantic>=2.12.4
|
|
34
34
|
Requires-Dist: python-multipart>=0.0.20
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
from typing import TYPE_CHECKING, Any
|
|
6
6
|
|
|
7
|
-
from ..exceptions import FlowError
|
|
7
|
+
from ..exceptions import FlowError, ToolExecutionError
|
|
8
8
|
from ..registry import registry
|
|
9
9
|
from .base import NodeHandler
|
|
10
10
|
|
|
@@ -31,4 +31,7 @@ class ToolNodeHandler(NodeHandler):
|
|
|
31
31
|
config = node.get("config", {})
|
|
32
32
|
resolved = self.resolve_inputs(config, context)
|
|
33
33
|
tool = self._create_tool(config)
|
|
34
|
-
|
|
34
|
+
result = await tool.execute_async(context, inputs=resolved)
|
|
35
|
+
if not result.success:
|
|
36
|
+
raise ToolExecutionError("TOOL_EXECUTION_FAILED", args={"tool_name": tool.name, "error": result.error})
|
|
37
|
+
return result.result
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
"""工具定义和执行"""
|
|
4
4
|
|
|
5
|
+
import logging
|
|
5
6
|
from dataclasses import dataclass
|
|
6
7
|
from typing import TYPE_CHECKING, Any, Callable
|
|
7
8
|
|
|
@@ -9,6 +10,8 @@ from typing import TYPE_CHECKING, Any, Callable
|
|
|
9
10
|
if TYPE_CHECKING:
|
|
10
11
|
from .context import FlowContext
|
|
11
12
|
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
12
15
|
|
|
13
16
|
@dataclass
|
|
14
17
|
class ToolResult:
|
|
@@ -52,6 +55,7 @@ class Tool:
|
|
|
52
55
|
|
|
53
56
|
return ToolResult(name=self.name, arguments=inputs or {}, result=result, success=True)
|
|
54
57
|
except Exception as e:
|
|
58
|
+
logger.warning("Tool %s failed: %s", self.name, e, exc_info=True)
|
|
55
59
|
return ToolResult(
|
|
56
60
|
name=self.name,
|
|
57
61
|
arguments=inputs or {},
|
|
@@ -7,12 +7,11 @@ import json
|
|
|
7
7
|
import time
|
|
8
8
|
from datetime import datetime, timedelta
|
|
9
9
|
|
|
10
|
+
import bcrypt
|
|
10
11
|
from jwcrypto import jwk, jws
|
|
11
|
-
from passlib.context import CryptContext
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
__context = CryptContext(schemes=["bcrypt"], deprecated="auto", bcrypt__rounds=12)
|
|
14
|
+
_BCRYPT_ROUNDS = 12
|
|
16
15
|
|
|
17
16
|
__all__ = [
|
|
18
17
|
"create_jwt_token_with_key",
|
|
@@ -100,9 +99,7 @@ def hash_password_with_key(passwd: str, secret_key: str) -> str:
|
|
|
100
99
|
:return: bcrypt 哈希字符串
|
|
101
100
|
"""
|
|
102
101
|
passwd = _get_hmac_str(passwd, secret_key)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return hashed
|
|
102
|
+
return bcrypt.hashpw(passwd.encode(), bcrypt.gensalt(rounds=_BCRYPT_ROUNDS)).decode()
|
|
106
103
|
|
|
107
104
|
|
|
108
105
|
def verify_password_with_key(passwd: str, hashed_pwd: str, secret_key: str) -> bool:
|
|
@@ -116,7 +113,7 @@ def verify_password_with_key(passwd: str, hashed_pwd: str, secret_key: str) -> b
|
|
|
116
113
|
:return: 密码正确返回 True,否则返回 False
|
|
117
114
|
"""
|
|
118
115
|
passwd = _get_hmac_str(passwd, secret_key)
|
|
119
|
-
return
|
|
116
|
+
return bcrypt.checkpw(passwd.encode(), hashed_pwd.encode())
|
|
120
117
|
|
|
121
118
|
|
|
122
119
|
def _get_hmac_str(plaintext: str, secret_key: str) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agstack
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.4
|
|
4
4
|
Summary: Production-ready toolkit for building FastAPI and LLM applications
|
|
5
5
|
Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
6
6
|
Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
@@ -28,7 +28,7 @@ Requires-Dist: jwcrypto>=1.5.6
|
|
|
28
28
|
Requires-Dist: loguru>=0.7.3
|
|
29
29
|
Requires-Dist: nebula3-python>=3.8.3
|
|
30
30
|
Requires-Dist: openai>=2.28.0
|
|
31
|
-
Requires-Dist:
|
|
31
|
+
Requires-Dist: bcrypt>=4.0.0
|
|
32
32
|
Requires-Dist: pycasbin>=2.8.0
|
|
33
33
|
Requires-Dist: pydantic>=2.12.4
|
|
34
34
|
Requires-Dist: python-multipart>=0.0.20
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agstack"
|
|
3
|
-
version = "1.8.
|
|
3
|
+
version = "1.8.4"
|
|
4
4
|
description = "Production-ready toolkit for building FastAPI and LLM applications"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -47,7 +47,7 @@ dependencies = [
|
|
|
47
47
|
"loguru>=0.7.3",
|
|
48
48
|
"nebula3-python>=3.8.3",
|
|
49
49
|
"openai>=2.28.0",
|
|
50
|
-
"
|
|
50
|
+
"bcrypt>=4.0.0",
|
|
51
51
|
"pycasbin>=2.8.0",
|
|
52
52
|
"pydantic>=2.12.4",
|
|
53
53
|
"python-multipart>=0.0.20",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|