feat(mindspace): gate published page delivery

This commit is contained in:
john
2026-07-14 19:13:01 +08:00
parent ae9090948a
commit 27b11894f2
16 changed files with 448 additions and 39 deletions
+13
View File
@@ -429,6 +429,19 @@ export function materializePublicHtmlWritesFromSessionEvent(
return { materialized: [], skipped: [] };
}
/** Read the public HTML targets from a stream event without writing them. */
export function collectPublicHtmlWritePathsFromSessionEvent(event, { publishDir, recentCount = 20 } = {}) {
if (!event || !publishDir) return [];
const messages = event.type === 'Message' && event.message
? [event.message]
: event.type === 'UpdateConversation' && Array.isArray(event.conversation)
? event.conversation.slice(-Math.max(1, recentCount))
: [];
return [...new Set(extractPublicHtmlWriteArtifacts(messages, { publishDir })
.map((artifact) => artifact.relativePath)
.filter(Boolean))];
}
function messageHasPublicHtmlToolRequest(message, { publishDir = null } = {}) {
if (extractPublicHtmlWriteArtifacts([message], { publishDir }).length > 0) {
return true;