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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepagents
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: General purpose 'deep agent' with sub-agent spawning, todo list capabilities, and mock file system. Built on LangGraph.
5
5
  License: MIT
6
6
  Requires-Python: <4.0,>=3.11
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "deepagents"
3
- version = "0.1.3"
3
+ version = "0.1.4"
4
4
  description = "General purpose 'deep agent' with sub-agent spawning, todo list capabilities, and mock file system. Built on LangGraph."
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -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 {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepagents
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: General purpose 'deep agent' with sub-agent spawning, todo list capabilities, and mock file system. Built on LangGraph.
5
5
  License: MIT
6
6
  Requires-Python: <4.0,>=3.11
@@ -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