fix(eval): 根除 prompt eval 对 @vesti/ui 的非 UI 运行时依赖#81
Merged
abraxas914 merged 2 commits intomainfrom Mar 28, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
当前
pnpm -C frontend eval:prompts --mode=mock --strict会在.tmp/eval运行路径下失败,根因不是 prompt 逻辑本身,而是frontend的非 UI 文本链路在运行时依赖了@vesti/ui。具体表现为:
messageContentPackage.ts、prompt/export 等非 UI helper 直接从@vesti/ui引纯文本 helper.tmp/eval后,以 Node/CJS 从 repo 根附近运行.tmp/eval无法解析到frontend/node_modules/@vesti/uiprompt-schema-drift-pr / eval-mock-strict因此失败这本质上是一层架构债:非 UI 业务文本链路反向依赖 UI 包。
本次修复
1. 引入非 UI shared 包
@vesti/content-packagepackages/vesti-content-packageformatArtifactDescriptorgetArtifactExcerptLinesgetArtifactExcerptTextbuildMessageSidecarSummaryLinesbuildMessagePreviewTextbuildMessageFallbackDisplayText.tmp/eval的 Node 运行时2. 切断 frontend 非 UI 链路对
@vesti/ui的运行时依赖frontend/src/lib/utils/messageContentPackage.ts保留 AST canonical body 决策@vesti/content-package3. 保留
@vesti/ui的兼容导出@vesti/ui继续保留原 helper 导出名@vesti/content-package4. 补齐护栏与 CI
scripts/check-frontend-ui-boundary.mjsfrontend/src/lib/{prompts,services,utils}直接 import@vesti/uiprompt-schema-drift-pr改为先安装 workspace 依赖,再跑边界检查和eval:promptsdocuments/prompt_engineering/README.md增补 content-package helper 归属说明非目标
attachments[] / citations[] / artifacts[]契约NODE_PATH、shim、向.tmp/eval塞node_modules之类的症状修补验证
已通过:
pnpm -C frontend eval:prompts --mode=mock --strictfrontend\\node_modules\\.bin\\tsc.cmd -p frontend\\tsconfig.json --noEmitpnpm -C packages/vesti-ui buildpnpm -C frontend buildpnpm -C vesti-web build风险与回滚
主要风险在于:content-package 文本 helper 被抽离后,frontend 与
@vesti/ui的文本输出如果发生轻微漂移,会影响 prompt / export / snippet 的一致性。当前通过共享实现已把这类漂移压到最低;如果需要回滚,也可以先回到原来的本地 helper 路径,但不建议再恢复
frontend非 UI 链路直连@vesti/ui的结构。