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
+14 -1
View File
@@ -1,10 +1,12 @@
import { buildPagePublishFailureText } from '../prompts/page-generate.mjs';
import { selectSendableHtmlArtifacts, verifyPageArtifactContent } from '../verify/page-artifact.mjs';
import { filterSharePreviewReadyArtifacts } from '../verify/share-preview.mjs';
export function evaluatePageGenerateSendableArtifacts({ verifiedArtifacts = [], confirmedArtifacts = [] } = {}) {
const sendable = selectSendableHtmlArtifacts({ verifiedArtifacts, confirmedArtifacts });
const verified = sendable.filter((artifact) => verifyPageArtifactContent(artifact).ok);
return verified.length > 0 ? verified : sendable;
const candidates = verified.length > 0 ? verified : sendable;
return filterSharePreviewReadyArtifacts(candidates);
}
/**
@@ -42,6 +44,17 @@ export function resolvePageGenerateOutcome({
};
}
const previewCandidates = filterSharePreviewReadyArtifacts(
selectSendableHtmlArtifacts({ verifiedArtifacts, confirmedArtifacts }),
);
if (previewCandidates.length === 0 && confirmedArtifacts.length > 0) {
return {
action: 'fail',
failureText: buildPagePublishFailureText({ missingSharePreview: true }),
reason: 'missing_share_preview',
};
}
if (!String(reply?.text ?? '').trim() && sendable.length === 0) {
return {
action: 'fail',