fix: guard WeChat Page Data delivery with Aider review
Memind CI / Test, build, and release guards (push) Has been cancelled

This commit is contained in:
john
2026-07-28 00:26:24 +08:00
parent bc20e93893
commit 8bfb7959fc
13 changed files with 996 additions and 7 deletions
+17 -1
View File
@@ -1,4 +1,8 @@
import { buildAutoChatSkillPrefix, isPageDataIntent } from '../../chat-skills.mjs';
import {
buildAutoChatSkillPrefix,
isPageDataDevIntent,
isPageDataIntent,
} from '../../chat-skills.mjs';
import { shouldUseScheduleAssistant } from '../../schedule-intent.mjs';
import { buildCurrentTimeAgentPrefix } from '../../user-memory-profile.mjs';
import { isPageGenerateText, wantsDocxDownload } from '../intent/patterns.mjs';
@@ -42,6 +46,16 @@ export function buildWechatAgentPrompt(intent, { grantedSkills = [], imagePolicy
'',
].join('\n')
: '';
const pageDataRepairHint = isPageDataDevIntent(agentText)
? [
'【Page Data 修复要求】这条消息是在修复现有数据页面,不是普通静态页面修改。',
'开始前必须先调用 `load_skill` → `page-data-collect`,检查本轮目标 HTML、dataset、真实表、page policy 与 bind 是否一致。',
'缺表、dataset 未注册或 bind 不完整时,必须用 private_data_* 工具补齐;禁止只改前端后声称保存成功。',
'HTML 必须使用 /assets/page-data-client.js 和服务端 authenticate/listRows/insertRow,禁止前端硬编码口令和浏览器本地存储 fallback。',
'完成后必须重新执行提交/读取交付验收;未通过前不要发送链接或说“已修复”。',
'',
].join('\n')
: '';
const scheduleTimezone = process.env.H5_DEFAULT_TIMEZONE || 'Asia/Shanghai';
const currentTimeHint = buildCurrentTimeAgentPrefix({ timezone: scheduleTimezone });
const scheduleAssistantHint = shouldUseScheduleAssistant(agentText)
@@ -63,6 +77,7 @@ export function buildWechatAgentPrompt(intent, { grantedSkills = [], imagePolicy
return [
docxDownloadHint,
pageDataCollectHint,
pageDataRepairHint,
currentTimeHint,
scheduleAssistantHint,
imageGenerationHint,
@@ -140,6 +155,7 @@ export function buildWechatAgentPrompt(intent, { grantedSkills = [], imagePolicy
}
if (docxDownloadHint) lines.push(docxDownloadHint);
if (pageDataCollectHint) lines.push(pageDataCollectHint);
if (pageDataRepairHint) lines.push(pageDataRepairHint);
if (pagePublishHint) lines.push(pagePublishHint);
if (scheduleAssistantHint) lines.push(scheduleAssistantHint);
if (imageGenerationHint) lines.push(imageGenerationHint);
+19 -1
View File
@@ -1,4 +1,8 @@
import { buildCurrentTimeAgentPrefix } from '../../user-memory-profile.mjs';
import {
isPageDataDevIntent,
isPageDataIntent,
} from '../../chat-skills.mjs';
import { buildWechatPageImageInstruction } from '../image-generation-policy.mjs';
/**
@@ -6,6 +10,7 @@ import { buildWechatPageImageInstruction } from '../image-generation-policy.mjs'
*/
export function buildPageGenerateAgentPrompt(intent, { wantsDocx = false, imagePolicy = null } = {}) {
const topic = String(intent?.agentText ?? intent?.displayText ?? '').trim();
const pageDataTask = isPageDataIntent(topic) || isPageDataDevIntent(topic);
const scheduleTimezone = process.env.H5_DEFAULT_TIMEZONE || 'Asia/Shanghai';
const docxBlock = wantsDocx
? [
@@ -20,6 +25,16 @@ export function buildPageGenerateAgentPrompt(intent, { wantsDocx = false, imageP
const coverExample = imageBlock
? '<本轮 generate_image 返回的 asset.htmlSrc>'
: 'assets/hero.jpg';
const pageDataBlock = pageDataTask
? [
'【Page Data 强制要求】这不是静态展示页。',
'先 `load_skill` → `page-data-collect`,再按技能执行:private_data_execute 建表 → private_data_register_dataset → 写 HTML → private_data_bind_workspace_page。',
'修复任务必须核对真实表、dataset、policy 与 bind;缺失时必须补齐,禁止只改 HTML。',
'HTML 必须使用 /assets/page-data-client.js 与服务端 authenticate/listRows/insertRow;禁止硬编码口令、本地存储和自建 API。',
'只有 Page Data 提交/读取交付验收通过后才能发送链接。',
'',
].join('\n')
: '';
return [
'【微信服务号 · 页面生成任务】',
@@ -27,8 +42,11 @@ export function buildPageGenerateAgentPrompt(intent, { wantsDocx = false, imageP
'',
docxBlock,
imageBlock,
pageDataBlock,
'步骤(必须全部完成):',
'1. 必须先调用 `load_skill`,参数 name=`static-page-publish`。',
pageDataTask
? '1. 完成 page-data-collect 数据能力后,再调用 `load_skill`,参数 name=`static-page-publish`,补齐视觉与发布要求。'
: '1. 必须先调用 `load_skill`,参数 name=`static-page-publish`。',
'2. 阅读技能说明后,用 sandbox-fs 的 `write_file` 或 `edit_file` 写入 `public/*.html`。',
'3. 禁止 shell/cat/heredoc/cp 写 HTML(不会出现在公网 MindSpace)。',
'4. 写完后确认目标文件已落盘,且内容是用户要的完整页面(不是占位 stub)。',