feat(canvas): cut over design agent to living form v2

This commit is contained in:
2026-08-30 17:00:31 +08:00
parent f245603923
commit b0b5a602b5
35 changed files with 5729 additions and 13986 deletions

View File

@@ -0,0 +1,77 @@
# Proposal: Supersede AI Design multi-Conversation ownership with Living Form V2
## Source
- Task: `20260830-design-v2-client-cutover-4e7b9a2c`
- Mode: Feature
- Status: Proposed for Integration Gate review
## Decision Proposed
Supersede ADR-001. One AI Design Workspace owns one current Direction, one
persistent Agent Gateway Session, one Current Design Specification, its
conversation timeline, immutable generation Quotes, generation Tasks, and
Assets. Conversation remains an interaction history, not a separately created
or selected authority object.
The Living Form is a server projection of the Current Design Specification. A
chat turn, direct field edit, decision-prompt response, Agent proposal
acceptance, lock change, and restore action are inputs to the same reducer.
Renderer drafts are temporary buffers only. Scalar fields update explicitly;
identity-bearing collections are replaced atomically. Canonical revisions,
field decision resolution, provenance, locks, blockers, and recent changes come
only from the accepted server projection.
Generation is a separate compile-and-confirm boundary. The server compiles a
professional image or video instruction and returns an immutable Quote tied to
one exact Specification revision. The client displays the customer-facing
output plan, warnings, expiry, and design points, then confirms only the Quote
identity. Provider Prompt, model, route, storage location, safety evidence,
compiler internals, and billing atoms remain server-private.
Every mutation carries stable command and semantic operation identities. A
transport-unknown result keeps the exact command for safe replay; it is not
treated as a failed write and does not authorize a fresh generation operation.
Revision conflict refreshes canonical Workspace state while preserving local
drafts. Accepted writes have no client expiry. Event cursors are resumable, but
event transport order and Task progress never become Specification truth.
Canvas has one production authority: the Works Square V2 boundary owned by
Electron Main. There is no V1 DTO adapter, nested design-Conversation UI, local
semantic adapter, editable final Prompt, mutable Quote, or cloud-failure
fallback.
## Evidence
- Shared V2 contract: `shared/image-workspace.ts`.
- Main adapter and Host boundary:
`electron/image-workspace/works-square-workspace.ts` and
`electron/api/routes/image-workspace.ts`.
- Renderer authority and interaction model: `src/stores/image-workspace.ts` and
`src/pages/ImageCanvas/`.
- V1 local authority removed:
`electron/image-workspace/local-workspace.ts` and both image-workspace dev
mode scripts are deleted.
- Verification recorded in the source task: full typecheck, lint with zero
errors, 1,425 passing unit tests, production Vite/Electron build, and two
passing Electron Canvas E2E tests.
## Canonical Updates Requested
- Mark ADR-001 superseded and add an accepted Living Form V2 ADR.
- Replace AI Design ownership, routing, Quote, task, asset, and local-adapter
sections in `20-architecture/system-overview.md`, `data-flow.md`, and
`module-map.md`.
- Reconcile the AI Design integrated snapshot, constraints, and follow-ups in
`30-worklog/current-state.md` after the matching server and client commits are
integrated.
## Conflict And Confirmation
This proposal intentionally reverses ADR-001 and canonical documentation that
requires one Workspace to contain multiple independent Conversations and lets
the client edit the final Prompt before mutable re-quoting. The user explicitly
approved the complete Living Form hard cutover, no low-version compatibility,
and customer-first generation confirmation in the source task. Integration
must preserve that provenance by superseding ADR-001 explicitly, not by editing
its historical decision in place.

View File

@@ -0,0 +1,124 @@
# Task: Cut over Makelore Design Agent to V2 living form
## Identity
- Task ID: 20260830-design-v2-client-cutover-4e7b9a2c
- Mode: Feature
- Branch: codex/20260830-design-v2-client-cutover-4e7b9a2c-design-v2-client-cutover
- Worktree: D:\Datas\OthersProjects\makelore-design-v2-client-cutover-4e7b9a2c
- Base commit: f2456039230f68e3ecb2c8653fc3379c23bbe5ce
- Owner: codex-root
- Status: Ready for Integration
## Scope
- Replace the Canvas V1 Brief/Conversation/Quote client contract with the V2
Living Form, Design Specification, Direction, immutable Quote, Task, and Asset
projections delivered by Works Square and Agent Gateway.
- Create the form with the project, keep it visibly present throughout the
conversation, and let chat, direct edits, decision prompts, Quote request, and
confirmation update the same canonical projection.
- Replace `turn.submit`, mutable Quote PATCH, and `confirm_generation` action
shims with `design.input.apply`, `design.quote.request`, and
`design.generation.confirm` using stable command and semantic operation IDs.
- Reconcile assistant deltas, Direction snapshots, Workspace/Task events, local
edit buffers, and pending operations without treating transport sequence or
Task progress as Specification truth.
- Update the Main-owned cloud adapter, Host route, shared contracts, Renderer
store, Canvas page/sidebar, focused tests, E2E fixture, and README. Convert or
retire the V1-only local development adapter; it must not remain a second
semantic authority or a packaged fallback.
## Intent And Constraints
- The Form is a projection of the server-owned Current Design Specification,
never a second client store. Draft text and unsent direct edits remain local
buffers until accepted.
- The client does not expose provider prompts, model IDs, routes, internal cost,
storage URIs, safety evidence, or compiler internals as editable form state.
- Finite choices use explicit options; expressive design intent remains text or
identity-bearing collections. Provenance, resolution, locks, Suggestions, the
active Question, blockers, warnings, Quote summary, and recent changes remain
visible where useful.
- Renderer access continues through the Main-owned Host interface. Works token,
stream ticket, WebSocket, retry classification, and error redaction remain in
Electron Main.
- There is no low-version compatibility path or V1 DTO adapter. Client and server
authority move together after the server's one-time data gate succeeds.
- The product remains Chinese-only, cloud-only when packaged, and on the existing
Makelore light visual system.
## Outcome
- Replaced the V1 Canvas contract end to end with a V2 Workspace projection:
one persistent Living Form, one current Direction, one Agent Session, one
conversation timeline, immutable Quotes, Workspace Tasks, and Workspace
Assets. Shared DTOs, Main adapter, Host routes, Renderer API/store, Sidebar,
Canvas UI, and tests now use the same vocabulary.
- Added a persistent two-pane creator workspace. Conversation, direct scalar
edits, atomic collection edits, proposal acceptance, decision prompts, and
field locks all write through the same `design.input.apply` command and
reconcile from the server projection. Image/video-only sections are shown
progressively, while local field and chat drafts stay separate from
canonical state until accepted.
- Replaced mutable Prompt/Quote controls with server compilation and immutable
confirmation. The client displays only customer-facing output summary,
warnings, expiry, and design points; confirmation submits Quote identity and
never exposes provider Prompt, model, storage URI, or billing atoms.
- Added stable command and operation identities, preserved exact commands after
network-unknown outcomes, resumable event cursors, authoritative refresh on
revision conflict, Workspace task/asset reconciliation, and safe retry UI.
- Removed the V1 local semantic adapter, local/cloud mode switches, local
development scripts, nested Conversation navigation, and V1-only tests. Both
development and packaged builds now use the Main-owned Works Square V2
boundary with no client semantic fallback.
- Updated README and development guidance to describe the shipped V2 behavior.
Replaced the old multi-Conversation Electron E2E with cloud-contract V2
coverage for Living Form edits, conversation reconciliation, immutable Quote
confirmation, tasks, and Prompt Museum navigation.
## Verification
- `corepack pnpm typecheck` — passed.
- `corepack pnpm run lint:check` — passed with 0 errors; five pre-existing
warnings remain in unchanged `src/pages/Home/index.tsx` and
`src/pages/Makelore/index.tsx`.
- `corepack pnpm test` — passed: 181 test files, 1,425 tests passed and two
existing tests skipped.
- `corepack pnpm run build:vite` — passed for Renderer, Electron Main, Preload,
and utility worker; only existing Vite chunk/dynamic-import warnings remain.
- `corepack pnpm exec playwright test tests/e2e/image-workspace-v2.spec.ts
--workers=1` — passed: two Electron E2E tests.
- `git diff --check` — passed.
## Follow-ups
- Integrate the client commit only with the matching Works Square Design V2
server contract. Any remaining server work must start from server `master`
`05bf994df944cec169be3f2378ee29b51aeae674` in a new isolated worktree; do not
replay changes onto the old `3d4d322` frontier.
- After server integration and deployment, run one real-account installed-client
smoke covering a direct field edit, conversational edit, Quote request,
confirmation, background completion, result download, and a deliberately
interrupted network-unknown retry.
## Promotion Candidates
- Target: accepted ADR-001 plus `.project-docs/20-architecture/{system-overview,
data-flow,module-map}.md` and the AI Design section of
`.project-docs/30-worklog/current-state.md`.
Proposal: supersede the multi-Conversation / mutable Brief and Quote model
with the one-Workspace, one-Direction, one-Living-Form V2 authority described
in `10-decisions/proposals/20260830-design-v2-client-cutover-4e7b9a2c__living-form-v2-authority.md`.
Evidence: this task's implementation, full unit suite, production build, and
Electron E2E results above.
Future impact: all client/server Design changes must treat chat and direct
edits as inputs to one Specification reducer, compile immutable Quotes on the
server, and preserve stable operation identity for uncertain writes.
Semantic conflicts: directly reverses ADR-001 and several canonical AI Design
rows that require nested Conversations, editable final Prompt, mutable Quote,
and a local development semantic adapter.
Human confirmation: already supplied in this source task through the explicit
request for the complete Living Form hard cutover and no low-version
compatibility; Integration Gate must still record ADR-001 as superseded rather
than silently rewriting it.