feat(mindspace): gate published page delivery
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user