Repository navigation
feat: named provider entries bind onto their URL lanes - #1466
ranxianglei wants to merge 2 commits into
Conversation
providers keys can now be provider NAMES, not just URL prefixes. Under
bili <client> launches the launcher already discovers each client's own
name→upstream-URL pairs (the same sources BILI_PROVIDER_REWRITES is built
from); it now hands them to the spawned proxy via BILI_LAUNCHER_NAME_ROUTES
and loadRoutes flattens each name-keyed entry onto its URL lane:
providers: {
"https://api.openai.com": { compress: { ... } },
"main": { compress: { absorb: { enabled: true } } } // = same upstream
}
- Explicit URL-keyed entry wins every conflict; the named entry fills gaps
(deep merge over compress / models / scalar fields).
- Per-model entries merge per model, URL side winning.
- Targets normalized to origin form (protocol//host) like hand-written URL
keys; non-http(s) targets and unmapped names stay inert — without a
launcher mapping (plain bili start) a named entry carries only
agent-side fields such as compactionOptIn (#1392).
- Zero wire changes: three-level compress (global → provider → model)
resolves through the existing machinery once the lane exists.
[bot] 🏷 Review 结论:可以合并(需先合 #1437,stacked base)。中文摘要:实现了 providers 表按 provider 名字绑定 URL 车道(#1465 owner 拍板方案),零 wire 变更,回归面逐项核对无破坏,本地 typecheck/全量测试/build 全绿,CI 五个真实客户端 e2e lane 全绿。 ① 原 issue 方向(#1465)Owner directive 明确要求「名字映射为 agents 里面的配置, 最终还是 url」,PR 精确实现:name-keyed entry 经 launcher 发现的 name→URL 映射( ② 回归审查(既有行为清单)
行为变更披露(Deliverables #4):旧行为 = name-keyed providers 条目对路由完全惰性(仅承载 compactionOptIn);新行为 = 在 ③ 代码审查解析防御到位(坏 JSON/空串/数组/非 string value 全丢弃,不抛错);
④ 测试有效性7 个测试断言有牙(精确值 deepEqual/equal),含一个真 e2e:临时 config file(BILI_CONFIG_FILE)→ ⑤ diff 整洁度单 commit,5 文件,+227/-7,全部与本 PR 目的相关;无空白重排、无 lockfile/version 变动、无生成物。干净。 门本地(PR head 57def46):typecheck ✓ · build ✓ · 全量测试 2893 tests / 2881 pass / 0 fail / 12 skipped ✓ 注意:base 是 |
|
Closed without merging per owner decision: land this in one shot, not staged — the full design (bind aliasing + inertness guard + launcher wiring + acceptance criteria) is preserved in #1469, including everything explored on this branch (head |
Fixes #1465. Stacked on #1437 (the providers-table compactionOptIn shape).
What
providerskeys may be provider names (any non-URL string). Underbili <client>launches the launcher hands the spawned proxy a name→URL map (BILI_LAUNCHER_NAME_ROUTES, discovered from the client's own config — the same pairsBILI_PROVIDER_REWRITESis built from), andloadRoutesflattens each name-keyed entry onto its URL lane:Where
src/config.ts:NAME_ROUTES_ENV/parseLauncherNameRoutes/flattenNamedRoutes/deepMergeRoute;loadRoutesapplies flattening.src/launcher.ts:collectNameRoutes(discovered)(http+https rewrite lanes → origin pairs),nameRoutesspawn opt → child env, wired at bothensureProxyRunningcall sites.tests/named-provider-routes.test.ts: 7 tests (parse/flatten precedence/gap-fill/per-model/inert cases/loadRoutes e2e throughresolveCompress/collector).Gates: typecheck ✓ · targeted suites 238+7+36+7 pass, 0 fail · build ✓.
Non-goal (documented in #1465): URL-less providers (claude-bridge) need a manifest settings channel for three-level support — deferred.