fix(core,playground): 规划阶段校验 actionSpace、报告模板注入兜底、Playground 默认本机监听#2520
Open
FinnJov wants to merge 4 commits into
Open
fix(core,playground): 规划阶段校验 actionSpace、报告模板注入兜底、Playground 默认本机监听#2520FinnJov wants to merge 4 commits into
FinnJov wants to merge 4 commits into
Conversation
added 4 commits
May 22, 2026 13:57
Add assertPlannedActionInActionSpace and use it in llm-planning and buildYamlFlowFromPlans so invalid action types throw during planning instead of after extra LLM rounds or at TaskBuilder execution.
…s placeholder Keep warn-and-skip when apps/report/dist is missing (core builds before report in the monorepo graph). Throw only if index.html is present yet dist still contains REPLACE_ME_WITH_REPORT_HTML after injection.
Listen on localhost unless MIDSCENE_PLAYGROUND_ALLOW_REMOTE=1 or MIDSCENE_PLAYGROUND_HOST is set, reducing accidental LAN exposure of unauthenticated /execute APIs.
Replace rm -rf clean with scripts/clean.mjs for Windows. Add .env.example (unignored via !.env.example) with MIDSCENE_MODEL_* and playground env hints.
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.
概述
本 PR 包含 4 个相互独立的修复(本地代码审计结论),每个 commit 一个 scope,便于分开 review。
1.
fix(core)— 规划阶段校验 actionSpaceassertPlannedActionInActionSpace,并在llm-planning、buildYamlFlowFromPlans中使用。buildYamlFlowFromPlans仅console.warn并跳过;要到TaskBuilder执行阶段才失败,且可能多消耗规划轮次。actionSpace内可用 action。llm-planning.test.ts增加单测。2.
fix(core)— 报告 HTML 模板注入apps/report/dist/index.html不存在:保持原有 warn 并跳过注入(monorepo 中@midscene/report依赖@midscene/core,须先 build core,不能在此处 hard fail)。dist仍含REPLACE_ME_WITH_REPORT_HTML:构建失败并给出明确错误,避免把坏报告打进产物。dependsOn(会与 report → core 形成循环构建依赖)。3.
fix(playground)— 默认监听地址0.0.0.0改为127.0.0.1,降低局域网误暴露未鉴权/execute等接口的风险。MIDSCENE_PLAYGROUND_ALLOW_REMOTE=1→ 监听0.0.0.0MIDSCENE_PLAYGROUND_HOST=<host>→ 自定义绑定地址apps/site/docs站点文档;变量说明见根目录.env.example。如需中英文站点补充,可另开 doc PR。4.
chore(workflow)— Windows 开发体验clean由rm -rf改为跨平台scripts/clean.mjs。.env.example(.gitignore中增加!.env.example),列出MIDSCENE_MODEL_*与 Playground 相关 env。测试说明
npx biome check(7 个文件,无问题)packages/core下pnpm exec vitest run tests/unit-test/llm-planning.test.ts(53 passed)pnpm run build(建议 merge 前跑全量构建)npx nx test @midscene/core(可选;Windows 上部分超时用例与本次改动无关)给 Reviewer 的说明
buildYamlFlowFromPlans对未知 action 由「warn 并跳过」改为 抛错(与TaskBuilder行为一致)。.env.example中说明,未改文档站,有意控制 PR 体积。