feat(wechat): require share preview meta before page link delivery

Block service-account page links when HTML lacks mindspace-cover and
description so WeChat forwards always get TKMind branding and thumbnail.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-04 14:00:26 +08:00
parent 031c6e086a
commit 31fb0e02cf
4 changed files with 146 additions and 3 deletions
+13 -2
View File
@@ -24,7 +24,12 @@ export function buildPageGenerateAgentPrompt(intent, { wantsDocx = false } = {})
'2. 阅读技能说明后,用 sandbox-fs 的 `write_file` 或 `edit_file` 写入 `public/*.html`。',
'3. 禁止 shell/cat/heredoc/cp 写 HTML(不会出现在公网 MindSpace)。',
'4. 写完后确认目标文件已落盘,且内容是用户要的完整页面(不是占位 stub)。',
'5. 回复里只给一个正式域名链接;没有落盘就不要发链接。',
'5. 在 `<head>` 写入微信分享卡片所需元数据(必须):',
' - `<meta name="description" content="一句话摘要">`',
' - `<meta name="mindspace-cover" content=\'{"tag":"主题","accent":"#主色","accent2":"#辅色","subtitle":"卖点","cover":"assets/hero.jpg"}\'>`',
' tag/accent/subtitle 必须与页面主题一致;有 hero 图时 cover 指向同目录 raster 图(jpg/png)。',
'6. 页脚加 `<footer data-mindspace-page-tag="platform-brand">` 以显示 TKMind 智趣 品牌。',
'7. 回复里只给一个正式域名链接;没有落盘或缺少上述元数据就不要发链接。',
'',
buildCurrentTimeAgentPrefix({ timezone: scheduleTimezone }),
`用户需求:${topic}`,
@@ -33,7 +38,13 @@ export function buildPageGenerateAgentPrompt(intent, { wantsDocx = false } = {})
.join('\n');
}
export function buildPagePublishFailureText() {
export function buildPagePublishFailureText({ missingSharePreview = false } = {}) {
if (missingSharePreview) {
return [
'这次页面已落盘,但缺少微信分享卡片所需的预览元数据(mindspace-cover 与摘要),所以我先不发链接。',
'请直接重发一次完整页面需求,我会重新按 static-page-publish 技能生成带预览图的页面。',
].join('\n');
}
return [
'这次页面没有按服务号页面技能真正生成成功,所以我先不发占位链接。',
'请直接重发一次完整页面需求,我会重新按 static-page-publish 技能链路生成。',