agentfs-sdk 0.3.1__tar.gz → 0.4.0__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.
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/PKG-INFO +4 -2
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk/__init__.py +10 -2
- agentfs_sdk-0.4.0/agentfs_sdk/constants.py +13 -0
- agentfs_sdk-0.4.0/agentfs_sdk/errors.py +60 -0
- agentfs_sdk-0.4.0/agentfs_sdk/filesystem.py +1126 -0
- agentfs_sdk-0.4.0/agentfs_sdk/guards.py +199 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk.egg-info/PKG-INFO +4 -2
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk.egg-info/SOURCES.txt +3 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/pyproject.toml +5 -3
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/tests/test_filesystem.py +532 -5
- agentfs_sdk-0.3.1/agentfs_sdk/filesystem.py +0 -534
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/MANIFEST.in +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/README.md +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk/agentfs.py +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk/kvstore.py +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk/toolcalls.py +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk.egg-info/dependency_links.txt +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk.egg-info/requires.txt +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/agentfs_sdk.egg-info/top_level.txt +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/setup.cfg +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/tests/test_agentfs.py +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/tests/test_basic.py +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/tests/test_kvstore.py +0 -0
- {agentfs_sdk-0.3.1 → agentfs_sdk-0.4.0}/tests/test_toolcalls.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentfs-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: AgentFS Python SDK - A filesystem and key-value store for AI agents
|
|
5
5
|
Author: Turso
|
|
6
6
|
License: MIT
|
|
@@ -16,9 +16,11 @@ Classifier: Operating System :: POSIX :: Linux
|
|
|
16
16
|
Classifier: Operating System :: Microsoft :: Windows
|
|
17
17
|
Classifier: Operating System :: MacOS
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.10
|
|
22
24
|
Description-Content-Type: text/markdown
|
|
23
25
|
Requires-Dist: pyturso==0.4.0rc17
|
|
24
26
|
|
|
@@ -4,11 +4,12 @@ A filesystem and key-value store for AI agents, powered by SQLite.
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
from .agentfs import AgentFS, AgentFSOptions
|
|
7
|
-
from .
|
|
7
|
+
from .errors import ErrnoException, FsErrorCode, FsSyscall
|
|
8
|
+
from .filesystem import S_IFDIR, S_IFLNK, S_IFMT, S_IFREG, Filesystem, Stats
|
|
8
9
|
from .kvstore import KvStore
|
|
9
10
|
from .toolcalls import ToolCall, ToolCalls, ToolCallStats
|
|
10
11
|
|
|
11
|
-
__version__ = "0.
|
|
12
|
+
__version__ = "0.4.0"
|
|
12
13
|
|
|
13
14
|
__all__ = [
|
|
14
15
|
"AgentFS",
|
|
@@ -16,7 +17,14 @@ __all__ = [
|
|
|
16
17
|
"KvStore",
|
|
17
18
|
"Filesystem",
|
|
18
19
|
"Stats",
|
|
20
|
+
"S_IFDIR",
|
|
21
|
+
"S_IFLNK",
|
|
22
|
+
"S_IFMT",
|
|
23
|
+
"S_IFREG",
|
|
19
24
|
"ToolCalls",
|
|
20
25
|
"ToolCall",
|
|
21
26
|
"ToolCallStats",
|
|
27
|
+
"ErrnoException",
|
|
28
|
+
"FsErrorCode",
|
|
29
|
+
"FsSyscall",
|
|
22
30
|
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Filesystem constants"""
|
|
2
|
+
|
|
3
|
+
# File types for mode field
|
|
4
|
+
S_IFMT = 0o170000 # File type mask
|
|
5
|
+
S_IFREG = 0o100000 # Regular file
|
|
6
|
+
S_IFDIR = 0o040000 # Directory
|
|
7
|
+
S_IFLNK = 0o120000 # Symbolic link
|
|
8
|
+
|
|
9
|
+
# Default permissions
|
|
10
|
+
DEFAULT_FILE_MODE = S_IFREG | 0o644 # Regular file, rw-r--r--
|
|
11
|
+
DEFAULT_DIR_MODE = S_IFDIR | 0o755 # Directory, rwxr-xr-x
|
|
12
|
+
|
|
13
|
+
DEFAULT_CHUNK_SIZE = 4096
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Error types for filesystem operations"""
|
|
2
|
+
|
|
3
|
+
from typing import Literal, Optional
|
|
4
|
+
|
|
5
|
+
# POSIX-style error codes for filesystem operations
|
|
6
|
+
FsErrorCode = Literal[
|
|
7
|
+
"ENOENT", # No such file or directory
|
|
8
|
+
"EEXIST", # File already exists
|
|
9
|
+
"EISDIR", # Is a directory (when file expected)
|
|
10
|
+
"ENOTDIR", # Not a directory (when directory expected)
|
|
11
|
+
"ENOTEMPTY", # Directory not empty
|
|
12
|
+
"EPERM", # Operation not permitted
|
|
13
|
+
"EINVAL", # Invalid argument
|
|
14
|
+
"ENOSYS", # Function not implemented (use for symlinks)
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
# Filesystem syscall names for error reporting
|
|
18
|
+
# rm, scandir and copyfile are not actual syscalls but used for convenience
|
|
19
|
+
FsSyscall = Literal[
|
|
20
|
+
"open",
|
|
21
|
+
"stat",
|
|
22
|
+
"mkdir",
|
|
23
|
+
"rmdir",
|
|
24
|
+
"rm",
|
|
25
|
+
"unlink",
|
|
26
|
+
"rename",
|
|
27
|
+
"scandir",
|
|
28
|
+
"copyfile",
|
|
29
|
+
"access",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ErrnoException(Exception):
|
|
34
|
+
"""Exception with errno-style attributes
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
code: POSIX error code (e.g., 'ENOENT')
|
|
38
|
+
syscall: System call name (e.g., 'open')
|
|
39
|
+
path: Optional path involved in the error
|
|
40
|
+
message: Optional custom message (defaults to code)
|
|
41
|
+
|
|
42
|
+
Example:
|
|
43
|
+
>>> raise ErrnoException('ENOENT', 'open', '/missing.txt')
|
|
44
|
+
ErrnoException: ENOENT: no such file or directory, open '/missing.txt'
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
code: FsErrorCode,
|
|
50
|
+
syscall: FsSyscall,
|
|
51
|
+
path: Optional[str] = None,
|
|
52
|
+
message: Optional[str] = None,
|
|
53
|
+
):
|
|
54
|
+
base = message if message else code
|
|
55
|
+
suffix = f" '{path}'" if path is not None else ""
|
|
56
|
+
error_message = f"{code}: {base}, {syscall}{suffix}"
|
|
57
|
+
super().__init__(error_message)
|
|
58
|
+
self.code = code
|
|
59
|
+
self.syscall = syscall
|
|
60
|
+
self.path = path
|