langchain-agentx-python 2.4.5__py3-none-any.whl → 2.4.6__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.
@@ -11,7 +11,7 @@ from langchain_agentx import create_loop_agent
11
11
  ```
12
12
  """
13
13
 
14
- __version__ = "2.4.5"
14
+ __version__ = "2.4.6"
15
15
 
16
16
  from .mcp.call import McpToolCaller
17
17
  from .mcp.client_manager import McpClientManager, McpConnectedClient
@@ -19,7 +19,8 @@ Fork 路径区分(对齐 CC):
19
19
  ``path_prep`` 与遗留 ``cwd``/worktree 自建二选一(编排层须传 ``path_prep``);
20
20
  fork + worktree 时可选注入 CC 等价 ``buildWorktreeNotice`` user 消息(见 ``fork_worktree_notice``);
21
21
  create_subagent_context 在 fork_from_parent=True 时注入 fork-boilerplate 行为规范;
22
- P0-1: 子代理默认隔离 session_store(父为 AgentSessionStore 时使用 clone(file_state_only=True, inherit_grants=True))。
22
+ P0-1: 子代理隔离 session_store(clone + inherit_grants);读缓存仅在
23
+ fork_from_parent=True 时继承(对齐 CC forkContextMessages ⟺ cloneFileStateCache)。
23
24
  """
24
25
 
25
26
  import os
@@ -287,11 +288,15 @@ def create_subagent_context(
287
288
 
288
289
  parent_store = getattr(parent_ctx, "session_store", None)
289
290
  session_store: Any = parent_store
290
- # P0-1 修复:子代理默认隔离 session_store
291
- # 无论 plain 还是 fork 模式,子代理都应使用 clone(file_state_only=True, inherit_grants=True)
292
- # 来继承文件读状态 + spawn 时刻 grant 快照,但隔离 cwd_override、权限缓存等运行态
291
+ # P0-1:子代理隔离 session_store(cwd / 权限缓存不共享);grant 快照可继承。
292
+ # 读缓存绑定消息历史(对齐 CC runAgent.ts):仅 fork_from_parent=True 时
293
+ # clone _file_read_state;plain / Skill fork 空缓存,避免 file_unchanged 误判。
293
294
  if isinstance(parent_store, AgentSessionStore):
294
- session_store = parent_store.clone(file_state_only=True, inherit_grants=True)
295
+ session_store = parent_store.clone(
296
+ file_state_only=True,
297
+ inherit_grants=True,
298
+ inherit_file_reads=fork_from_parent,
299
+ )
295
300
 
296
301
  # 写入 cwd 到子会话 session_store.cwd_override(runtime state SSOT)
297
302
  # 这确保后续 LangChainAdapter.build_tool_execution_context() 和
@@ -390,11 +390,19 @@ class AgentSessionStore:
390
390
  *,
391
391
  file_state_only: bool = True,
392
392
  inherit_grants: bool = False,
393
+ inherit_file_reads: bool = True,
393
394
  ) -> AgentSessionStore:
395
+ """克隆会话存储。
396
+
397
+ ``inherit_file_reads`` 对齐 CC ``forkContextMessages !== undefined``
398
+ → ``cloneFileStateCache``;plain / Skill fork 须传 ``False``(空读缓存),
399
+ 避免 Read dedup 返回 ``file_unchanged`` 而子会话无父消息历史。
400
+ """
394
401
  new = AgentSessionStore(session_id=str(uuid.uuid4()))
395
- new._file_read_state = {
396
- k: copy.deepcopy(v) for k, v in self._file_read_state.items()
397
- }
402
+ if inherit_file_reads:
403
+ new._file_read_state = {
404
+ k: copy.deepcopy(v) for k, v in self._file_read_state.items()
405
+ }
398
406
  if inherit_grants:
399
407
  new._granted_roots = copy.deepcopy(self._granted_roots)
400
408
  new.enable_dynamic_root_grant = self.enable_dynamic_root_grant
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-agentx-python
3
- Version: 2.4.5
3
+ Version: 2.4.6
4
4
  Summary: LangChain/LangGraph-based agent utilities for CodeBaseX.
5
5
  Author-email: GoodMood2008 <GoodMood2008@users.noreply.github.com>
6
6
  License: Apache License
@@ -1,4 +1,4 @@
1
- langchain_agentx/__init__.py,sha256=pZsAuwiCt4PE3SIZy-8M2i69KqjY9ZHafj9Y8CUjpmA,2014
1
+ langchain_agentx/__init__.py,sha256=fth2HJEGBE2s3P92UlQiNbql2glzWE_f5uddTh6FkP4,2014
2
2
  langchain_agentx/command/__init__.py,sha256=Ej260S5uFQcmEtGZQG_NH7BYjHoStrpBLtGUsBTxyZk,631
3
3
  langchain_agentx/command/allowed_tools.py,sha256=TVA0VM8rm98H-QbLK_GRiX5RhEAZFxKawliMi4kk96A,3359
4
4
  langchain_agentx/command/context.py,sha256=DIGOGPBw5UGDBm0WNNJlKx1h_9rCRmcdROv4DT61Qug,731
@@ -146,7 +146,7 @@ langchain_agentx/loop/subagent/active_run_registry.py,sha256=KurhAMDTBnRkdxNidaM
146
146
  langchain_agentx/loop/subagent/async_runner.py,sha256=ZJu6DztRmg0SNEapEuPyQbsk8SprXiMKWDWDHb9L7yQ,14124
147
147
  langchain_agentx/loop/subagent/boundary_snapshot.py,sha256=9cQuqN29nJDRnHnx9c8b09KRmODE2zv15Z06QyjVJps,10008
148
148
  langchain_agentx/loop/subagent/cache_safe_params.py,sha256=-qcgdazEYRy6s4ILQuttpxraE3gsxq17Ro7LYBnuv3E,4460
149
- langchain_agentx/loop/subagent/context.py,sha256=cSyXYu9l5MnHQMEJkCQFTZKhn3pnIR6nGgGKzd_vhr8,25099
149
+ langchain_agentx/loop/subagent/context.py,sha256=YAAR_g7BA_PXL5LGxxO1xWMn5pvVU3VOYSmxdxNPbbg,25243
150
150
  langchain_agentx/loop/subagent/definition_permission.py,sha256=_Y30FA0EDTgqpqjw5luIiwbpABLo17myC3aY4NWbGIw,2188
151
151
  langchain_agentx/loop/subagent/display_projector.py,sha256=AKsGWS1c9reH0kuD5u4oQ24KsBgyt7X10iZM3ere6Fs,3504
152
152
  langchain_agentx/loop/subagent/fork_boilerplate.py,sha256=2Uh3cwegL7V-DvtLIxjX7ik5uW5mXfY2NBzP-biREso,5005
@@ -489,7 +489,7 @@ langchain_agentx/tool_runtime/read_ignore_patterns.py,sha256=l4kNulVDaOdQxcs4FeC
489
489
  langchain_agentx/tool_runtime/read_permission.py,sha256=rwH7NEtL57aUKXVjSf6hMOOvEWOayNFyvI_SNoNCHPA,9284
490
490
  langchain_agentx/tool_runtime/registry.py,sha256=cvdMRz5cyAqLjM0MWWp6wu1DgqtZeMoiR2vgyAVHlb8,3358
491
491
  langchain_agentx/tool_runtime/session_hints.py,sha256=TyoNdSw5GsE5AvYDPHJKsrto9YXZtbAdihI8YKHdRxA,3004
492
- langchain_agentx/tool_runtime/session_store.py,sha256=KEapYa7scu-KBl5R1WwlOOU9J3lynYWgzggtnkiIsRE,17235
492
+ langchain_agentx/tool_runtime/session_store.py,sha256=47asao4mHf75BijGg2OrJhexCUk2k8w3GpMUGYirNxM,17625
493
493
  langchain_agentx/tool_runtime/shell_error.py,sha256=gi2i0sc4qHcUiLD5B2yk-wIvyVaOpLFKyf4ZnnKmAuE,2198
494
494
  langchain_agentx/tool_runtime/smoke_test_runtime.py,sha256=vOdoYdFwsWjq8k7rHD7hkgtgM5noGr9a6Wn1hHZ7354,11846
495
495
  langchain_agentx/tool_runtime/state_bridge.py,sha256=8F7jG8Uk4EVJaAB8rwKpNmbWrNZtIHYJO5RFBiwSRhs,6011
@@ -839,8 +839,8 @@ langchain_agentx/workspace/root_grant_manager.py,sha256=W3gy8HTevbERbXqIgRcjzOXO
839
839
  langchain_agentx/workspace/tool_boundary.py,sha256=UDwX6swpSLsx9HNkYuuRRiV5o7ZZG_Bru2Yn0c5kNX8,5724
840
840
  langchain_agentx/workspace/validators.py,sha256=tQt-6TOcL8Fw7Ig5ebA9S7vGWh1rby920eFW6x8Tk9E,1439
841
841
  langchain_agentx/workspace/view.py,sha256=PGasqTaqhlD03SXXazHuw4RHfV681AIdlsYqL70pEjc,4774
842
- langchain_agentx_python-2.4.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
843
- langchain_agentx_python-2.4.5.dist-info/METADATA,sha256=aK5l6-y3n1a8k25zAxJ8vlWQYMaMDiCH8ReZj9Faka8,23971
844
- langchain_agentx_python-2.4.5.dist-info/WHEEL,sha256=51RkbunBAw4BWsgaQWTpPhg4Diwp3c9P5iaLk67Hdtg,92
845
- langchain_agentx_python-2.4.5.dist-info/top_level.txt,sha256=Ge284pniNt8xea0OLk2o9o32GqVpDhOYk20fwE-0xxA,17
846
- langchain_agentx_python-2.4.5.dist-info/RECORD,,
842
+ langchain_agentx_python-2.4.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
843
+ langchain_agentx_python-2.4.6.dist-info/METADATA,sha256=hlPQGo7vha4ZBFMEIgNs77O8oCYLtYQ-kymif47LSTs,23971
844
+ langchain_agentx_python-2.4.6.dist-info/WHEEL,sha256=51RkbunBAw4BWsgaQWTpPhg4Diwp3c9P5iaLk67Hdtg,92
845
+ langchain_agentx_python-2.4.6.dist-info/top_level.txt,sha256=Ge284pniNt8xea0OLk2o9o32GqVpDhOYk20fwE-0xxA,17
846
+ langchain_agentx_python-2.4.6.dist-info/RECORD,,