feat(wechat): channel split with stub-safe page delivery

Introduce wechat/ channel package; never send stub HTML links to service-account users.
This commit was merged in pull request #2.
This commit is contained in:
2026-07-04 05:21:13 +00:00
parent f36e8b9292
commit 2a3579c73a
8 changed files with 413 additions and 24 deletions
+41
View File
@@ -0,0 +1,41 @@
import { buildCurrentTimeAgentPrefix } from '../../user-memory-profile.mjs';
/**
* Service-account-only page generation prompt. Does not use H5 buildAutoChatSkillPrefix.
*/
export function buildPageGenerateAgentPrompt(intent, { wantsDocx = false } = {}) {
const topic = String(intent?.agentText ?? intent?.displayText ?? '').trim();
const scheduleTimezone = process.env.H5_DEFAULT_TIMEZONE || 'Asia/Shanghai';
const docxBlock = wantsDocx
? [
'【Word 下载】用户要求页面内可下载 Word/docx。',
'先 `load_skill` → `docx-generate` 生成 `public/*.docx`,再写 HTML 并链接同目录文档。',
'',
].join('\n')
: '';
return [
'【微信服务号 · 页面生成任务】',
'这是服务号专用页面生成,不是普通聊天。必须按步骤完成,未完成前禁止告诉用户“已生成/已发布”。',
'',
docxBlock,
'步骤(必须全部完成):',
'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)。',
'5. 回复里只给一个正式域名链接;没有落盘就不要发链接。',
'',
buildCurrentTimeAgentPrefix({ timezone: scheduleTimezone }),
`用户需求:${topic}`,
]
.filter(Boolean)
.join('\n');
}
export function buildPagePublishFailureText() {
return [
'这次页面没有按服务号页面技能真正生成成功,所以我先不发占位链接。',
'请直接重发一次完整页面需求,我会重新按 static-page-publish 技能链路生成。',
].join('\n');
}