tinyagent-py 0.0.13__py3-none-any.whl → 0.0.16__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.
- tinyagent/code_agent/helper.py +2 -2
- tinyagent/code_agent/modal_sandbox.py +1 -1
- tinyagent/code_agent/providers/__init__.py +14 -1
- tinyagent/code_agent/providers/base.py +181 -7
- tinyagent/code_agent/providers/modal_provider.py +150 -27
- tinyagent/code_agent/providers/seatbelt_provider.py +1065 -0
- tinyagent/code_agent/safety.py +6 -2
- tinyagent/code_agent/tiny_code_agent.py +973 -12
- tinyagent/code_agent/utils.py +263 -2
- tinyagent/hooks/__init__.py +3 -1
- tinyagent/hooks/jupyter_notebook_callback.py +1464 -0
- tinyagent/hooks/token_tracker.py +564 -0
- tinyagent/prompts/summarize.yaml +96 -0
- tinyagent/prompts/truncation.yaml +13 -0
- tinyagent/tiny_agent.py +811 -49
- {tinyagent_py-0.0.13.dist-info → tinyagent_py-0.0.16.dist-info}/METADATA +25 -1
- tinyagent_py-0.0.16.dist-info/RECORD +38 -0
- tinyagent_py-0.0.13.dist-info/RECORD +0 -33
- {tinyagent_py-0.0.13.dist-info → tinyagent_py-0.0.16.dist-info}/WHEEL +0 -0
- {tinyagent_py-0.0.13.dist-info → tinyagent_py-0.0.16.dist-info}/licenses/LICENSE +0 -0
- {tinyagent_py-0.0.13.dist-info → tinyagent_py-0.0.16.dist-info}/top_level.txt +0 -0
tinyagent/code_agent/safety.py
CHANGED
@@ -295,7 +295,8 @@ def _detect_string_obfuscation(tree: ast.AST) -> bool:
|
|
295
295
|
|
296
296
|
|
297
297
|
def validate_code_safety(code: str, *, authorized_imports: Sequence[str] | None = None,
|
298
|
-
authorized_functions: Sequence[str] | None = None, trusted_code: bool = False
|
298
|
+
authorized_functions: Sequence[str] | None = None, trusted_code: bool = False,
|
299
|
+
check_string_obfuscation: bool = True) -> None:
|
299
300
|
"""Static validation of user code.
|
300
301
|
|
301
302
|
Parameters
|
@@ -312,6 +313,9 @@ def validate_code_safety(code: str, *, authorized_imports: Sequence[str] | None
|
|
312
313
|
trusted_code
|
313
314
|
If True, skip security checks. This should only be used for code that is part of the
|
314
315
|
framework, developer-provided tools, or default executed code.
|
316
|
+
check_string_obfuscation
|
317
|
+
If True (default), check for string obfuscation techniques. Set to False to allow
|
318
|
+
legitimate use of base64 encoding and other string manipulations.
|
315
319
|
"""
|
316
320
|
# Skip security checks for trusted code
|
317
321
|
if trusted_code:
|
@@ -384,7 +388,7 @@ def validate_code_safety(code: str, *, authorized_imports: Sequence[str] | None
|
|
384
388
|
# ------------------------------------------------------------------
|
385
389
|
# Detect string obfuscation techniques that might be used to bypass security
|
386
390
|
# ------------------------------------------------------------------
|
387
|
-
if _detect_string_obfuscation(tree):
|
391
|
+
if check_string_obfuscation and _detect_string_obfuscation(tree):
|
388
392
|
raise ValueError("SECURITY VIOLATION: Suspicious string manipulation detected that could be used to bypass security.")
|
389
393
|
|
390
394
|
if blocked:
|