coding-proxy 0.5.2a5__py3-none-any.whl → 0.5.2a6__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,86 +11,73 @@ from fastapi.responses import HTMLResponse, Response
11
11
 
12
12
  from ..logging.db import TimePeriod
13
13
 
14
- # ── 品牌图标:Tabler terminal-2 核心笔划(> 与 _),不含外框 ──────────────
15
- # 容器为「淡色磨砂卡片」(#f5f6fb 浅底 + 品牌紫描边环),> 与 _ 笔划改用品牌渐变
16
- # (#667eea -> #764ba2)——色彩反转:品牌紫由背景迁移至图标笔划,轮廓成为视觉主角,
17
- # 更简约、小尺寸下更清晰(Linear/Vercel 风)。保留 Tabler 原始外框笔划会双重描边、
18
- # 边缘发糊,故仅取 > 与 _ 两条。
19
- # 单一事实源:_TERMINAL2_PATHS 与 _LOGO_DEFS 同时供 favicon SVG(f-string)与页面
20
- # logo({{TERMINAL2}} / {{LOGO_DEFS}} 模板替换)消费。
21
- _BRAND_FROM, _BRAND_TO = "#667eea", "#764ba2"
14
+ # ── 品牌图标:Tabler prompt 核心笔划(> 与 _)+ 通透青绿圆环 ──────────────
15
+ # 设计(方案 d05):全透明底 + 青绿渐变细圆环(stroke 0.5,仅原 1/3,通透若隐)+
16
+ # 饱和青绿渐变 >_ 笔划(stroke 2.5)。极细环与饱和笔划形成权重对比,>_ 为绝对主角;
17
+ # 青绿(#22d3ee -> #2dd4bf)承载终端/代码语义,通透明快。基础笔划取自 Tabler prompt
18
+ # (chevron M5 7l5 5l-5 5 + 下划线 M13 17l6 0,下划线长 6 单位、不会小尺寸点化)。
19
+ # 渐变用 gradientUnits="userSpaceOnUse" + 绝对坐标:纯水平下划线包围盒高度为 0,若用
20
+ # 默认 objectBoundingBox 渐变会映射失效而不着色(下划线消失),userSpaceOnUse 规避。
21
+ # 单一事实源:_PROMPT_PATHS 与 _LOGO_DEFS 同时供 favicon SVG(f-string)与页面
22
+ # logo({{PROMPT}} / {{LOGO_DEFS}} 模板替换)消费。
23
+ _BRAND_FROM, _BRAND_TO = "#22d3ee", "#2dd4bf"
22
24
  _LOGO_DEFS = (
23
- '<defs><linearGradient id="cpBrand" x1="0" y1="0" x2="1" y2="1">'
25
+ '<defs><linearGradient id="cpBrand" gradientUnits="userSpaceOnUse" '
26
+ 'x1="4" y1="4" x2="20" y2="20">'
24
27
  f'<stop offset="0" stop-color="{_BRAND_FROM}"/>'
25
28
  f'<stop offset="1" stop-color="{_BRAND_TO}"/>'
26
29
  "</linearGradient></defs>"
27
30
  )
28
- _TERMINAL2_PATHS = '<path d="M8 9l3 3l-3 3" /><path d="M13 15l3 0" />'
31
+ _PROMPT_PATHS = '<path d="M5 7l5 5l-5 5" /><path d="M13 17l6 0" />'
29
32
 
30
33
 
31
34
  # ── Favicon (SVG, 现代浏览器主选) ──────────────────────────────────────────
32
35
  def _build_favicon_svg() -> str:
33
- """生成 24×24 SVG favicon:淡色磨砂卡片 + 品牌渐变 terminal-2 笔划.
36
+ """生成 24×24 SVG favicon:通透青绿圆环 + 品牌渐变 prompt 笔划(方案 d05).
34
37
 
35
- 容器为 ``#f5f6fb`` 浅底圆角方块 + 品牌紫描边环;``>`` 与 ``_`` 笔划由白色改为品牌
36
- 渐变(``url(#cpBrand)``),使图标轮廓成为主角。独立 SVG 文档无 CSS 上下文,
37
- ``currentColor`` 不可靠,故颜色硬编码;``<defs>`` 复用 ``_LOGO_DEFS`` 单一事实源。
38
+ 全透明底 + 青绿渐变细圆环(``r=11``、``stroke-width=0.5``、``stroke-opacity=.55``,
39
+ 通透若隐)+ 饱和青绿渐变 ``>`` 与 ``_`` 笔划(``stroke-width=2.5``)。极细环与饱和
40
+ 笔划形成权重对比,``>_`` 为视觉主角。独立 SVG 文档无 CSS 上下文,``currentColor``
41
+ 不可靠,故渐变复用 ``_LOGO_DEFS``(userSpaceOnUse,规避水平下划线不着色)单一事实源。
38
42
  """
39
43
  return (
40
44
  '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">'
41
45
  f"{_LOGO_DEFS}"
42
- '<rect x="1" y="1" width="22" height="22" rx="6" fill="#f5f6fb" '
43
- 'stroke="#667eea" stroke-opacity=".18" stroke-width="1"/>'
44
- f'<g fill="none" stroke="url(#cpBrand)" stroke-width="2" '
45
- f'stroke-linecap="round" stroke-linejoin="round">{_TERMINAL2_PATHS}</g>'
46
+ '<circle cx="12" cy="12" r="11" fill="none" stroke="url(#cpBrand)" '
47
+ 'stroke-width="0.5" stroke-opacity=".55"/>'
48
+ f'<g fill="none" stroke="url(#cpBrand)" stroke-width="2.5" '
49
+ f'stroke-linecap="round" stroke-linejoin="round">{_PROMPT_PATHS}</g>'
46
50
  "</svg>"
47
51
  )
48
52
 
49
53
 
50
54
  # ── Favicon (ICO, 32×32 光栅回退) ─────────────────────────────────────────
51
55
  def _build_favicon() -> bytes:
52
- """程序化生成 32×32 ICO:淡色磨砂卡片 + 品牌渐变 terminal-2 笔划(旧浏览器/Safari 回退).
56
+ """程序化生成 32×32 ICO:全透明底 + 青绿渐变 prompt 笔划(旧浏览器/Safari 回退).
53
57
 
54
- 项目无 Pillow/cairosvg 等图像库,故以纯 Python 按像素光栅化:``#f5f6fb`` 浅底圆角
55
- 方块 + 品牌渐变(#667eea -> #764ba2)``>`` 折线与 ``_`` 下划线。沿用原实现「全零
56
- AND-mask + per-pixel alpha」的圆角透明方案(现代渲染器按 alpha 通道处理透明)。
57
- 32px 下细描边环易锯齿,故 ICO 仅保留浅底 + 渐变笔划,精修外观由 SVG 承载。
58
+ 项目无 Pillow/cairosvg 等图像库,故以纯 Python 按像素光栅化:全透明底 + 青绿渐变
59
+ (#22d3ee -> #2dd4bf)``>`` 折线与 ``_`` 下划线。沿用「全零 AND-mask + per-pixel
60
+ alpha」透明方案(现代渲染器按 alpha 通道处理透明)。方案 d05 的细圆环(0.5px)在
61
+ 32px 下不足 1 像素、无法渲染,故 ICO 省略圆环、仅保留饱和 ``>_`` 笔划(符合「图标
62
+ 为主角、环极弱」的设计意图),完整外观由 SVG 主版承载。
58
63
  """
59
64
  import math
60
65
  import struct
61
66
 
62
67
  width = height = 32
63
- radius = 8
64
68
  scale = width / 24.0 # SVG 24 单位 -> 像素
65
69
 
66
- # 图标笔划品牌渐变:#667eea -> #764ba2(与 _LOGO_DEFS 同源)
67
- r0, g0, b0 = 0x66, 0x7E, 0xEA
68
- r1, g1, b1 = 0x76, 0x4B, 0xA2
69
- # 容器底色:#f5f6fb(近白、极浅冷蓝紫)
70
- tile_r, tile_g, tile_b = 0xF5, 0xF6, 0xFB
71
-
72
- def inside(x: int, y: int) -> bool:
73
- """满铺圆角方块(四角半径 radius)包含判定."""
74
- cx = min(x, width - 1 - x)
75
- cy = min(y, height - 1 - y)
76
- if cx >= radius or cy >= radius:
77
- return True
78
- return (radius - cx) ** 2 + (radius - cy) ** 2 <= radius * radius
79
-
80
- # 像素缓冲:[B, G, R, A],默认全透明
70
+ # 图标笔划青绿渐变:#22d3ee -> #2dd4bf(与 _LOGO_DEFS 同源)
71
+ r0, g0, b0 = 0x22, 0xD3, 0xEE
72
+ r1, g1, b1 = 0x2D, 0xD4, 0xBF
73
+
74
+ # 像素缓冲:[B, G, R, A],默认全透明(全透底,无容器填充)
81
75
  buf: list[list[list[int]]] = [
82
76
  [[0, 0, 0, 0] for _ in range(width)] for _ in range(height)
83
77
  ]
84
78
 
85
- # 1) 浅底圆角背景(扁平 #f5f6fb)
86
- for y in range(height):
87
- for x in range(width):
88
- if not inside(x, y):
89
- continue
90
- buf[y][x] = [tile_b, tile_g, tile_r, 255]
91
-
92
79
  def brand_at(px: float, py: float) -> tuple[int, int, int]:
93
- """按对角参数 t 返回 (px,py) 处的品牌渐变 RGB(与 SVG url(#cpBrand) 同向)."""
80
+ """按对角参数 t 返回 (px,py) 处的青绿渐变 RGB(与 SVG url(#cpBrand) 同向)."""
94
81
  t = (px + py) / (width + height - 2)
95
82
  return (
96
83
  int(r0 + (r1 - r0) * t),
@@ -99,7 +86,7 @@ def _build_favicon() -> bytes:
99
86
  )
100
87
 
101
88
  def stamp(px: float, py: float) -> None:
102
- """以 (px, py) 为中心盖 ~3px 品牌渐变方块(笔划加粗,保证小尺寸可辨识)."""
89
+ """以 (px, py) 为中心盖 ~3px 青绿渐变方块(笔划加粗,保证小尺寸可辨识)."""
103
90
  ix, iy = int(round(px)), int(round(py))
104
91
  cr, cg, cb = brand_at(px, py)
105
92
  for oy in (-1, 0, 1):
@@ -109,18 +96,18 @@ def _build_favicon() -> bytes:
109
96
  buf[ny][nx] = [cb, cg, cr, 255]
110
97
 
111
98
  def line(x0: float, y0: float, x1: float, y1: float) -> None:
112
- """稠密采样 + stamp 形成品牌渐变粗线段."""
99
+ """稠密采样 + stamp 形成青绿渐变粗线段."""
113
100
  dist = math.hypot(x1 - x0, y1 - y0)
114
101
  steps = max(1, int(dist * 3))
115
102
  for i in range(steps + 1):
116
103
  s = i / steps
117
104
  stamp(x0 + (x1 - x0) * s, y0 + (y1 - y0) * s)
118
105
 
119
- # 2) terminal-2 笔划(SVG 24 单位 -> 像素)
120
- # > 折线 (8,9)->(11,12)->(8,15);_ 下划线 (13,15)->(16,15)
121
- line(8 * scale, 9 * scale, 11 * scale, 12 * scale)
122
- line(11 * scale, 12 * scale, 8 * scale, 15 * scale)
123
- line(13 * scale, 15 * scale, 16 * scale, 15 * scale)
106
+ # prompt 笔划(SVG 24 单位 -> 像素)
107
+ # > 折线 (5,7)->(10,12)->(5,17);_ 下划线 (13,17)->(19,17)
108
+ line(5 * scale, 7 * scale, 10 * scale, 12 * scale)
109
+ line(10 * scale, 12 * scale, 5 * scale, 17 * scale)
110
+ line(13 * scale, 17 * scale, 19 * scale, 17 * scale)
124
111
 
125
112
  # 3) 打包 ICO(BMP bottom-up;全零 AND-mask,信任 per-pixel alpha 实现圆角透明)
126
113
  pixel_rows: list[bytes] = []
@@ -222,13 +209,9 @@ _DASHBOARD_HTML = """<!DOCTYPE html>
222
209
  .header-left { display: flex; align-items: center; gap: 12px; }
223
210
  .logo {
224
211
  width: 32px; height: 32px;
225
- background: #f5f6fb;
226
- border: 1px solid rgba(102,126,234,.18);
227
- border-radius: 10px;
228
212
  display: flex; align-items: center; justify-content: center;
229
- box-shadow: 0 4px 12px rgba(102,126,234,.18);
230
213
  }
231
- .logo svg { width: 20px; height: 20px; display: block; }
214
+ .logo svg { width: 28px; height: 28px; display: block; filter: drop-shadow(0 0 3px rgba(45,212,191,.3)); }
232
215
  h1 { font-size: 18px; font-weight: 600; color: var(--text-primary); letter-spacing: -.3px; }
233
216
  .header-right { display: flex; align-items: center; gap: 12px; }
234
217
  .badge {
@@ -815,7 +798,7 @@ _DASHBOARD_HTML = """<!DOCTYPE html>
815
798
  <body>
816
799
  <header>
817
800
  <div class="header-left">
818
- <div class="logo"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="url(#cpBrand)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">{{LOGO_DEFS}}{{TERMINAL2}}</svg></div>
801
+ <div class="logo"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="url(#cpBrand)" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">{{LOGO_DEFS}}<circle cx="12" cy="12" r="11" fill="none" stroke="url(#cpBrand)" stroke-width="0.5" stroke-opacity=".55"/><g>{{PROMPT}}</g></svg></div>
819
802
  <h1>Coding Proxy Dashboard</h1>
820
803
  <span class="badge" id="version-badge">v-.-.-</span>
821
804
  </div>
@@ -2385,7 +2368,7 @@ function switchTab(name) {
2385
2368
  </script>
2386
2369
  </body>
2387
2370
  </html>
2388
- """.replace("{{TERMINAL2}}", _TERMINAL2_PATHS).replace("{{LOGO_DEFS}}", _LOGO_DEFS)
2371
+ """.replace("{{PROMPT}}", _PROMPT_PATHS).replace("{{LOGO_DEFS}}", _LOGO_DEFS)
2389
2372
 
2390
2373
 
2391
2374
  # ── 数据计算工具 ──────────────────────────────────────────────────────────
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coding-proxy
3
- Version: 0.5.2a5
3
+ Version: 0.5.2a6
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
@@ -69,7 +69,7 @@ coding/proxy/routing/usage_parser.py,sha256=ZwPuMGtXAwdIOKrXLpdtA4nCmc83ViF6kw5J
69
69
  coding/proxy/routing/usage_recorder.py,sha256=PHUHotCt3VaKkdJizMpPGsUOAj-f5qz9JKeiLEnFNgA,8779
70
70
  coding/proxy/server/__init__.py,sha256=KeH7mEu36v9v27m3VgeSxSeFz9sLTJrxS_EVATJ7Vks,20
71
71
  coding/proxy/server/app.py,sha256=3MYE8-Vsxpt1SVqTKReMKNREBsh_LHKIFq1B4jhfeL8,7121
72
- coding/proxy/server/dashboard.py,sha256=Mm6Gh2WtHHdL7HPnDZwKWUHwY7mZBa0w3AG-R-NJsUE,104937
72
+ coding/proxy/server/dashboard.py,sha256=dSX7nm-FJAN6JjjKXnuNxa7W9lDorekQX0Grv2SXRZ4,104808
73
73
  coding/proxy/server/factory.py,sha256=L0d0AA0fpkV-gynM85u1l5dXY1OQ5A_p_-PV0XlFGQs,10272
74
74
  coding/proxy/server/responses.py,sha256=i0ugnLRNOdRYGHEWxkwsxR35ChmdMQsSaD8AjRluTn4,2167
75
75
  coding/proxy/server/routes.py,sha256=5f9ONVckM3LG2AftBW6YahelhjkP6XlgaYSH7MvXUp4,22362
@@ -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.2a5.dist-info/METADATA,sha256=TKQ7eSzT2YftZSCzbcnPv5WV-oLcqkjQwwkZPtMLAd8,11346
97
- coding_proxy-0.5.2a5.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
98
- coding_proxy-0.5.2a5.dist-info/entry_points.txt,sha256=moIVzt5ho0Wk9B47LOo2SEAbhzuDDHWi-EfM30U0XBg,54
99
- coding_proxy-0.5.2a5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
100
- coding_proxy-0.5.2a5.dist-info/RECORD,,
96
+ coding_proxy-0.5.2a6.dist-info/METADATA,sha256=nRowr8Fpf-4yMO2bNsrLZA0SMozGiU9CVBI6IFZyxPY,11346
97
+ coding_proxy-0.5.2a6.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
98
+ coding_proxy-0.5.2a6.dist-info/entry_points.txt,sha256=moIVzt5ho0Wk9B47LOo2SEAbhzuDDHWi-EfM30U0XBg,54
99
+ coding_proxy-0.5.2a6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
100
+ coding_proxy-0.5.2a6.dist-info/RECORD,,