langchain-agentx-python 2.2.5__py3-none-any.whl → 2.2.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.2.5"
14
+ __version__ = "2.2.6"
15
15
 
16
16
  from .loop import ( # noqa: F401
17
17
  create_loop_agent,
@@ -176,6 +176,12 @@ class RuntimeTool(ABC):
176
176
  is_concurrency_safe: bool = False
177
177
  """是否支持并发执行。"""
178
178
 
179
+ requires_user_interaction: bool = False
180
+ """
181
+ 对齐 CC ``Tool.requiresUserInteraction()``。
182
+ True 时 bypassPermissions / auto allow 不得吞掉上游 ask(如 AskUser gather)。
183
+ """
184
+
179
185
  never_truncate: bool = False
180
186
  """
181
187
  禁止 ToolOutputManager 截断输出。
@@ -272,6 +278,15 @@ class RuntimeTool(ABC):
272
278
  _ = data, ctx
273
279
  return self.is_concurrency_safe
274
280
 
281
+ def requires_user_interaction_for(
282
+ self,
283
+ data: dict[str, Any],
284
+ ctx: ToolExecutionContext,
285
+ ) -> bool:
286
+ """该次调用是否强制用户交互;默认读取类属性(对齐 CC requiresUserInteraction)。"""
287
+ _ = data, ctx
288
+ return bool(self.requires_user_interaction)
289
+
275
290
  def resolve_capabilities(
276
291
  self,
277
292
  data: dict[str, Any],
@@ -4,12 +4,13 @@ inner_permission_chain.py — CC inner 段 1–5(hasPermissionsToUseToolInner
4
4
  职责:
5
5
  在 PermissionOrchestrator 内编排 global deny/ask → L1 → mode 短路 → path policy
6
6
  → acceptEdits 快路径 → passthrough→ask。
7
+ RUI(requires_user_interaction)上游 ask 对齐 CC step 1e,不被 bypass 吞掉。
7
8
 
8
9
  链路位置:
9
10
  permission_orchestrator._evaluate_inner / _aevaluate_inner
10
11
 
11
12
  当前裁剪范围:
12
- 段 6(auto / L3)不在此模块;auto_mode hook 仍由 aauthorize outer 暂存至 Phase 4。
13
+ 段 6(auto / L3)不在此模块。
13
14
  """
14
15
 
15
16
  from __future__ import annotations
@@ -64,6 +65,9 @@ class InnerPermissionChain:
64
65
  seg12 = self._segment_1_2_global(tool_name, data, ctx, tool_flags)
65
66
  if seg12 is not None:
66
67
  if seg12.behavior == "ask":
68
+ # CC step 1e:RUI + ask 不被 bypassPermissions 吞掉
69
+ if tool.requires_user_interaction_for(data, ctx):
70
+ return seg12
67
71
  seg4 = self._segment_4_mode_shortcircuit(tool, data, ctx, tool_flags)
68
72
  if seg4 is not None:
69
73
  return seg4
@@ -72,6 +76,10 @@ class InnerPermissionChain:
72
76
  l1 = tool.run_l1_permission_check(data, ctx)
73
77
  if l1.outcome != "continue":
74
78
  if l1.outcome == "ask":
79
+ if l1.decision is None:
80
+ raise ValueError(f"L1 outcome={l1.outcome!r} requires decision")
81
+ if tool.requires_user_interaction_for(data, ctx):
82
+ return l1.decision
75
83
  seg4 = self._segment_4_mode_shortcircuit(tool, data, ctx, tool_flags)
76
84
  if seg4 is not None:
77
85
  return seg4
@@ -4,6 +4,7 @@ outer_permission_resolver.py — 段 6 outer 裁决(GAP-3)
4
4
  职责:
5
5
  inner 产出 ask 后:auto 分类器消化 / headless fail-close deny;非 ask 原样返回。
6
6
  classifier 熔断到顶:CLI → ask;headless → ClassifierDenialLimitAbort。
7
+ RUI 工具的 ask 不被 auto allow 吞掉(对齐 CC requiresUserInteraction)。
7
8
 
8
9
  链路位置:
9
10
  PermissionOrchestrator._resolve_outer
@@ -61,6 +62,8 @@ class OuterPermissionResolver:
61
62
  tool_flags = ctx.tool_flags if hasattr(ctx, "tool_flags") else {}
62
63
  mode = str(tool_flags.get("permission_mode", "default"))
63
64
 
65
+ inner_ask = decision
66
+
64
67
  if mode == "auto":
65
68
  auto_decision = await self._run_auto_mode_hook(tool, data, ctx)
66
69
  if auto_decision is not None:
@@ -70,12 +73,18 @@ class OuterPermissionResolver:
70
73
  ctx,
71
74
  headless=headless,
72
75
  )
73
- if auto_decision.behavior in ("allow", "deny", "ask"):
76
+ if (
77
+ auto_decision.behavior == "allow"
78
+ and tool.requires_user_interaction_for(data, ctx)
79
+ ):
80
+ # CC:忽略 auto allow,保留 ask;继续走下方 headless / 透传
81
+ pass
82
+ elif auto_decision.behavior in ("allow", "deny", "ask"):
74
83
  return auto_decision
75
84
 
76
85
  if headless:
77
- return self._headless_deny(decision)
78
- return decision
86
+ return self._headless_deny(inner_ask)
87
+ return inner_ask
79
88
 
80
89
  @staticmethod
81
90
  async def _run_auto_mode_hook(
@@ -84,6 +84,7 @@ class AskUserQuestionTool(RuntimeTool):
84
84
  is_read_only: bool = True
85
85
  is_destructive: bool = False
86
86
  is_concurrency_safe: bool = True
87
+ requires_user_interaction: bool = True
87
88
  never_truncate: bool = False
88
89
  dedupe_identical_calls: bool = False
89
90
  max_result_size_chars: int = 100_000
@@ -183,6 +183,8 @@ class ExitPlanModeRuntimeTool(_PlanModeRuntimeToolBase):
183
183
  description: str = EXIT_PLAN_MODE_DESCRIPTION
184
184
  input_model = ExitPlanModeInput
185
185
  output_model = ExitPlanModeOutput
186
+ # 对齐 CC ExitPlanMode.requiresUserInteraction:bypass/auto 不得静默放行确认
187
+ requires_user_interaction: bool = True
186
188
 
187
189
  def prompt_for_model(self, ctx: ToolPromptContext) -> str:
188
190
  _ = ctx
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-agentx-python
3
- Version: 2.2.5
3
+ Version: 2.2.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=FDi8b0l3oV8v5zS-G33Yb0qoKw5-jje_-Rfu9sxHzOY,1614
1
+ langchain_agentx/__init__.py,sha256=w5E568-acwfUArEGRc1Fs10Ni10VOEs-jLn4UGZVjeE,1614
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
@@ -393,7 +393,7 @@ langchain_agentx/tool_runtime/__init__.py,sha256=C4ZrS6UWSL65ErfNWMvBuZBnht6ZuGb
393
393
  langchain_agentx/tool_runtime/accept_edits_fast_path.py,sha256=UMCOF9Ws7hx3pcYvL-Kq7vzIAGvOGdEfx69ccUDXT-k,2281
394
394
  langchain_agentx/tool_runtime/adapter.py,sha256=rM-Y2zSZ--N-TIvx1HtI1J7ralPU0w4jJuX3bBvIVxM,33847
395
395
  langchain_agentx/tool_runtime/agent_home_bypass.py,sha256=na9xQPgJ02qA3YiJ1F8jN0Uv4uBDPzqRk3lfPPE089g,8010
396
- langchain_agentx/tool_runtime/base.py,sha256=Ez9W42DsaiZcWDDO8UfRKv3E7_Z6WBcABkwdAi6qTK8,21390
396
+ langchain_agentx/tool_runtime/base.py,sha256=asjZ0Rsxchh51OQbt5-h61xoWgC-i5sUbH0e_uSf-X0,21922
397
397
  langchain_agentx/tool_runtime/cancel_projection.py,sha256=81_Bvg8ZiuPdl1usePt7ykXFuO6Sg7UXogYQBX6aysQ,2788
398
398
  langchain_agentx/tool_runtime/capabilities.py,sha256=KHwu5KLqrpPKLOTwHhnvIIs9MTmQYeuS2hAFmI_Nsy8,3837
399
399
  langchain_agentx/tool_runtime/classifier_denial_bridge.py,sha256=Wv40rYc5U3Mn7G3H7sUWrcG78HyLKnrRXvv7Yv9wI5U,2743
@@ -404,14 +404,14 @@ langchain_agentx/tool_runtime/denial_tracking_bridge.py,sha256=qssnZ_tzCIrDeJvtx
404
404
  langchain_agentx/tool_runtime/errors.py,sha256=Ed1FMjBdPfr0WG-YwLIm_7jokl9k_DjHFNiewZTeQfg,8883
405
405
  langchain_agentx/tool_runtime/failure_event_emitter.py,sha256=C7c4Gc7Vo_R6_ah2Xxa2eso7l9Iuz_KTgRV0j0B08rA,10467
406
406
  langchain_agentx/tool_runtime/identical_call_cache.py,sha256=v8WWuTHWR5ThujcMO4Ty28mZS_w-JN24267fZ4PHWK8,3865
407
- langchain_agentx/tool_runtime/inner_permission_chain.py,sha256=zNjrEeeqIZDs_wZzmrfWqFXxCPxgSesEz2VFr1f37S0,16639
407
+ langchain_agentx/tool_runtime/inner_permission_chain.py,sha256=k0uf-Tvr4NitX9xsSvGki2iuwBn0IZZ0t_rQf49CbnE,17075
408
408
  langchain_agentx/tool_runtime/limits.py,sha256=imE1IetmyKQM82INR0VkP3qZNM4bjUJuf1CG5BkY0uw,356
409
409
  langchain_agentx/tool_runtime/loader.py,sha256=ZeT-xIB6TDkehqyYWx1gkvI0aKx9_xKDKJhqyIvlAvw,9397
410
410
  langchain_agentx/tool_runtime/loop_loader.py,sha256=C_4T9XxlDmKaTzGv4MO6mJuR-rd6uueb1ZWwEKvvFaE,9087
411
411
  langchain_agentx/tool_runtime/loop_runtime_context.py,sha256=HBZMdtKD7MpU8o7JmURFZGPTfxr2aFFlFF2nBZR_n8s,3613
412
412
  langchain_agentx/tool_runtime/messages.py,sha256=Fp-ZiLAbOQAQa8uIv-owE8PXtWyhpYSXxtzy3PVbKSw,3631
413
413
  langchain_agentx/tool_runtime/models.py,sha256=cO9EgLKPXiktHl_xXtBwLQrCo6mj4tbT4WoPmuFLE0w,20345
414
- langchain_agentx/tool_runtime/outer_permission_resolver.py,sha256=X3rocXXLvnXCUMufG-mBr1Mk0So7FxLd5nrZo9OE5kg,3763
414
+ langchain_agentx/tool_runtime/outer_permission_resolver.py,sha256=t6vq1f6K0EYZFAlEBV-Ic2hoGB3miVZWqvrZOQv-Z0A,4169
415
415
  langchain_agentx/tool_runtime/override.py,sha256=D8TRftoeWzqlTuWCGUxNkFY7XzWx_d5oxI_ltNibqPA,10258
416
416
  langchain_agentx/tool_runtime/path_safety.py,sha256=dUrl2SObKmRDwdm9k8veO_Eh0iXw0LPLAMZJGxeKnTE,8548
417
417
  langchain_agentx/tool_runtime/permission_context.py,sha256=ReVV2kjVWAPTsPaYXxRB-dICqualEvi2zzwF8NX_Wkk,6229
@@ -524,7 +524,7 @@ langchain_agentx/tools/ask_user_question/constants.py,sha256=vK5QraZBBVj7woW1TF0
524
524
  langchain_agentx/tools/ask_user_question/html_preview.py,sha256=OwNpsH9qm8iJ-TTbzkMFvG49T4-oNJXJXH4OZ8r55wc,3913
525
525
  langchain_agentx/tools/ask_user_question/models.py,sha256=uLc2UK_v8iMFEL1Zk0mUOBYdcg2HfbaLdH68o8kr7GE,3376
526
526
  langchain_agentx/tools/ask_user_question/prompt.py,sha256=0RdVuUeNzQBzPeVrLcbiBqh1uizFgUANvaKOZpVy_qg,2803
527
- langchain_agentx/tools/ask_user_question/tool.py,sha256=-f41ZDny0gi3HLniZ4IoBJJ9bKOQR6GB5D6CE9MpVbI,13362
527
+ langchain_agentx/tools/ask_user_question/tool.py,sha256=KGIjeLD9J_3RR-C3fGpOsuqjULmuobohG0F2ie8i8UI,13405
528
528
  langchain_agentx/tools/ask_user_question/validators.py,sha256=gUYuuKJNrExWGvhFlmhqqSU8ax7s4EhXMvTEjapHeiY,5974
529
529
  langchain_agentx/tools/bash/__init__.py,sha256=molPHFDylE2wWG_aQx7fb0ciAx3wWpdXzIixTZV5ne4,214
530
530
  langchain_agentx/tools/bash/ast_security.py,sha256=6DFd_TwT986dbGkKT3UnDIZioBdmi8mbJcYSI-XEtdM,22444
@@ -591,7 +591,7 @@ langchain_agentx/tools/plan_mode/__init__.py,sha256=wO5FX24xEB0Dx9h6bysBt1ql3wn0
591
591
  langchain_agentx/tools/plan_mode/constants.py,sha256=vBjcx9JTSOhU9jfCJ4RKnCxVQPn0HzHapouKxRf2Zns,293
592
592
  langchain_agentx/tools/plan_mode/models.py,sha256=kRHPJetlB9X5nAq7-bWm1WcC68YsAj17UxY7fR6TpZ4,1204
593
593
  langchain_agentx/tools/plan_mode/prompt.py,sha256=69o04P598fYs70EaHmpx6_XTk6fgxj06njn5Qq51YF0,3935
594
- langchain_agentx/tools/plan_mode/tool.py,sha256=SBp3MZoPEsLiDOu6qXYDIxZwkG0z8OpLDSqIW2aT3iM,8717
594
+ langchain_agentx/tools/plan_mode/tool.py,sha256=IDOPKUn2cdvO43Evsu5Ns0U6x1T3aji8IOtqdBDDyYU,8852
595
595
  langchain_agentx/tools/read/__init__.py,sha256=82jaYnSYVxREh7HR3tiPAoNLQGmdCsWlkFXHyUg9-ME,217
596
596
  langchain_agentx/tools/read/backend.py,sha256=YqKJ5jzMIrND3WC582jDvVA2mh2rKZ12LK9Vt-j3bz0,14524
597
597
  langchain_agentx/tools/read/limits.py,sha256=JrCEv1UCzBYevf0rDgGOFFfOAHCo04LjLOCj5m1rmbc,2843
@@ -761,8 +761,8 @@ langchain_agentx/workspace/root_grant_manager.py,sha256=W3gy8HTevbERbXqIgRcjzOXO
761
761
  langchain_agentx/workspace/tool_boundary.py,sha256=UDwX6swpSLsx9HNkYuuRRiV5o7ZZG_Bru2Yn0c5kNX8,5724
762
762
  langchain_agentx/workspace/validators.py,sha256=tQt-6TOcL8Fw7Ig5ebA9S7vGWh1rby920eFW6x8Tk9E,1439
763
763
  langchain_agentx/workspace/view.py,sha256=PGasqTaqhlD03SXXazHuw4RHfV681AIdlsYqL70pEjc,4774
764
- langchain_agentx_python-2.2.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
765
- langchain_agentx_python-2.2.5.dist-info/METADATA,sha256=H6Y0pRHIIab1cfuQGeOYWKXCW0WcbzoFI3fDduI-uDM,24250
766
- langchain_agentx_python-2.2.5.dist-info/WHEEL,sha256=51RkbunBAw4BWsgaQWTpPhg4Diwp3c9P5iaLk67Hdtg,92
767
- langchain_agentx_python-2.2.5.dist-info/top_level.txt,sha256=Ge284pniNt8xea0OLk2o9o32GqVpDhOYk20fwE-0xxA,17
768
- langchain_agentx_python-2.2.5.dist-info/RECORD,,
764
+ langchain_agentx_python-2.2.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
765
+ langchain_agentx_python-2.2.6.dist-info/METADATA,sha256=aFUHiJcRrYfmX1zz5EcopI4JNyrKygDP2OeT6HlaEPg,24250
766
+ langchain_agentx_python-2.2.6.dist-info/WHEEL,sha256=51RkbunBAw4BWsgaQWTpPhg4Diwp3c9P5iaLk67Hdtg,92
767
+ langchain_agentx_python-2.2.6.dist-info/top_level.txt,sha256=Ge284pniNt8xea0OLk2o9o32GqVpDhOYk20fwE-0xxA,17
768
+ langchain_agentx_python-2.2.6.dist-info/RECORD,,