openpencil/packages
Fini 52f32a8dad feat(ai): browser-safe batch_design DSL executor (closes #44)
Extract ~600 lines of pure DSL logic from pen-mcp/tools/batch-design.ts
into a sibling batch-design-dsl.ts that does not import document-manager
(node:fs) or hooks (server-injected). `handleBatchDesign` becomes a
thin server-side wrapper that opens/saves the .op file around the pure
executor. Backward-compat: pen-mcp barrel + batch-design.ts both
re-export `runBatchDesignDsl` so existing callers keep working.

apps/web dispatcher changes:
- `applyBatchDesignDsl` now runs `runBatchDesignDsl` DIRECTLY in the
  browser against useDocumentStore.getState().document (structuredClone
  + apply via applyExternalDocument).
- HTTP `/api/mcp/exec-tool` fallback fires only when the in-browser
  executor throws (rare — caller error or future regression).
- Removes per-tag HTTP latency on the common batch_design path.
- ctx.defaultParentId is intentionally NOT applied here: the DSL is
  the AI's verbatim instruction set and rewriting `null` parents
  would change author intent. Element-tool calls still honor it.

Image search (`G()` op) is swapped from `getSyncUrl`-based absolute
URL (server) to an injectable `ImageSearchFetcher` callback. Server
wrapper keeps the old behavior; browser path omits the fetcher so
`src` stays empty for the apps/web image pipeline (scanAndFillImages)
to enrich later.

Tests:
- New browser-safety gate `batch-design-dsl-browser-safe.test.ts`:
  walks the transitive import graph from batch-design-dsl.ts and
  fails if any reachable file imports node:fs / node:os / node:path
  / document-manager / hooks. 5 checks including a negative control
  on batch-design.ts (wrapper) to confirm the split is meaningful.
- Dispatcher tests updated to match new behavior: happy path does
  NOT hit fetch; malformed DSL returns `status=failed` with per-op
  error surfaced (via pure executor's `errors[]`), not an opaque
  HTTP 500.
- Total: 3028 → 3033 passing.
2026-04-22 06:55:00 +08:00
..
agent-native@e1f90cab96 chore(agent): bump agent-native to v0.4.0 release 2026-04-17 19:04:15 +08:00
pen-acp chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-ai-skills feat(ai): add_chart_line_v0 + add_chart_pie_v0 — two chart skeletons (46th, 47th) 2026-04-22 06:35:00 +08:00
pen-core fix(ai): chart-pie donut innerRadius is a RATIO, not pixels 2026-04-22 06:45:00 +08:00
pen-engine chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-figma chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-mcp feat(ai): browser-safe batch_design DSL executor (closes #44) 2026-04-22 06:55:00 +08:00
pen-react chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-renderer chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-sdk chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
pen-types fix(core): design.md lives on PenDocument — kill cross-document leak 2026-04-20 00:37:31 +08:00
CLAUDE.md V0.7.0 (#95) 2026-04-11 23:25:13 +08:00