feat(mindspace): add page quota grace write and local delivery guardrails.
Memind CI / Test, build, and release guards (pull_request) Failing after 18s

Centralize page HTML quota checks with grace-write semantics across page
services and workspace tools, keep localhost MindSpace links clickable in
chat display, and expand Page Data/static-page skill plus local dev docs
for quota, delivery URLs, and native Aider/OpenHands tooling.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-30 10:27:16 +08:00
parent b553107817
commit 371900bae5
18 changed files with 503 additions and 39 deletions
+5 -9
View File
@@ -21,6 +21,7 @@ import {
inferWorkspaceHtmlRelativePath,
} from './mindspace-html-download-links.mjs';
import { createImgproxySigner } from './imgproxy-signer.mjs';
import { assertPageWriteQuota } from './mindspace-space-quota.mjs';
const SCANNER_VERSION = 'mindspace-content-v1';
const PRIVATE_ASSET_DOWNLOAD_URL_PATTERN =
@@ -723,15 +724,10 @@ export function createPublicationService(pool, options = {}) {
WHERE id = ? AND user_id = ? FOR UPDATE`,
[page.space_id, userId],
);
const available =
Number(spaces[0]?.quota_bytes ?? 0) -
Number(spaces[0]?.used_bytes ?? 0) -
Number(spaces[0]?.reserved_bytes ?? 0);
if (available < htmlBytes) {
throw publicationError('剩余空间不足', 'quota_exceeded', {
requiredBytes: htmlBytes,
availableBytes: Math.max(0, available),
});
try {
assertPageWriteQuota(spaces[0], htmlBytes);
} catch (error) {
throw publicationError(error.message, error.code ?? 'quota_exceeded', error.details);
}
const [publicationUsage] = await conn.query(
`SELECT COUNT(DISTINCT page_id) AS public_page_used,