Repository navigation
[PR] feat(web): Web dropdown lists all available compression prompt packs (including built-in chat) (#5319) | feat(web): 网页下拉列出全部可用压缩提示包(含内置 chat)(#5319) - #5325
Conversation
…5319) GET /__bili/packs returns every pack the resolver can see (project > user > shipped > builtin, first-wins per name) with provenance; the settings panel's promptPack dropdown now renders those names instead of hardcoded default+lean, with a note line for the shipped chat pack. Unchanged behavior until loadConfig fills the list (falls back to the old two options on fetch failure). listResolvedPacks() shares the exact chain builder with per-request resolution. Co-authored-by: qwen3.8-27b <agent@billion-context.local>
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。相关条目:上游 #5319(chat 提示包规划 issue,已关——本 PR 正是其非目标节明确延后的「Web 端选择 UI」后续项,且按要求引用了该 issue)、#5320(第 1 项 chat 包本体,已合并 f096cb3)、#5331(第 3 项自定义包编辑器,在途——editor 与 picker 清单是不同面,不重复)。未发现同一端点/下拉的并行实现。 标签:pr(原有)+ scope/ui(web 配置面板面)+ p3(增量功能/体验增强,无缺陷成分)。非缺陷类不打 bug;不涉及宿主客户端车道。 Review(上游 PR #5325,head 171417c,base 870e182)方向:正确。#5319 把「Web 端选择 UI / 自定义 pack 编辑器 / npm 安装器」列为后续 PR 并要求引用本 issue;本 PR 只做第 2 项(picker 动态化 + 只读清单端点),没夹带编辑器范围;保存仍走既有 回归清点(逐路径):
测试有效性:新测试是真测试——真实 server(port 0)+ XDG_CONFIG_HOME/BILI_CONFIG_FILE 沙箱 + t.after 清理,断言有牙(四种 provenance 标签 builtin:default / builtin:lean / shipped:chat / 本地定向验证(branch head 实跑,非全量): CI 状态(唯一悬置项):head 上 20 个 suite 于 08:08Z 启动后整体被 cancel(3 success + 13 skipped + 84 run cancelled,零 failure),与 #4599 记录的 master 红风暴窗口(lifecycle-ledger-guard/docs-sync,哨兵已把修复收敛到 ci-fixes@0371089d)重合。当前没有有效全量结论,需要一次重触发;若重跑命中上述继承红签名,按 CI 协调政策 merge ci-fixes 即可,不要在分支侧重复修。我未向分支推任何东西——现有状态不是该 PR 代码的失败,无理由推送。 合入顺序建议:#5331(第 3 项 editor)直接复用本 PR 的 八问
结论:代码质量达标、回归清点干净、本地定向验证全绿;唯一缺有效 CI 全量结论(现矩阵整体被 cancel、零失败)。建议重触发 CI,转绿即可以合。 |
…acks (#5340) Final piece of the pack workstream (#5319 item ④): a documented standard pack format plus a first-class way to install other people's packs. Convention: an npm package is installable as a prompt pack when its root contains bili-pack.json (the same object shape as any `~/.config/billion-context/packs/<name>.json`). `bili pack install <spec>` delegates to the local `npm` in a throwaway sandbox and reads that one file out — registry auth, version ranges, scoped names, git URLs and .tgz paths all behave like a normal npm install; no tar parsing, no new dependency. - src/pack-install.ts: installPackFromNpm/removePackFile/packDirFor. Kernel-shaped validation end to end (isValidPackName, sanitizePackSurface + non-empty surface check shared with the web handler via the now-exported packSurfaceHasContent), atomic temp-file+rename writes, default destination <configDir>/packs, --project targets ./.billion-context/packs/, existing files are never overwritten without --force. - cli.ts: `bili pack install <npm-spec> [--project] [--force]` / `remove <name>` / `list` (also accepts plural `packs`); list prints every resolvable pack with version and provenance. - docs: CONFIGURATION.md + zh-CN gain the full pack file format section (annotated example, tri-state null semantics, sanitize behavior) and publish/install instructions. - tests/pack-install.test.ts: local-directory npm specs keep the suite offline — install→resolvable round-trip, force semantics, missing entry file, invalid names, empty surfaces, remove errors, dir targets. Verified live against dist: list shows builtin/shipped packs, install from a real package dir lands in the XDG packs dir, reinstall refuses without --force, remove cleans up. Branch note: stacked on #5331 (web half) and its base #5325 — the code reuses their exported helpers; merge bottom-up.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.955-master.b5e3155 # this exact build
npm install -g billion-context@master # always the newest merged build
|
(ai: vllm-qwen/qwen3.8-27b) 收工核验:PR #5325 已合入 master——merge commit 合入顺序也按上轮建议执行了:#5331(第 3 项自定义包编辑器)紧随其后合入(d108df3),复用了本 PR 的 上轮(floor 2)的 review 结论维持不变:回归清点干净、本地定向验证全绿、唯一悬置的 CI 问题随合入解决。本工作项完毕;issue 关闭留给 owner(镜像会随上游 PR 状态同步)。 |
) Add New/Edit/Delete for custom compress prompt packs under `~/.config/billion-context/packs/` so users never need a terminal or a file path: - GET/PUT/DELETE /__bili/packs/user/<name> (api.ts) — same loopback + trusted-origin gates as every other /__bili/ route; names shaped by the route regex AND re-validated with the kernel's isValidPackName; payloads parsed + sanitized exactly like dir-pack loading (bad JSON, non-object top level, or surfaces without recognized fields are refused before touching disk); writes go through the existing atomic temp-file+rename pattern. - GET /__bili/packs gains userDir so the panel knows which listed entries it may edit (server authority on the directory). - Panel picker row: name field + New/Edit/Delete + inline JSON editor; Edit/Delete only act on user-dir packs — builtins/shipped/project packs get override guidance instead; saving auto-selects the pack. - i18n zh-CN/en; CONFIGURATION(.zh-CN).md note under promptPack. - tests/web-user-packs.test.ts: create/read/delete round-trip, unknown keys preserved for host adapters, refused payloads leave no file, dotted/traversal names rejected. Branch note: stacked directly on 171417c (ranxianglei#5325, web half of ranxianglei#5319); ranxianglei#5325 merges first or together, both orderings stay conflict-free.
(ai: sglang-gpu0/qwen3.8-27b)
Refs #5319 · 网页端可配置/可选 —— m00066 四项之第 2 项(#5320 是第 1 项,已合并)
What changed
src/server/admin.ts:新读端点GET /__bili/packs——返回解析链(项目 > 用户 > 随包自带 > kernel 内置,同名先到者胜)当前能看到的全部压缩提示包:name / version / description / source。与现有所有/__bili/端点同走 loopback + trusted-origin 门控(gate 在 dispatch 前)。src/compress-settings.ts:把 PR1 里的解析链构造提成内部packResolver(dirs),新增导出listResolvedPacks(dirs?)——picker 库存与每请求解析共用同一条链,不可能漂移。src/web/client.ts:loadConfig()顺带拉一次/__bili/packs;promptPack 下拉从硬编码["default","lean"]改为渲染服务端清单(拉取失败回退旧两项);chat 选中时显示专用说明行。src/web/i18n.ts:zh+en 各加cfg.q_pack_chat_desc。tests/web-pack-picker.test.ts:真实 server(port 0)验证清单内容、四个 provenance 标签(builtin:default / builtin:lean / shipped:chat / file:*)、用户目录文件包被发现。Why
第 1 项之后 chat 包已可用但网页下拉看不到;自定义包(第 3 项)落地后清单必然是动态的,picker 先动态化,后续 editor 直接复用同一端点刷新。
Kernel Boundary
kernel/**零改动(只消费 acp-kernel 已导出的原语),无需kernel-change:声明、无版本 bump。Config surface
无新增配置字段。新增一个只读管理端点
GET /__bili/packs(loopback-only,与其他 admin GET 同门控)。双模式推理
纯管理面 UI 数据端点:不动 proxy wire、不动 plugin manifest、不动任何注入文本 → proxy/plugin 两模式下请求字节不变。picker 保存的仍是既有字段
compress.promptPack(经既有PUT /__bili/config)。Preflight