sycommon-python-lib 0.2.7a5__py3-none-any.whl → 0.2.7a7__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.
@@ -599,8 +599,10 @@ class DeepAgent:
599
599
  args_str = str(tc_args_l)[:100]
600
600
  SYLogger.debug(
601
601
  f"[DeepAgent #{stream_step}] tool_call | {tc_l.get('name','?')} | args={args_str}")
602
- elif not (msg.content or ""):
603
- # 检查是否有 reasoning_content(思考模式下内容在 reasoning_content 而非 content)
602
+ elif _STREAM_DEBUG and not (msg.content or ""):
603
+ # 仅在 DEEP_AGENT_STREAM_DEBUG=true 时打印逐 chunk 诊断日志。
604
+ # 生产环境默认关闭:思考模式下每 token 都会触发此分支,
605
+ # "(empty)"/"reasoning_content" 行数会随回答长度线性增长,刷爆日志量。
604
606
  _rc = (
605
607
  getattr(msg, "reasoning_content", None)
606
608
  or getattr(msg, "additional_kwargs", {}).get("reasoning_content", None)
@@ -2,11 +2,11 @@
2
2
 
3
3
  拦截 `execute` 工具(FilesystemMiddleware 注册的 shell 执行工具),做两件事:
4
4
 
5
- 1. 从命令路径推断子技能名(skills/<域>/<子技能>/scripts/<子技能>),
6
- 查 SkillApiWhitelist 配置得到该子技能的白名单,把占位符 ${VAR} 在主进程
5
+ 1. 从命令路径推断顶级技能名(skills/<顶级技能>/<顶级技能>,如 sy-oa-skill),
6
+ 查 SkillApiWhitelist 配置得到该顶级技能的白名单,把占位符 ${VAR} 在主进程
7
7
  解析成完整 URL,序列化成 JSON 后以 `export SKILL_API_WHITELIST='<json>'`
8
8
  前缀注入命令——供沙箱内 sitecustomize.py 读取并 monkeypatch urllib/
9
- httpx/requests/aiohttp
9
+ httpx/requests/aiohttp。每个顶级技能的 allowlist 是其下所有子技能出网地址的并集。
10
10
 
11
11
  2. 命令前缀内联 curl/wget 的 shell 函数包装:纯 shell 命令(不走 Python)
12
12
  不会触发 sitecustomize,故用 shell 函数在执行 curl/wget 前调
@@ -33,10 +33,12 @@ from sycommon.logging.kafka_log import SYLogger
33
33
  # 命令路径形如 skills/sy-oa-skill/workflow-todo/scripts/x.py
34
34
  # skills/sy-syt-skill/shengye-platform-zhongdeng/SKILL.md
35
35
  # skills/sy-syt-skill/generate-plan/... (有/无 scripts/ 都识别)
36
- # 取「skills/<域>/<子技能>/」的第二段作子技能名,不限 scripts/,覆盖文档目录型子技能。
37
- # (?:/|$) 锚定第二段结尾,避免误吞后续路径段。
38
- _SKILL_NESTED_RE = re.compile(r'skills/[A-Za-z0-9_\-]+/([A-Za-z0-9_\-]+)(?:/|$)')
39
- _SKILL_FLAT_RE = re.compile(r'/skills/([A-Za-z0-9_\-]+)(?:/|$)')
36
+ # 取「skills/<顶级技能>/」的【第一段】作顶级技能名(如 sy-oa-skill),
37
+ # 配合 SkillApiWhitelist 按顶级技能(5 个域)配置——每个域的 allowlist 是其下
38
+ # 所有子技能出网地址的并集。用 (?:/|$) 锚定段尾,避免误吞后续路径段。
39
+ # (?<![\w]) 否定左查找:要求 skills 前不是单词字符,避免误匹配 myskills/、
40
+ # theskills/ 等含 skills 子串的路径(行首、空格、引号、/ 后均成立)。
41
+ _SKILL_TOP_RE = re.compile(r'(?<![\w])skills/([A-Za-z0-9_\-]+)(?:/|$)')
40
42
 
41
43
  # BASE_URL 占位符 ${VAR}
42
44
  _PLACEHOLDER_RE = re.compile(r'\$\{([A-Z_][A-Z0-9_]*)\}')
@@ -181,12 +183,9 @@ class SkillApiWhitelistMiddleware(AgentMiddleware):
181
183
  SYLogger.error("[Whitelist] 推送 sitecustomize 失败(fail-open): %s", e)
182
184
  return False
183
185
 
184
- # ---- 子技能名提取 ----
186
+ # ---- 顶级技能名提取 ----
185
187
  def _extract_skill_name(self, command: str) -> Optional[str]:
186
- m = _SKILL_NESTED_RE.search(command)
187
- if m:
188
- return m.group(1)
189
- m = _SKILL_FLAT_RE.search(command)
188
+ m = _SKILL_TOP_RE.search(command)
190
189
  if m:
191
190
  return m.group(1)
192
191
  return None
@@ -208,7 +207,7 @@ class SkillApiWhitelistMiddleware(AgentMiddleware):
208
207
 
209
208
  skill_name = self._extract_skill_name(command)
210
209
  if skill_name is None:
211
- # 非技能命令(无 skills/.../scripts/)→ 不管控
210
+ # 非技能命令(无 skills/<顶级技能>/)→ 不管控
212
211
  return await handler(request)
213
212
 
214
213
  # 延迟导入避免模块加载期循环依赖
@@ -1,10 +1,14 @@
1
1
  """技能接口白名单配置模型。
2
2
 
3
- 定义「单个子技能被允许访问的外部接口白名单」,配置来源是 Nacos 的
4
- `shengye-platform-digital-work` dataId 下的 `SkillApiWhitelist` 列表:
3
+ 定义「单个顶级技能被允许访问的外部接口白名单」,配置来源是 Nacos 的
4
+ `shengye-platform-digital-work` dataId 下的 `SkillApiWhitelist` 列表。
5
+
6
+ 配置粒度按顶级技能(5 个域:sy-oa-skill / sy-syt-skill / sy-eas-skill /
7
+ sy-metting-skill / skill-creator),每个域的 allowlist 是其下所有子技能
8
+ 出网地址的并集。skill 字段取自 `skills/<顶级技能>/` 的第一段目录名:
5
9
 
6
10
  SkillApiWhitelist:
7
- - skill: workflow-todo # 子技能名(skills/<域>/<子技能>/scripts/ 里的 <子技能>)
11
+ - skill: sy-oa-skill # 顶级技能名(skills/<顶级技能>/ 里的 <顶级技能>)
8
12
  enabled: true
9
13
  allowlist:
10
14
  - "${OA_WORKFLOW_URL}" # BASE_URL 占位符,主进程解析成完整 URL
@@ -13,9 +17,9 @@
13
17
  - "/wf" # 纯 path 前缀(匹配任意 host,谨慎用)
14
18
 
15
19
  语义约定(务必在 Nacos 配置注释里写明):
16
- - 子技能【未出现】在配置里 → 不管控,全放行(向后兼容)
20
+ - 顶级技能【未出现】在配置里 → 不管控,全放行(向后兼容)
17
21
  - enabled: false → 全放行
18
- - allowlist: [](空数组) → 明确禁止该子技能任何外网请求(全拦截)
22
+ - allowlist: [](空数组) → 明确禁止该顶级技能任何外网请求(全拦截)
19
23
 
20
24
  代码侧用 `SkillApiWhitelistConfig.from_config(skill)` 按 skill 取单条,
21
25
  或 `list_from_config()` 取全部。
@@ -30,8 +34,9 @@ class SkillApiWhitelistConfig(BaseModel):
30
34
  """单个子技能的接口白名单配置。"""
31
35
 
32
36
  skill: str = Field(
33
- description="子技能名,对应命令路径 skills/<域>/<子技能>/scripts/x.py 里的 <子技能>,"
34
- "如 'workflow-todo'、'oa-workorder'、'wecomcli-wrapper'")
37
+ description="顶级技能名,对应 skills/<顶级技能>/ 目录,"
38
+ "如 'sy-oa-skill'、'sy-syt-skill'、'sy-eas-skill'"
39
+ "'sy-metting-skill'、'skill-creator'")
35
40
  enabled: bool = Field(default=True, description="是否启用白名单管控;False 则全放行")
36
41
  allowlist: list[str] = Field(
37
42
  default_factory=list,
@@ -39,7 +44,7 @@ class SkillApiWhitelistConfig(BaseModel):
39
44
  "白名单条目(字符串数组)。每条可以是:完整 URL(https://...)、"
40
45
  "BASE_URL 占位符(${ENV_VAR} 或 ${ENV_VAR}/path)、纯 path 前缀(/wf)。"
41
46
  "主进程加载时把 ${ENV_VAR} 解析成完整 URL,运行期做 path 级前缀匹配。"
42
- "空数组 [] = 明确禁止该子技能任何外网请求。"
47
+ "空数组 [] = 明确禁止该顶级技能任何外网请求。"
43
48
  ))
44
49
 
45
50
  @classmethod
@@ -52,7 +57,7 @@ class SkillApiWhitelistConfig(BaseModel):
52
57
 
53
58
  @classmethod
54
59
  def list_from_config(cls) -> list["SkillApiWhitelistConfig"]:
55
- """从 Nacos 配置取全部已配置的子技能白名单。
60
+ """从 Nacos 配置取全部已配置的顶级技能白名单。
56
61
 
57
62
  配置读 `Config().config.get("SkillApiWhitelist", [])`——即
58
63
  `shengye-platform-digital-work` dataId 下的 SkillApiWhitelist 列表
@@ -1,26 +1,26 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sycommon-python-lib
3
- Version: 0.2.7a5
3
+ Version: 0.2.7a7
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
7
7
  Requires-Dist: aio-pika==9.6.2
8
8
  Requires-Dist: aiohttp==3.14.1
9
9
  Requires-Dist: aiomysql==0.3.2
10
- Requires-Dist: anyio==4.14.0
10
+ Requires-Dist: anyio==4.14.1
11
11
  Requires-Dist: decorator==5.3.1
12
12
  Requires-Dist: deepagents==0.6.11
13
13
  Requires-Dist: elasticsearch==9.4.1
14
- Requires-Dist: fastapi==0.138.0
14
+ Requires-Dist: fastapi==0.138.1
15
15
  Requires-Dist: jinja2==3.1.6
16
- Requires-Dist: kafka-python==3.0.2
16
+ Requires-Dist: kafka-python==3.0.6
17
17
  Requires-Dist: langchain==1.3.11
18
18
  Requires-Dist: langchain-core==1.4.8
19
19
  Requires-Dist: langchain-openai==1.3.3
20
- Requires-Dist: langfuse==4.9.1
20
+ Requires-Dist: langfuse==4.12.0
21
21
  Requires-Dist: langgraph==1.2.6
22
22
  Requires-Dist: langgraph-checkpoint-postgres==3.1.0
23
- Requires-Dist: langgraph-checkpoint-redis==0.4.1
23
+ Requires-Dist: langgraph-checkpoint-redis==0.5.0
24
24
  Requires-Dist: ldap3==2.9.1
25
25
  Requires-Dist: loguru==0.7.3
26
26
  Requires-Dist: mysql-connector-python==9.7.0
@@ -136,7 +136,7 @@ sycommon/services.py,sha256=CwC_gESafo05Qn41KLQgtulx6PfX7s2FkxlBI-hXve4,24861
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=ZcqQ8aVo6PYx3YWzV8aEV9HRtuXuoVUyXWGwXUJ_VTw,67278
139
+ sycommon/agent/deep_agent.py,sha256=08PIMuO_XbKrKBsvewfBqEWQy-2rUlbjh9icHJCakH4,67495
140
140
  sycommon/agent/multi_agent_team.py,sha256=mskS-FJbAB_n5kghjHhiWxpA3L9cD1lObeW_wjrLI6s,27079
141
141
  sycommon/agent/summarization_utils.py,sha256=zAnNtqzZ6mKmLVpLQLgcnbdV0D5ohxpAjPkg9Uz2V7s,17934
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/sitecustomize.py,sha256=Bt7XFnWV_LJo89l858AGp5VUkXwefpLGmjkCtLe-CMw,4800
151
- sycommon/agent/middleware/skill_api_whitelist.py,sha256=vAAUGIYYKVYAzJVYB0tTObLweQ1OBTnCfPPbc37yTfo,11029
151
+ sycommon/agent/middleware/skill_api_whitelist.py,sha256=V8QjPwtj0msCxlU10PaXyaWWFnFACjNZg_BFByo_kO4,11263
152
152
  sycommon/agent/middleware/skill_wl_check.py,sha256=rCJ9F6aWPh8tVQBIPmcq2lKDsfwiJQduwSUku_8kXfs,3952
153
153
  sycommon/agent/sandbox/__init__.py,sha256=jR7LlkD4J4Y6QYyRXQClkwmqDBCCPmycV_hQV9p9YHw,4621
154
154
  sycommon/agent/sandbox/consistent_hash.py,sha256=8Jgk-W4NAD2-u5_vKRVlPmql_e0Vy4aNORiXOuzvIrs,7277
@@ -176,7 +176,7 @@ sycommon/config/PgConfig.py,sha256=Hs9LwgIxSBxcFP16oq18N6Gq9hU2qVl4-7bPfd-ON_s,2
176
176
  sycommon/config/RedisConfig.py,sha256=gIa4BS8L_HdmBg9Dkv3cuIK6CU9zt9RodZOJUuUlh5Y,5235
177
177
  sycommon/config/RerankerConfig.py,sha256=35sVwzus2IscvTHnCG63Orl2pC-pMsrVi6wAGDmOH3U,341
178
178
  sycommon/config/SentryConfig.py,sha256=OsLb3G9lTsCSZ7tWkcXWJHmvfILQopBxje5pjnkFJfo,320
179
- sycommon/config/SkillApiWhitelistConfig.py,sha256=ovxpBIY5rlafniydQ1UR4xYdaS3wfkk5ju_mVJAj4Y4,3764
179
+ sycommon/config/SkillApiWhitelistConfig.py,sha256=-fimbAofnYSZRhksmvg_rrZOJPc76wSWClH57L1xg-s,4059
180
180
  sycommon/config/XxlJobConfig.py,sha256=VSG6dn9ysfUVunOs7PqugyZUGJWmX_cEePz2ZCfqHtU,392
181
181
  sycommon/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
182
182
  sycommon/config/config_change_notifier.py,sha256=7qQe7vdBS1zohEfVq0d5IaDqYsLdgd2ckF4mKKgh0gE,6848
@@ -305,8 +305,8 @@ sycommon/tools/syemail.py,sha256=BDFhgf7WDOQeTcjxJEQdu0dQhnHFPO_p3eI0-Ni3LhQ,561
305
305
  sycommon/tools/timing.py,sha256=OiiE7P07lRoMzX9kzb8sZU9cDb0zNnqIlY5pWqHcnkY,2064
306
306
  sycommon/xxljob/__init__.py,sha256=7eoBlQxv-B39IfRSCY2bkqdGYs1QRe1umAWd88VMEEM,86
307
307
  sycommon/xxljob/xxljob_service.py,sha256=1yifwIBNGsCIxLnQjHKiBlbsigc_zvPH-dMTZcNxe-Q,7649
308
- sycommon_python_lib-0.2.7a5.dist-info/METADATA,sha256=dC6l-dxbcElpxqKBFZVmPTNYxSDYWmoAJFaVFCS2m74,7960
309
- sycommon_python_lib-0.2.7a5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
310
- sycommon_python_lib-0.2.7a5.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
311
- sycommon_python_lib-0.2.7a5.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
312
- sycommon_python_lib-0.2.7a5.dist-info/RECORD,,
308
+ sycommon_python_lib-0.2.7a7.dist-info/METADATA,sha256=N0tzTBj_YOHqwinNKsiMxYV34Nf0jnUG34-q0yoVIXs,7961
309
+ sycommon_python_lib-0.2.7a7.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
310
+ sycommon_python_lib-0.2.7a7.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
311
+ sycommon_python_lib-0.2.7a7.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
312
+ sycommon_python_lib-0.2.7a7.dist-info/RECORD,,