fix: require write_file for WeChat immediate-context page requests
Memind CI / Test, build, and release guards (push) Failing after 12m9s

Skip fresh thumbnail forcing and retry in-session when load_skill completes without HTML落盘, so「把刚才的诗做成页面」can deliver the prior poem as a static page.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-28 15:27:23 +08:00
parent e1ad094f93
commit 491a62aed6
3 changed files with 204 additions and 132 deletions
+17 -1
View File
@@ -32,8 +32,11 @@ export function buildPageGenerateAgentPrompt(
const immediateContextBlock = preferImmediateContext
? [
'【即时上下文优先】当前需求是对本会话紧邻内容的续作。',
'“这个/刚才/做成页面”等指代只能解析为当前会话最近一轮内容,禁止用长期记忆、历史偏好或旧任务替换主题。',
'“这个/刚才/做成页面”等指代只能解析为当前会话最近一条 assistant 回复中的完整正文(如诗全文、文章全文),禁止用长期记忆、历史偏好或旧任务替换主题。',
'如果当前会话没有可辨识的紧邻内容,必须请用户补充主题,禁止猜测并生成其他页面。',
'【write_file 硬门槛】必须先 `load_skill` → `static-page-publish`,再用 `write_file`/`edit_file` 把紧邻正文完整写入 `public/*.html` 后才能结束。',
'禁止只调用 load_skill、todo_write 或 generate_image 就回复;没有 write_file 落盘 HTML 视为未完成。',
'缩略图/配图可选:优先完成 HTML 落盘与 mindspace-cover;没有 hero 图时 cover 可用 CSS 渐变或 omit,不要卡在 generate_image。',
'',
].join('\n')
: '';
@@ -84,6 +87,19 @@ export function buildPageGenerateAgentPrompt(
.join('\n');
}
export function buildImmediateContextPageRepairPrompt(intent) {
const topic = String(intent?.agentText ?? intent?.displayText ?? '').trim();
return [
'【即时上下文页面补写】上一轮页面生成未完成:已 load_skill 但未 write_file 落盘 HTML。',
'请立即读取本会话最近一条 assistant 回复中的完整正文,将其排版为完整静态页。',
'步骤:确认 static-page-publish 已加载 → 用 write_file 写入 public/*.html(含 mindspace-cover、platform-brand 页脚)→ 确认落盘后再回复唯一正式链接。',
'禁止再次只 generate_image 或只回复文字;本轮必须完成 write_file。',
topic ? `用户原话:${topic}` : '',
]
.filter(Boolean)
.join('\n');
}
export function buildPagePublishFailureText({
missingSharePreview = false,
missingPlatformBrand = false,