sycommon-python-lib 0.2.7a26__py3-none-any.whl → 0.2.7a28__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.
@@ -97,11 +97,12 @@ def _patch_agent_streaming(agent):
97
97
  删除此函数及调用即可。
98
98
  """
99
99
  # 已验证兼容的版本范围(超出仅警告, 不阻断 —— 闭包强校验是真正的安全网)
100
- # 1.3.10/1.3.11 + langchain_core 1.4.8 经实测确认闭包结构兼容(amodel_node
101
- # freevars _execute_model_async, 内层 freevars 含 _get_bound_model/
102
- # _handle_model_output), patch 正常生效。1.3.11 _execute_model_async 仍为
103
- # ainvoke + 不传 config, 官方未修复, 补丁仍需保留。
104
- _VERIFIED = {"langchain": "1.3.11", "langchain_core": "1.4.8"}
100
+ # 1.3.10/1.3.11/1.3.12 + langchain_core 1.4.8/1.4.9 经实测确认闭包结构兼容
101
+ # (factory.py 1.3.11→1.3.12 字节级无变化: amodel_node freevars 含
102
+ # _execute_model_async, 内层 freevars _get_bound_model/_handle_model_output),
103
+ # patch 正常生效。1.3.12 的 _execute_model_async 仍为 ainvoke + 不传 config,
104
+ # 官方未修复, 补丁仍需保留。
105
+ _VERIFIED = {"langchain": "1.3.12", "langchain_core": "1.4.9"}
105
106
  try:
106
107
  import langchain as _lc
107
108
  import langchain_core as _lcc
@@ -193,12 +193,14 @@ def _parse_detect_json(text: str) -> Optional[SensitiveCheck]:
193
193
  # 或 "is_sensitive: true- reason: ..." 这种换行被吞的畸形文本)。
194
194
  # 注意:在 4a/4b 走完仍未返回时才到这里,此时要么没大括号、
195
195
  # 要么大括号是工具结果片段(不是判定 JSON),用正则从全文提判定字段更稳。
196
- m_bool = re.search(r'is[_\s\-]*sensitive["\']?\s*[::]\s*(true|false)', text, re.I)
196
+ # 🔑 支持 [::=] 三种分隔符:模型常写 "is_sensitive: true"(冒号)
197
+ # "is_sensitive=true"(等号,Qwen thinking 模式常见),否则等号写法会漏判 fail-open。
198
+ m_bool = re.search(r'is[_\s\-]*sensitive["\']?\s*[::=]\s*(true|false)', text, re.I)
197
199
  if m_bool:
198
200
  data = {"is_sensitive": m_bool.group(1).lower() == "true"}
199
201
  # reason: 取到行尾(容忍换行被吞成空格,遇下一个字段名停止)
200
202
  m_reason = re.search(
201
- r'reason["\']?\s*[::]\s*["\']?(.+?)(?=\s*(?:[\-]*\s*)?(?:reason|source|is[_\s\-]*sensitive)["\']?\s*[::]|$)',
203
+ r'reason["\']?\s*[::=]\s*["\']?(.+?)(?=\s*(?:[\-]*\s*)?(?:reason|source|is[_\s\-]*sensitive)["\']?\s*[::=]|$)',
202
204
  text, re.I | re.DOTALL)
203
205
  if m_reason:
204
206
  r = m_reason.group(1).strip()
@@ -206,9 +208,16 @@ def _parse_detect_json(text: str) -> Optional[SensitiveCheck]:
206
208
  r = r.split("\n", 1)[0].strip().strip('"\'')
207
209
  if r:
208
210
  data["reason"] = r
209
- m_source = re.search(r'source["\']?\s*[::]\s*["\']?(user_input|tool_result|history)', text, re.I)
211
+ # 🔑 source 容错:模型可能把 user_input 写残(如 "user_in")或带尾随文字。
212
+ # 匹配 user_input/tool_result/history 的【前缀】(user_in → user_input),
213
+ # 匹配不到时默认 user_input(最安全的阻断来源判定,避免整条 fail-open)。
214
+ m_source = re.search(r'source["\']?\s*[::=]\s*["\']?(user_input|tool_result|history)',
215
+ text, re.I)
210
216
  if m_source:
211
217
  data["source"] = m_source.group(1).lower()
218
+ elif "user" in text.lower() and "input" not in text.lower():
219
+ # 疑似 user_input 写残但能看出是用户输入来源
220
+ pass # 留默认值
212
221
  try:
213
222
  return SensitiveCheck(**{k: v for k, v in data.items() if v is not None})
214
223
  except Exception:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sycommon-python-lib
3
- Version: 0.2.7a26
3
+ Version: 0.2.7a28
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -14,10 +14,10 @@ Requires-Dist: elasticsearch==9.4.1
14
14
  Requires-Dist: fastapi==0.139.0
15
15
  Requires-Dist: jinja2==3.1.6
16
16
  Requires-Dist: kafka-python==3.0.7
17
- Requires-Dist: langchain==1.3.11
18
- Requires-Dist: langchain-core==1.4.8
19
- Requires-Dist: langchain-openai==1.3.3
20
- Requires-Dist: langfuse==4.13.0
17
+ Requires-Dist: langchain==1.3.12
18
+ Requires-Dist: langchain-core==1.4.9
19
+ Requires-Dist: langchain-openai==1.3.4
20
+ Requires-Dist: langfuse==4.13.2
21
21
  Requires-Dist: langgraph==1.2.8
22
22
  Requires-Dist: langgraph-checkpoint-postgres==3.1.0
23
23
  Requires-Dist: langgraph-checkpoint-redis==0.5.0
@@ -36,7 +36,7 @@ Requires-Dist: sentry-sdk[fastapi]==2.64.0
36
36
  Requires-Dist: sqlalchemy[asyncio]==2.0.51
37
37
  Requires-Dist: starlette[full]==1.3.1
38
38
  Requires-Dist: tiktoken==0.13.0
39
- Requires-Dist: uvicorn==0.49.0
39
+ Requires-Dist: uvicorn==0.51.0
40
40
  Requires-Dist: wecom-aibot-python-sdk==1.0.2
41
41
  Requires-Dist: twine==6.2.0
42
42
  Requires-Dist: minio==7.2.20
@@ -136,7 +136,7 @@ sycommon/services.py,sha256=iC73h5d5bpNqW2qjRUGODZFhUhcwvKVnKUFLKJlBSq0,25322
136
136
  sycommon/agent/__init__.py,sha256=mxceAeUifQ-DKvWp7ZEJIFlmOCb5wpYHPGQw3rwEN8I,4378
137
137
  sycommon/agent/agent_manager.py,sha256=UhhaekEumT7g4v_Z1UB4jTp13X0n8M8erYaQdkGGWkA,13620
138
138
  sycommon/agent/chat_events.py,sha256=t7qWa6OrIWLfqtd1AnqaVP67QWkn1JxpCBTZYQpoLuM,14226
139
- sycommon/agent/deep_agent.py,sha256=FI7tDrX6BUZiefOoSROmQj_1zmtm1ZMqOglSMawnmNc,74729
139
+ sycommon/agent/deep_agent.py,sha256=XdKpBC5ik-GHU2PyZ4KOeSF3EB2-A-r0SmAV3XJN7lI,74799
140
140
  sycommon/agent/multi_agent_team.py,sha256=RFXHB9q5j1_2B-MDZVRTcbXHdEpRIXpAhrm1yroUDYI,30460
141
141
  sycommon/agent/summarization_utils.py,sha256=bqZRFqSekNGlv2mYQPaT_s2QNA5VDTKddi2Va_SkHWc,18376
142
142
  sycommon/agent/acp/__init__.py,sha256=vQGMQYAA5-ZaejYmDZ4r4Fklqs17qH3cDXQ5pZlwj-0,1844
@@ -148,7 +148,7 @@ sycommon/agent/mcp/__init__.py,sha256=iKrdDhIrFsNIkqG_kgcwNe-nOiM6uVfolKv44LfQ-F
148
148
  sycommon/agent/mcp/models.py,sha256=zda4ho-UTYOJ5oPAZPZ-vxhfDRLghUCsMroHnA2A2QQ,1490
149
149
  sycommon/agent/mcp/tool_loader.py,sha256=OQa-lE7RL2s3Lqh-kNOKaUrb130hvorB_HjyFBqZBZs,10960
150
150
  sycommon/agent/middleware/sandbox_path_guard.py,sha256=K1SnxA8pDxkCSucOkranwUvC9_8rd3l_-TIR8gMMTK8,8102
151
- sycommon/agent/middleware/sensitive_guard.py,sha256=ApmC094ogG4jIwEWRaUawTpQSDs722k0OTjdeAEQ7Qc,22159
151
+ sycommon/agent/middleware/sensitive_guard.py,sha256=8e7qSAoak0MNB5fRLscQF0PVGZ07SKdwmGk590GubOI,22870
152
152
  sycommon/agent/middleware/sitecustomize.py,sha256=Bt7XFnWV_LJo89l858AGp5VUkXwefpLGmjkCtLe-CMw,4800
153
153
  sycommon/agent/middleware/skill_api_whitelist.py,sha256=2qVsrwS6VkkPKHrvjJMNUfBDokdMJkP-mn-V-ZCn7X8,16643
154
154
  sycommon/agent/middleware/skill_wl_check.py,sha256=rCJ9F6aWPh8tVQBIPmcq2lKDsfwiJQduwSUku_8kXfs,3952
@@ -308,8 +308,8 @@ sycommon/tools/syemail.py,sha256=BDFhgf7WDOQeTcjxJEQdu0dQhnHFPO_p3eI0-Ni3LhQ,561
308
308
  sycommon/tools/timing.py,sha256=OiiE7P07lRoMzX9kzb8sZU9cDb0zNnqIlY5pWqHcnkY,2064
309
309
  sycommon/xxljob/__init__.py,sha256=7eoBlQxv-B39IfRSCY2bkqdGYs1QRe1umAWd88VMEEM,86
310
310
  sycommon/xxljob/xxljob_service.py,sha256=1yifwIBNGsCIxLnQjHKiBlbsigc_zvPH-dMTZcNxe-Q,7649
311
- sycommon_python_lib-0.2.7a26.dist-info/METADATA,sha256=DBrGqUqt5wJG8QAqbbRk7ZfswekMXYBMztNXrW0BnhM,7962
312
- sycommon_python_lib-0.2.7a26.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
313
- sycommon_python_lib-0.2.7a26.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
314
- sycommon_python_lib-0.2.7a26.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
315
- sycommon_python_lib-0.2.7a26.dist-info/RECORD,,
311
+ sycommon_python_lib-0.2.7a28.dist-info/METADATA,sha256=ZwQSR_5KtZWzfjtCNP0r4LmgCQ4rt0_MpssHyLnqMPM,7962
312
+ sycommon_python_lib-0.2.7a28.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
313
+ sycommon_python_lib-0.2.7a28.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
314
+ sycommon_python_lib-0.2.7a28.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
315
+ sycommon_python_lib-0.2.7a28.dist-info/RECORD,,