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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user