aient 1.1.96__py3-none-any.whl → 1.1.98__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.
@@ -84,7 +84,12 @@ class Texts(ContextProvider):
84
84
  self._is_dynamic = callable(self._text)
85
85
  self.mark_stale()
86
86
 
87
- async def render(self) -> Optional[str]:
87
+ @property
88
+ def content(self) -> Optional[str]:
89
+ """
90
+ Synchronously retrieves the raw text content as a property.
91
+ If the content is dynamic (a callable), it executes the callable.
92
+ """
88
93
  if self._is_dynamic:
89
94
  # Ensure dynamic content returns a string, even if empty
90
95
  result = self._text()
@@ -92,9 +97,12 @@ class Texts(ContextProvider):
92
97
  # Ensure static content returns a string, even if empty
93
98
  return self._text if self._text is not None else ""
94
99
 
100
+ async def render(self) -> Optional[str]:
101
+ return self.content
102
+
95
103
  class Tools(ContextProvider):
96
- def __init__(self, tools_json: Optional[List[Dict]] = None):
97
- super().__init__("tools")
104
+ def __init__(self, tools_json: Optional[List[Dict]] = None, name: str = "tools"):
105
+ super().__init__(name)
98
106
  self._tools_json = tools_json or []
99
107
  def update(self, tools_json: List[Dict]):
100
108
  self._tools_json = tools_json
@@ -105,8 +113,8 @@ class Tools(ContextProvider):
105
113
  return f"<tools>{str(self._tools_json)}</tools>"
106
114
 
107
115
  class Files(ContextProvider):
108
- def __init__(self, *paths: Union[str, List[str]]):
109
- super().__init__("files")
116
+ def __init__(self, *paths: Union[str, List[str]], name: str = "files"):
117
+ super().__init__(name)
110
118
  self._files: Dict[str, str] = {}
111
119
 
112
120
  file_paths: List[str] = []
@@ -998,6 +998,29 @@ Current time: {Texts(lambda: datetime.now().strftime("%Y-%m-%d %H:%M:%S"))}
998
998
  # 验证两次渲染的时间戳不同
999
999
  self.assertNotEqual(time1_str_part, time2_str_part, "f-string 中的动态 lambda 内容在两次渲染之间应该更新")
1000
1000
 
1001
+ def test_z6_direct_content_access(self):
1002
+ """测试通过 .content 属性直接访问 Texts 内容"""
1003
+ # 1. 测试静态内容
1004
+ static_text = Texts("Hello, Architext!")
1005
+ self.assertEqual(static_text.content, "Hello, Architext!")
1006
+
1007
+ # 2. 测试动态内容
1008
+ from datetime import datetime
1009
+ current_time_str = datetime.now().isoformat()
1010
+ dynamic_text = Texts(lambda: current_time_str)
1011
+ self.assertEqual(dynamic_text.content, current_time_str)
1012
+
1013
+ # 3. 测试更新后的内容访问
1014
+ static_text.update("Updated content.")
1015
+ self.assertEqual(static_text.content, "Updated content.")
1016
+
1017
+ # 4. 测试 None 和空字符串
1018
+ none_text = Texts(name="none_text") # Provide a name when text is None
1019
+ self.assertEqual(none_text.content, "")
1020
+
1021
+ empty_text = Texts("")
1022
+ self.assertEqual(empty_text.content, "")
1023
+
1001
1024
 
1002
1025
  # ==============================================================================
1003
1026
  # 6. 演示
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.1.96
3
+ Version: 1.1.98
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,8 +1,8 @@
1
1
  aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
2
2
  aient/architext/architext/__init__.py,sha256=79Ih1151rfcqZdr7F8HSZSTs_iT2SKd1xCkehMsXeXs,19
3
- aient/architext/architext/core.py,sha256=EmzJxokUvYNlreaX0QtJNb1yLVzptz-GZNTScMJ-FhY,20691
3
+ aient/architext/architext/core.py,sha256=pgnJ5Q9dlxMpp4ilBuHzScxbTlVYihubpo6uYqNV1lU,20976
4
4
  aient/architext/test/openai_client.py,sha256=Dqtbmubv6vwF8uBqcayG0kbsiO65of7sgU2-DRBi-UM,4590
5
- aient/architext/test/test.py,sha256=URVDaUfxxPU4yobojJC7SO1cBsM0Hzz96ZW3lYYMWGo,48176
5
+ aient/architext/test/test.py,sha256=5xV8nrOBf2Gn49EGnBvGLNXQRbNGi_hD0PYESs7tl0g,49091
6
6
  aient/architext/test/test_save_load.py,sha256=o8DqH6gDYZkFkQy-a7blqLtJTRj5e4a-Lil48pJ0V3g,3260
7
7
  aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
8
8
  aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
@@ -35,8 +35,8 @@ aient/plugins/write_file.py,sha256=Jt8fOEwqhYiSWpCbwfAr1xoi_BmFnx3076GMhuL06uI,3
35
35
  aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
37
37
  aient/utils/scripts.py,sha256=VqtK4RFEx7KxkmcqG3lFDS1DxoNlFFGErEjopVcc8IE,40974
38
- aient-1.1.96.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
39
- aient-1.1.96.dist-info/METADATA,sha256=6jViFaxqeoQcCHKzhO1o6U5jWairN5nHEm0KSovVvr4,4842
40
- aient-1.1.96.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
- aient-1.1.96.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
42
- aient-1.1.96.dist-info/RECORD,,
38
+ aient-1.1.98.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
39
+ aient-1.1.98.dist-info/METADATA,sha256=Ovyrvqq57HzewzZke5vlu0OuV0E8TQm2s0FGMxlrKcA,4842
40
+ aient-1.1.98.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
+ aient-1.1.98.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
42
+ aient-1.1.98.dist-info/RECORD,,
File without changes