deepagents 0.1.3__tar.gz → 0.1.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.
- {deepagents-0.1.3/src/deepagents.egg-info → deepagents-0.1.4}/PKG-INFO +1 -1
- {deepagents-0.1.3 → deepagents-0.1.4}/pyproject.toml +1 -1
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents/middleware/filesystem.py +4 -0
- {deepagents-0.1.3 → deepagents-0.1.4/src/deepagents.egg-info}/PKG-INFO +1 -1
- {deepagents-0.1.3 → deepagents-0.1.4}/tests/test_middleware.py +37 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/LICENSE +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/README.md +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/setup.cfg +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents/__init__.py +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents/graph.py +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents/middleware/__init__.py +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents/middleware/patch_tool_calls.py +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents/middleware/subagents.py +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents.egg-info/SOURCES.txt +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents.egg-info/dependency_links.txt +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents.egg-info/requires.txt +0 -0
- {deepagents-0.1.3 → deepagents-0.1.4}/src/deepagents.egg-info/top_level.txt +0 -0
|
@@ -207,6 +207,8 @@ def _create_file_data(
|
|
|
207
207
|
```
|
|
208
208
|
"""
|
|
209
209
|
lines = content.split("\n") if isinstance(content, str) else content
|
|
210
|
+
# Split any lines exceeding MAX_LINE_LENGTH into chunks
|
|
211
|
+
lines = [line[i:i+MAX_LINE_LENGTH] for line in lines for i in range(0, len(line) or 1, MAX_LINE_LENGTH)]
|
|
210
212
|
now = datetime.now(UTC).isoformat()
|
|
211
213
|
|
|
212
214
|
return {
|
|
@@ -239,6 +241,8 @@ def _update_file_data(
|
|
|
239
241
|
```
|
|
240
242
|
"""
|
|
241
243
|
lines = content.split("\n") if isinstance(content, str) else content
|
|
244
|
+
# Split any lines exceeding MAX_LINE_LENGTH into chunks
|
|
245
|
+
lines = [line[i:i+MAX_LINE_LENGTH] for line in lines for i in range(0, len(line) or 1, MAX_LINE_LENGTH)]
|
|
242
246
|
now = datetime.now(UTC).isoformat()
|
|
243
247
|
|
|
244
248
|
return {
|
|
@@ -16,6 +16,8 @@ from deepagents.middleware.filesystem import (
|
|
|
16
16
|
FileData,
|
|
17
17
|
FilesystemMiddleware,
|
|
18
18
|
FilesystemState,
|
|
19
|
+
_create_file_data,
|
|
20
|
+
_update_file_data,
|
|
19
21
|
)
|
|
20
22
|
from deepagents.middleware.patch_tool_calls import PatchToolCallsMiddleware
|
|
21
23
|
from deepagents.middleware.subagents import DEFAULT_GENERAL_PURPOSE_DESCRIPTION, TASK_SYSTEM_PROMPT, TASK_TOOL_DESCRIPTION, SubAgentMiddleware
|
|
@@ -148,6 +150,41 @@ class TestFilesystemMiddleware:
|
|
|
148
150
|
assert "/pokemon/test2.txt" in result
|
|
149
151
|
assert "/pokemon/charmander.txt" in result
|
|
150
152
|
|
|
153
|
+
def test_create_file_data_splits_long_lines(self):
|
|
154
|
+
long_line = "a" * 3500
|
|
155
|
+
short_line = "short line"
|
|
156
|
+
content = f"{short_line}\n{long_line}"
|
|
157
|
+
|
|
158
|
+
file_data = _create_file_data(content)
|
|
159
|
+
|
|
160
|
+
for line in file_data["content"]:
|
|
161
|
+
assert len(line) <= 2000
|
|
162
|
+
|
|
163
|
+
assert len(file_data["content"]) == 3
|
|
164
|
+
assert file_data["content"][0] == short_line
|
|
165
|
+
assert file_data["content"][1] == "a" * 2000
|
|
166
|
+
assert file_data["content"][2] == "a" * 1500
|
|
167
|
+
|
|
168
|
+
def test_update_file_data_splits_long_lines(self):
|
|
169
|
+
initial_file_data = _create_file_data("initial content")
|
|
170
|
+
|
|
171
|
+
long_line = "b" * 5000
|
|
172
|
+
short_line = "another short line"
|
|
173
|
+
new_content = f"{short_line}\n{long_line}"
|
|
174
|
+
|
|
175
|
+
updated_file_data = _update_file_data(initial_file_data, new_content)
|
|
176
|
+
|
|
177
|
+
for line in updated_file_data["content"]:
|
|
178
|
+
assert len(line) <= 2000
|
|
179
|
+
|
|
180
|
+
assert len(updated_file_data["content"]) == 4
|
|
181
|
+
assert updated_file_data["content"][0] == short_line
|
|
182
|
+
assert updated_file_data["content"][1] == "b" * 2000
|
|
183
|
+
assert updated_file_data["content"][2] == "b" * 2000
|
|
184
|
+
assert updated_file_data["content"][3] == "b" * 1000
|
|
185
|
+
|
|
186
|
+
assert updated_file_data["created_at"] == initial_file_data["created_at"]
|
|
187
|
+
|
|
151
188
|
|
|
152
189
|
@pytest.mark.requires("langchain_openai")
|
|
153
190
|
class TestSubagentMiddleware:
|
|
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
|