Continues the gradient + property-panel polish from the previous
commit and rounds out two new flows the TS app already has:
Gradient stops + effects:
- ColorTarget gains GradientStop(i) + EffectColor(i); HSV picker
preserves alpha across hue/SV drags so a transparent stop stays
transparent. Hex pill stays 6-char; alpha is reattached at commit
and the swatch sits on a 2x2 alpha checker so #00000000 reads as
transparent rather than empty.
- Effects section reflowed into card-style blocks (image #9 spec):
title + minus, X/Y and Blur/Spread 2-col grids, color row with
swatch + rgba(...) text; clicking the swatch opens an HSV picker
bound to that effect index via SetEffectColor.
- Press dispatch on both hosts anchors picker overlays at the
clicked y so they pop adjacent to the swatch instead of the top.
Image + SVG import (toolbar + Fill section "图片" row):
- New FileAction::ImportImageOrSvg / PickFillImage; persistence_image
pops rfd, decodes raster as data: URL, inserts an Image node or
rewrites the selected node's primary fill.
- ImageNode actually renders on the canvas: NodePayload + SceneNode
carry image_src, canvas_viewport_paint.rs decodes the data URL
once and hands raw bytes to RenderBackend::draw_image with a
src-hash cache id. Grey placeholder paints only when decode fails
so transparent PNGs don't get a grey matte underneath.
- SVG import ported to TS-parity (packages/pen-engine svg-parser):
recursive <g> tree walk with inherited fill/stroke/style="...",
viewBox-aware scaling with maxDim cap, multi-subpath split, raw
d preserved on PathNode. Imports land wrapped in a Group named
after the source file.
Locale-aware first run:
- settings_io detects the OS locale (LC_ALL/LANG/LC_MESSAGES with
zh-Hans/zh-Hant heuristics) and seeds editor_ui.locale before
settings.json is read; persisted user choice still wins.
- macOS bundle declares CFBundleLocalizations + AllowMixedLocalizations
so NSOpenPanel / NSSavePanel render in the same language as the
rest of the chrome.
Web host kept exhaustive across the new variants (PickFillImage,
OpenEffectColorPicker, ColorTarget::EffectColor, GradientStop). Two
new files: persistence_image.rs (file-pick handlers, ≤120 lines) and
svg_path_data.rs (path-d tokenizer + bbox + normaliser, split from
svg_import.rs to stay under the 800-line cap). 277 op-editor-core
tests pass.
Port executeVisualRefOrchestration from visual-ref-orchestrator.ts:45-166.
5-stage flow: design-system seed → HTML codegen → screenshot → enhanced
prompt → Orchestrator::run. Emits VisualRefStarted/DesignSystem/HtmlGenerated/
ScreenshotReady/Fallback progress variants. Falls back to plain Orchestrator::run
on empty HTML or None screenshot. Abort checked before each stage.
S4 B2: port three HTML helper functions from the deleted TS visual-ref
pipeline. generate_design_code uses design-code + design-principles skills
as system prompt. extract_structure_summary uses a hand-rolled byte scanner
(no regex crate dep) to extract sections/headings/CTAs. build_enhanced_prompt
produces the byte-exact TS prompt template. 20 new tests; 569 total green.
Task B1 of S4. Adds three functions to design_system.rs:
- generate_design_system(): async LLM call with design-system skill as system
prompt; parses response via parse_design_system; falls back to DEFAULT on
any failure (port of design-system-generator.ts:20-29).
- design_system_to_seed_commands(): emits SetVariableColor/SetVariableScalar
for 8 palette tokens (color-*), 6 spacing steps (spacing-xs..2xl), 3 radius
steps (radius-sm/md/lg), 2 font strings (font-heading/font-body), and 6 type
scale steps (font-size-1..6) — 25 commands for DEFAULT (port of TS:134-156).
- design_system_to_prompt_context(): byte-exact port of the TS template prose
"DESIGN SYSTEM (use these values consistently):\nColors: bg ... Style: ..."
(port of TS:161-170).
11 new TDD tests; full suite 550 green (baseline was 539).
Move the three S3c validation stub providers (SkippedPreValidator,
SkippedScreenshotProvider, SkippedVisionLlmClient) from cfg-test-only
test_support to a new pub module 'stub_providers'. Test code keeps
working via a pub(crate) re-export; host code can now construct a
no-op ValidationProviders bundle without re-implementing the trait
impls per host.
chat_orchestrator.rs (predecessor of task #27 'wire intent gate into
chat runtime') compiles again after S3b-2/S3b-4/S3c added required
fields + a required Orchestrator::run arg:
- DesignRequest literal grew append_context: None, concurrency: 1,
validation_enabled: false (conservative — validation gated off
until host wires real screenshot / vision LLM).
- Orchestrator::run takes a 6th &ValidationProviders<'_> arg; we pass
a bundle of the three Skipped*Provider stubs.
The whole module is marked #![allow(dead_code)] because no caller has
yet been added to chat_runtime.rs — that's #27 proper. Delete that
allow in the same PR as #27 真接线.
Theme-toggle button now paints a Sun glyph in dark mode (click → light) and a Moon glyph in light mode (click → dark); the Sun icon was hardcoded before. Adds Icon::Moon (lucide crescent) and threads theme_mode into TopBar.
Bumps the casement submodule with a fix for the native macOS traffic-light reposition: idempotent absolute placement against resize, baseline invalidation on fullscreen exit, and a poison guard so a transitional re-capture can't drop the lights below their default position.
Port buildNodeFromSpec (TS:307-372) + the addChild branch of applyValidationFixes
into Rust. When a StructuralFix::AddChild arrives, build a PenNode from the
vision-LLM spec (frame/text/rectangle/ellipse/path), insert it via
EditorCommand::InsertSubtree under the parent, then call
auto_fix_parent_layout_after_add_child. Status-bar parents are protected.
Also fixes the B2 nit: extract_name_base now lowercases the name before
extracting the last word, matching the TS toLowerCase() call so "Nav ITEM"
and "Tab item" share the same base "item".
Icon resolution is a stub (d/iconId left None); a TODO marks the gap for
a future IconResolver trait. 11 new tests added; full suite 480 green.
Port SAFE_FIX_PROPERTIES (17 entries), is_valid_fix_value, and
is_valid_structural_fix from design-validation-fixes.ts:67-157.
Adds 65 tests covering all property kinds + structural fix shapes.
S3b-3 Task C3: branch `run()` to `run_dashboard_path` when
`should_use_dashboard_columns` is true for sequential requests.
Extracts the dashboard implementation into `run_dashboard.rs` to
keep `run.rs` under the 800-line ceiling (606 lines post-split).
- Logical-to-live id resolution: walks live document tree after
`InsertSubtree` via `collect_name_id_map`; resolves Sidebar /
Main Content / "{label} Slot" by name.
- Sets `subtask.generated_root_id` to the slot live id (ports
TS `orchestrator.ts:541` `generatedRootId` fallback).
- Sidebar subtasks → `live_sidebar_id`; others → slot live id.
- 3-attempt tier-gated retry ladder identical to sequential path.
- Post-loop: `reorder_dashboard_main_children` + `run_cleanup_passes`
on both `live_sidebar_id` and `live_main_id`.
- Removes `#![allow(dead_code)]` / `#[allow(dead_code)]` from
`dashboard_columns.rs` and `scaffold_dashboard.rs` (all symbols
now live-reachable).
- 4 new tests in `run_tests_c3.rs`: happy path verifies Sidebar /
Main Content children in live document; non-dashboard regression;
zero-node NoContent; abort-mid Aborted.
329 tests pass; clippy -D warnings clean; fmt check clean.
Add `build_scaffold_dashboard` in new sibling `scaffold_dashboard.rs`
(S3b-3 Task C2). Builds the horizontal root + 260px sidebar +
fill_container main column scaffold; calls
`assign_dashboard_main_parents` to synthesize row/slot frames and
**embeds them as nested children of main** in the same `InsertSubtree`
(necessary because `cmd_insert_subtree` remaps every node id —
references between row / slot / main would break across separate
commands). Returns
`(cmds, sidebar_id, main_id, scaffold_baseline)` where the baseline
matches `descendant_count(state, root_id)` after apply (mirrors TS
`scaffoldCounts.set(rootId, countDescendants(root))` in
`orchestrator.ts:1038-1053`).
Port of `orchestrator.ts:283-320` (createDashboardColumnFrames) +
`orchestrator.ts:954-1019` (useDashboardColumns scaffold branch).
`cleanup::count_descendants` upgraded to `pub(crate)` so the scaffold
can pre-compute the same baseline value. Existing sequential +
concurrent scaffold functions unchanged.
12 new tests in sibling `scaffold_tests_c2.rs`; 325 total green.
Adds DesignRequest.concurrency, group_subtasks_by_screen + ScreenGroup,
effective_concurrency, and clamp_concurrency in a new concurrent.rs module.
Faithful port of orchestrator.ts:780-810 (minus S3b-4 append gate).
All 17 DesignRequest literals updated; 183 tests green.
Port of the TS `executeSubAgent` skill-filtering branches and the
`retryAllowed` set from `orchestrator-sub-agent-compact.ts`.
- New `compact_skills.rs`: `apply_skill_filter` + `SkillNamed` trait.
- `minimal_skills=true` → keep only `schema`+`jsonl-format`/`-simplified`.
- `reduced_complexity=true` + `ModelTier::Basic` → keep the 8-skill
`retryAllowed` set (drops `elements`, `overflow`, `icon-catalog`, etc.).
- Standard/Full tier: `reduced_complexity` is a no-op (full set through).
- `build_subagent_prompt` gains `reduced_complexity: bool` + `minimal_skills: bool`
params; resolves tier from the request model and applies the filter after
`resolve_generation_skills`.
- `run_subtask` gains the same two params and threads them into `build_subagent_prompt`.
- All existing callers in `run.rs` and tests pass `false, false` (single-attempt path).
New crate restoring the design orchestrator (TS orchestrator.ts
phases 1-4, single-screen sequential) that the Rust migration
dropped. Pure crate — no winit/casement/agent dependency.
- types.rs: DocSink + LlmClient traits, CallRequest/LlmChunk/
Progress/RunSummary and friends
- intent.rs: classify_intent (design vs chat)
- plan.rs: OrchestratorPlan parse + heuristic fallback
- parse.rs: LLM output -> canonical PenNode trees
- plan_normalize.rs: single-screen plan normalization
- variables.rs: plan-derived $color-* seed/snapshot/rollback
- prompt.rs: planning + sub-agent prompt assembly via op-ai-skills
- scaffold.rs: single-screen canvas scaffold (InsertSubtree)
- subagent.rs: sequential sub-agent execution
- cleanup.rs: descendant_count + run_cleanup_passes (reusable for S3b)
- run.rs: Orchestrator::run() — 4-phase spine, spec §6 error/abort/
zero-content semantics
- test_support.rs: VecDocSink + ScriptedLlm test stubs
NOT verified locally: op-orchestrator depends on op-editor-core,
which does not currently build — vendor/jian is pinned to unpushed
commit 80121906 (see prior commit). Unit tests written throughout;
they run once the jian build is restored.
S3a Plan B + Plan C (orchestrator modules).