openpencil/apps
Fini 2aabe494f5 fix(core): design.md lives on PenDocument — kill cross-document leak
design.md was stored in a global Zustand store + per-file-key localStorage
in apps/web, and in a module-level cache in pen-mcp. Both leaked across
files: a newly-created document could pick up the previous file's dark
palette (async clearForNewDocument raced with AI chat reads; hydrate()
could rehydrate the last file's designMd on refresh; shared .pen files
lost the spec entirely because it wasn't inside the document).

Fix:
- Add `designMd?: DesignMdSpec` to PenDocument (pen-types). It now
  serializes with .pen/.op and travels across sessions/users.
- Add `setDesignMd` action to document-store.
- Rewrite design-md-store as a thin mirror over document-store so the
  legacy hook API still works. On document load it migrates any legacy
  localStorage entry into the opened document and deletes the localStorage
  key; hydrate() wipes the orphan `openpencil-design-md-current-key`.
- MCP handleGetDesignMd / handleSetDesignMd / handleExportDesignMd read
  `doc.designMd` directly and persist via saveDocument. Removed the
  process-level `_mcpDesignMd` cache.

Verified via MCP live round-trip: set on file A → persists to A's .op on
disk → new file B returns hasDesignMd:false (no leak).
2026-04-20 00:37:31 +08:00
..
cli chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
desktop chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
web fix(core): design.md lives on PenDocument — kill cross-document leak 2026-04-20 00:37:31 +08:00