sycommon-python-lib 0.2.12a10__py3-none-any.whl → 0.2.12a11__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.
@@ -81,6 +81,23 @@ MAX_ARGS_BUFFER_BYTES = int(os.environ.get("DEEP_AGENT_MAX_ARGS_BUFFER", 1024 *
81
81
  # 需 >= _match_summary_prefix_overlap 的 min_overlap(20) 且覆盖典型复述开头。
82
82
  _DEFENSE4_PROBE_CHARS = int(os.environ.get("DEEP_AGENT_DEFENSE4_PROBE", 120))
83
83
 
84
+
85
+ def _is_punct_only(s: str) -> bool:
86
+ """reasoning chunk 是否只含标点/空白(如 "." 续思考占位 token)。
87
+
88
+ 思考型模型的思考流里常有单个标点的 chunk,原样转发会在前端渲染成
89
+ 「已思考: .」空块。字母/数字/汉字任一出现即 False(一句话里的符号
90
+ 不受影响——只有整 chunk 全是标点/空白才过滤)。与 Go 侧
91
+ deep_agent.go isPunctuationOnly 同语义。
92
+ """
93
+ import unicodedata
94
+ for ch in s:
95
+ cat = unicodedata.category(ch)
96
+ # P* = 标点(含中文标点),Zs/Zl/Zp = 空白分隔;Cc 覆盖 \n\t 等
97
+ if not (cat.startswith("P") or cat.startswith("Z") or cat == "Cc"):
98
+ return False
99
+ return True
100
+
84
101
  if TYPE_CHECKING:
85
102
  from deepagents.graph import CompiledStateGraph
86
103
  from langchain.agents.middleware.types import AgentState, ContextT, ModelRequest, ModelResponse, ResponseT
@@ -749,15 +766,19 @@ class DeepAgent:
749
766
  )
750
767
  if reasoning_content:
751
768
  ai_text_content += reasoning_content
752
- event = ChatEventBuilder.ai_chunk(
753
- reasoning_content,
754
- id=getattr(msg, "id", None),
755
- agent=DEFAULT_AGENT_NAME,
756
- )
757
- event.data["reasoning"] = True
758
- if on_event:
759
- await on_event(event)
760
- yield event
769
+ # 纯标点/空白 chunk(如 "." 续思考占位 token)不发射:
770
+ # 单独成块在前端就是一行「已思考: .」噪音;仍计入
771
+ # ai_text_content(空响应判定依据)与流完整性。
772
+ if not _is_punct_only(reasoning_content):
773
+ event = ChatEventBuilder.ai_chunk(
774
+ reasoning_content,
775
+ id=getattr(msg, "id", None),
776
+ agent=DEFAULT_AGENT_NAME,
777
+ )
778
+ event.data["reasoning"] = True
779
+ if on_event:
780
+ await on_event(event)
781
+ yield event
761
782
 
762
783
  # 处理 tool_call_chunks(流式分片逐步到达,args 是字符串片段)
763
784
  tool_call_chunks = getattr(msg, "tool_call_chunks", [])
@@ -353,15 +353,19 @@ class MultiAgentTeam:
353
353
  )
354
354
  )
355
355
  if reasoning_content:
356
- event = ChatEventBuilder.ai_chunk(
357
- reasoning_content,
358
- id=getattr(msg, "id", None),
359
- agent=current_agent,
360
- )
361
- event.data["reasoning"] = True
362
- if on_event:
363
- await on_event(event)
364
- yield event
356
+ # 纯标点/空白 chunk("." 占位 token)不发射,同
357
+ # deep_agent._is_punct_only 语义。
358
+ from sycommon.agent.deep_agent import _is_punct_only
359
+ if not _is_punct_only(reasoning_content):
360
+ event = ChatEventBuilder.ai_chunk(
361
+ reasoning_content,
362
+ id=getattr(msg, "id", None),
363
+ agent=current_agent,
364
+ )
365
+ event.data["reasoning"] = True
366
+ if on_event:
367
+ await on_event(event)
368
+ yield event
365
369
 
366
370
  tool_calls = getattr(msg, "tool_calls", [])
367
371
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sycommon-python-lib
3
- Version: 0.2.12a10
3
+ Version: 0.2.12a11
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -137,8 +137,8 @@ sycommon/services.py,sha256=bGwsfKnm2CYNquesAJUqVu31kn5JXZmHvfjGkP0tjvA,31090
137
137
  sycommon/agent/__init__.py,sha256=mxceAeUifQ-DKvWp7ZEJIFlmOCb5wpYHPGQw3rwEN8I,4378
138
138
  sycommon/agent/agent_manager.py,sha256=6GpQHk2PBX4UvvyosGKXtGkuEc5Jh0gi1iZqbyXjg04,18833
139
139
  sycommon/agent/chat_events.py,sha256=t7qWa6OrIWLfqtd1AnqaVP67QWkn1JxpCBTZYQpoLuM,14226
140
- sycommon/agent/deep_agent.py,sha256=p9MXKFHZvLQyiKpRbJ8mHKtLdFjQTydbYY-pv4ZbE3s,92793
141
- sycommon/agent/multi_agent_team.py,sha256=GRXjjrPblsMnLjY2aB5CeFJ6-F7wvPhUc_JxNjfBXes,34789
140
+ sycommon/agent/deep_agent.py,sha256=5RWhVQ4f6gO7rHmFS3uKDN7e-Oog66_ePjjdCN5NT94,93905
141
+ sycommon/agent/multi_agent_team.py,sha256=TxcQRSXHWnPnAsQfzcaHRXcaLZy1mtIHpXvK6QGtJcA,35110
142
142
  sycommon/agent/reasoning_content_patch.py,sha256=HZ_If0qVDHlz_b1mDT3tuTqbExhzRVhP4VgsoDt0JLc,3945
143
143
  sycommon/agent/resume_compactor.py,sha256=CJp3AUqeStr8U2JeWP31DyulomXZdrkLL4kVtLxnwn8,20849
144
144
  sycommon/agent/skills_retry_patch.py,sha256=syDXFpnz8dVV4tCbJXc3XxLCUab8uePfbKfvE8Fmo44,4566
@@ -404,8 +404,8 @@ sycommon/tools/usercache.py,sha256=Zu2oiXISUOojleEYCAS9t06ZzgWSNHCIhCjv4yTtkRw,4
404
404
  sycommon/xxljob/__init__.py,sha256=7eoBlQxv-B39IfRSCY2bkqdGYs1QRe1umAWd88VMEEM,86
405
405
  sycommon/xxljob/sharding.py,sha256=LJ0tle7qSUS32S5ntjzri1aOcPzwL5CFde3W4Rf1AUE,2560
406
406
  sycommon/xxljob/xxljob_service.py,sha256=1yifwIBNGsCIxLnQjHKiBlbsigc_zvPH-dMTZcNxe-Q,7649
407
- sycommon_python_lib-0.2.12a10.dist-info/METADATA,sha256=emQK4_irC397M8Cii8XFnDExMdoEMTY4Ul9PniSoOwI,8029
408
- sycommon_python_lib-0.2.12a10.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
409
- sycommon_python_lib-0.2.12a10.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
410
- sycommon_python_lib-0.2.12a10.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
411
- sycommon_python_lib-0.2.12a10.dist-info/RECORD,,
407
+ sycommon_python_lib-0.2.12a11.dist-info/METADATA,sha256=anp2B5t64V7EKLz2vhFlBH5_fO6bm9-jWa3ZdvcXV4c,8029
408
+ sycommon_python_lib-0.2.12a11.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
409
+ sycommon_python_lib-0.2.12a11.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
410
+ sycommon_python_lib-0.2.12a11.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
411
+ sycommon_python_lib-0.2.12a11.dist-info/RECORD,,