coding-proxy 0.5.2a2__py3-none-any.whl → 0.5.2a3__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.
- coding/proxy/config/config.default.yaml +5 -3
- coding/proxy/config/session_policy.py +6 -3
- coding/proxy/routing/executor.py +30 -10
- {coding_proxy-0.5.2a2.dist-info → coding_proxy-0.5.2a3.dist-info}/METADATA +1 -1
- {coding_proxy-0.5.2a2.dist-info → coding_proxy-0.5.2a3.dist-info}/RECORD +8 -8
- {coding_proxy-0.5.2a2.dist-info → coding_proxy-0.5.2a3.dist-info}/WHEEL +0 -0
- {coding_proxy-0.5.2a2.dist-info → coding_proxy-0.5.2a3.dist-info}/entry_points.txt +0 -0
- {coding_proxy-0.5.2a2.dist-info → coding_proxy-0.5.2a3.dist-info}/licenses/LICENSE +0 -0
|
@@ -704,9 +704,11 @@ session_policies:
|
|
|
704
704
|
title_vendor_bindings:
|
|
705
705
|
- prefix: "# 目标"
|
|
706
706
|
vendor: "zhipu"
|
|
707
|
-
# Session
|
|
708
|
-
#
|
|
709
|
-
#
|
|
707
|
+
# Session 标题豁免前缀:标题提取每一层(user 文本 / 工具结果 / 图片 / 元数据兜底)
|
|
708
|
+
# 产出的候选以任一前缀开头则跳过,继续向下一层回退。既用于过滤注入式 Prompt
|
|
709
|
+
# (如示例语言指令),也可豁免无信息量的合成兜底标题。大小写敏感 startswith。
|
|
710
|
+
# 例:添加 "[Session]" 可让 [Session] <model> 这类兜底标题不再写入,
|
|
711
|
+
# session 标题保持空,待后续真实输入经延迟补写回填。
|
|
710
712
|
# ⚠️ 自定义 yaml 中该字段为整体替换(loader 的 list 合并约定,非追加合并);
|
|
711
713
|
# 写空列表即关闭豁免。加载时会自动 strip + 去空 + 去重。
|
|
712
714
|
title_exempt_prefixes:
|
|
@@ -84,9 +84,12 @@ class SessionPoliciesConfig(BaseModel):
|
|
|
84
84
|
title_exempt_prefixes: list[str] = Field(
|
|
85
85
|
default_factory=list,
|
|
86
86
|
description=(
|
|
87
|
-
"Session
|
|
88
|
-
"
|
|
89
|
-
"
|
|
87
|
+
"Session 标题豁免前缀名单。标题提取的每一层(user TEXT 噪声剥离、"
|
|
88
|
+
"TOOL_RESULT 摘要、IMAGE 计数、元数据兜底)产出的候选,若以任一前缀"
|
|
89
|
+
"开头,则视为豁免、继续向下一层回退;全部层级均被豁免时返回空串,"
|
|
90
|
+
"调用方据此跳过写库,session 标题保持空待后续真实输入回填。"
|
|
91
|
+
"既用于过滤注入式 Prompt(如示例语言指令),也可豁免无信息量的合成"
|
|
92
|
+
"兜底标题(如 [Session]、[Tool call]、[Tool output])。"
|
|
90
93
|
"大小写敏感的 startswith 匹配,与 title_vendor_bindings 语义一致。"
|
|
91
94
|
"加载时会自动 strip + 去空 + 去重;空字符串前缀会被丢弃"
|
|
92
95
|
"(防空串 startswith 恒真导致全量误豁免)。"
|
coding/proxy/routing/executor.py
CHANGED
|
@@ -216,25 +216,45 @@ def _extract_session_title(
|
|
|
216
216
|
"""从规范化请求中提取 session 标题 — 多层级回退策略。
|
|
217
217
|
|
|
218
218
|
依次尝试: user TEXT 噪声剥离 → TOOL_RESULT 摘要 → IMAGE 计数 → 元数据兜底。
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
``exempt_prefixes``
|
|
222
|
-
|
|
219
|
+
任一层级产出候选且未被豁免即返回,确保 Dashboard 尽可能展示有辨识度的标题。
|
|
220
|
+
|
|
221
|
+
``exempt_prefixes`` 对所有层级统一生效:任一层产出的候选标题若以任一前缀
|
|
222
|
+
开头,则视为豁免、继续向下一层回退。Level 1 内部仍保留「逐条消息跳过」
|
|
223
|
+
语义(清洗后文本以豁免前缀开头则跳过该条、继续查找下一条 user TEXT);
|
|
224
|
+
本函数在编排层对每层最终候选再做一次 ``_is_exempt`` 拦截,使 Level 2/3/4
|
|
225
|
+
的合成标题(如 ``[Tool output]``、``[N Image(s)]``、``[Tool call]``、
|
|
226
|
+
``[Session]``)也能被用户显式豁免。全部层级均被豁免时返回空串,调用方
|
|
227
|
+
``if title:`` 据此跳过写库,session 标题保持空,待后续请求经
|
|
228
|
+
``update_empty_session_title`` 回填有意义标题。默认 ``None`` 时行为与历史一致。
|
|
223
229
|
"""
|
|
230
|
+
# 防御性过滤空串前缀:"" startswith 恒真会误豁免一切。入参虽经配置层与
|
|
231
|
+
# 构造器两层归一化,模块级直接调用(如测试)仍可能传入 [""],此处兜底。
|
|
232
|
+
prefixes = [p for p in (exempt_prefixes or []) if p]
|
|
233
|
+
|
|
234
|
+
def _is_exempt(candidate: str) -> bool:
|
|
235
|
+
"""候选标题是否命中任一豁免前缀(大小写敏感 startswith)。"""
|
|
236
|
+
return bool(prefixes) and any(candidate.startswith(p) for p in prefixes)
|
|
237
|
+
|
|
224
238
|
messages = request.messages
|
|
225
|
-
# Level 1
|
|
226
|
-
|
|
227
|
-
|
|
239
|
+
# Level 1: 内部已对每条 user TEXT 做豁免跳过;外层 _is_exempt 对其最终候选
|
|
240
|
+
# 再做一次拦截(正常路径下冗余,作为 _sanitize_user_text 一致性兜底)。
|
|
241
|
+
title = _extract_title_from_user_text(messages, exempt_prefixes=prefixes)
|
|
242
|
+
if title and not _is_exempt(title):
|
|
228
243
|
return title[:_SESSION_TITLE_MAX_LEN]
|
|
244
|
+
# Level 2 / Level 3: 候选为合成标题,统一经 _is_exempt 拦截后回退。
|
|
229
245
|
for extractor in (
|
|
230
246
|
_extract_title_from_tool_results,
|
|
231
247
|
_extract_title_from_images,
|
|
232
248
|
):
|
|
233
249
|
title = extractor(messages)
|
|
234
|
-
if title:
|
|
250
|
+
if title and not _is_exempt(title):
|
|
235
251
|
return title[:_SESSION_TITLE_MAX_LEN]
|
|
236
|
-
# Level 4
|
|
237
|
-
|
|
252
|
+
# Level 4: 签名不同(依赖 request 元数据)。被豁免则落到末尾返回空串,
|
|
253
|
+
# 使调用方 if title: 跳过写库、保留空标题待后续回填。
|
|
254
|
+
title = _extract_title_from_metadata(request)
|
|
255
|
+
if title and not _is_exempt(title):
|
|
256
|
+
return title[:_SESSION_TITLE_MAX_LEN]
|
|
257
|
+
return ""
|
|
238
258
|
|
|
239
259
|
|
|
240
260
|
def _build_semantic_rejection_diagnostic(body: dict[str, Any]) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coding-proxy
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2a3
|
|
4
4
|
Summary: A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM, MiniMax, Qwen, Xiaomi, Kimi, Doubao...
|
|
5
5
|
Project-URL: Source Code, https://github.com/ThreeFish-AI/coding-proxy
|
|
6
6
|
Project-URL: User Guide, https://github.com/ThreeFish-AI/coding-proxy/blob/master/docs/user-guide.md
|
|
@@ -17,13 +17,13 @@ coding/proxy/compat/canonical.py,sha256=-zcuEwZ402xeH3C545RmuYRkT2HDuvFloyFydDv8
|
|
|
17
17
|
coding/proxy/compat/session_store.py,sha256=B9IFjjQJnHMg1244m__jG9gnqGWi26-JyEtwopEri6Q,5244
|
|
18
18
|
coding/proxy/config/__init__.py,sha256=hzgU5noJGecjj13UY38cC_p6jpWO3GO7okSW-A2XkJ0,127
|
|
19
19
|
coding/proxy/config/auth_schema.py,sha256=LYrJQU_fgW-6AoQdjXt4-MgPJjXjv9HrghlCcZwotnA,696
|
|
20
|
-
coding/proxy/config/config.default.yaml,sha256=
|
|
20
|
+
coding/proxy/config/config.default.yaml,sha256=20cIVpZBfUvQeIFltXxQ7TlFSB2voZuYxha4iPX5tzk,23708
|
|
21
21
|
coding/proxy/config/loader.py,sha256=1J_RBJgjuC8RwB2mwewLMS7vy9WEhUqttZG2igeDm-w,8984
|
|
22
22
|
coding/proxy/config/resiliency.py,sha256=GnzY-LoyfFqXFM1l6xEru418v-cKlv97-HM0noGPdks,1308
|
|
23
23
|
coding/proxy/config/routing.py,sha256=MWTUq6QaYDmoXEARN9EBAptC6TSGK2yezNiaVk3kaXY,12196
|
|
24
24
|
coding/proxy/config/schema.py,sha256=q1mlpnSMoVneDqzCSBR88xCgKG6aVu11ikdbMzWM27I,13542
|
|
25
25
|
coding/proxy/config/server.py,sha256=4yY7i3WYOjtyZtZqHMtkjqHZ2W6D_ffEwVIfzxRar90,1002
|
|
26
|
-
coding/proxy/config/session_policy.py,sha256=
|
|
26
|
+
coding/proxy/config/session_policy.py,sha256=0aV6bXKAyS5CkiVH3z4sBNksghaioyOwk3Zql3Gu10k,4356
|
|
27
27
|
coding/proxy/config/vendors.py,sha256=9_Pgj9U6zOZVUV3UlA9P8BlKSDlj34g4p0lCy_bdimE,3472
|
|
28
28
|
coding/proxy/convert/__init__.py,sha256=0D3Q9TdY_AWCaMMf9f_i3jn0RIiWmqlcIAA79Ki8uJc,458
|
|
29
29
|
coding/proxy/convert/anthropic_to_gemini.py,sha256=9mRQ0CRAGJyWQADNlfMqoCJ_vY8ZZBGWaS_R8Vbe_l0,13201
|
|
@@ -56,7 +56,7 @@ coding/proxy/native_api/extractors/openai.py,sha256=bPdkcR_2g7zb-F8P7CGumVqv_chR
|
|
|
56
56
|
coding/proxy/routing/__init__.py,sha256=2Tpc6MQ5Oy_w-YlEWQVDSgcSgiHp3OwKOABIjj5kfHA,1595
|
|
57
57
|
coding/proxy/routing/circuit_breaker.py,sha256=hOyoY_RWB5dTVbipyuiWfAelnva3cZRLbXrSmSn8KTs,8096
|
|
58
58
|
coding/proxy/routing/error_classifier.py,sha256=SoJsExbfzduBOC04tKv9RdQqkzA-tQxbPapU5duNJqA,4204
|
|
59
|
-
coding/proxy/routing/executor.py,sha256=
|
|
59
|
+
coding/proxy/routing/executor.py,sha256=PCj4yvMccGZu99ZrOjJ1aeiAmapeYUBVBCqG0ZmKCt0,60473
|
|
60
60
|
coding/proxy/routing/model_mapper.py,sha256=yc5PW7c9x6wfs7wGdbm-G5pFwg-kPTim6A2mKZ3sQgc,2803
|
|
61
61
|
coding/proxy/routing/quota_guard.py,sha256=uoQSr2siv6aIBVylvXG_PsfdpY_i4QJxc-WHz4MGDa4,7791
|
|
62
62
|
coding/proxy/routing/rate_limit.py,sha256=i2cCqtbmXrP6wjRUTWXLP4DdYwVj0C4o59QdYGkPQj0,5122
|
|
@@ -93,8 +93,8 @@ coding/proxy/vendors/native_anthropic.py,sha256=SxtM71PDci0gqLqiwCrFnT410SnSoD7F
|
|
|
93
93
|
coding/proxy/vendors/token_manager.py,sha256=s10t4Com0jNnKGkPyJ_HpG5SjHrCEJvfArEOAaPKA_k,4189
|
|
94
94
|
coding/proxy/vendors/xiaomi.py,sha256=E-GcmJBZh7GOtDFonxZmlf0hKRhrlrXzL0IxHFRYcRo,860
|
|
95
95
|
coding/proxy/vendors/zhipu.py,sha256=GaLaWssa4c1lcukQL4nOtzji8jxEUJFrZtFgOkXTKaM,11127
|
|
96
|
-
coding_proxy-0.5.
|
|
97
|
-
coding_proxy-0.5.
|
|
98
|
-
coding_proxy-0.5.
|
|
99
|
-
coding_proxy-0.5.
|
|
100
|
-
coding_proxy-0.5.
|
|
96
|
+
coding_proxy-0.5.2a3.dist-info/METADATA,sha256=AQWHMsoXar2_gP8DdsaNVnJNS31RpuK6TNtNxVNdXR4,11346
|
|
97
|
+
coding_proxy-0.5.2a3.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
98
|
+
coding_proxy-0.5.2a3.dist-info/entry_points.txt,sha256=moIVzt5ho0Wk9B47LOo2SEAbhzuDDHWi-EfM30U0XBg,54
|
|
99
|
+
coding_proxy-0.5.2a3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
100
|
+
coding_proxy-0.5.2a3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|