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
+21
View File
@@ -116,6 +116,27 @@ test('evaluatePageDataFinishGuard detects unbound page data html', () => {
}
});
test('explicit PG choice enables the delivery gate without relying on intent text', () => {
const publishDir = fs.mkdtempSync(path.join(os.tmpdir(), 'page-data-guard-explicit-pg-'));
try {
fs.mkdirSync(path.join(publishDir, 'public'), { recursive: true });
const evaluation = evaluatePageDataFinishGuard({
publishDir,
agentText: '做一个很好看的介绍页面',
messages: [{
role: 'user',
metadata: { memindRun: { pgRequired: true } },
content: [{ type: 'text', text: '做一个很好看的介绍页面' }],
}],
});
assert.equal(evaluation.pgRequired, true);
assert.equal(evaluation.pageDataIntent, true);
assert.equal(evaluation.needsRepair, true);
} finally {
fs.rmSync(publishDir, { recursive: true, force: true });
}
});
test('finish guard blocks localStorage ledger generated from ordinary user language', () => {
const publishDir = fs.mkdtempSync(path.join(os.tmpdir(), 'page-data-guard-ledger-'));
const text = '帮我做一个家庭记账页面,我每天可以记录日期、收入、支出、分类和备注,日期默认当天。再做一个管理页面,可以查看所有记录和收支汇总。';