Commit Graph

84 Commits

Author SHA1 Message Date
root 3336f23e6f chore: update planning notes
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 10:04:06 +08:00
root b86173b8a7 chore(frontend): shorten document title to "Moteva"
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 10:04:06 +08:00
root cc5753c19d style(ui): refine composer and image drop border radius and padding
Drive the drop-target border radius from --image-drop-radius, enlarge the
overlay radius, and widen the composer editor padding.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 10:04:06 +08:00
root bb8946b79b feat(canvas): add visual annotation edit action
Add a VisualAnnotationPanel letting users mark regions on an image (brush,
circle, rectangle, cross) with per-mark edit instructions, composited into
an annotation guide image. The new "visual-annotation" node action sends
the unmarked source plus the annotated guide to the image model, editing
only numbered regions. Server validates the annotation image/instructions
and threads them through the generator task.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 10:03:59 +08:00
root 114198f1d9 docs(auth): document atomic per-type device limit enforcement
Clarify in API/README that device limits are enforced independently per
normalized device type with atomic overflow revocation, and add a mapper
test covering the RFC3339 UTC timestamp contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 01:02:25 +08:00
root 869e2bb75b chore: update planning notes
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 01:02:12 +08:00
root 0ef4b7c1ee feat(ui): add drag-and-drop image upload to composers
Add an ImageDropOverlay component and useImageDropTarget hook that let
users drop an image onto the home prompt card or canvas agent composer to
upload it as a reference, with a localized drop overlay.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 01:02:12 +08:00
root 58f11302fe feat(auth): add device session tracking with configurable limits
Track authenticated sessions per device (parsing user-agent for desktop
vs mobile via mileusna/useragent), enforce configurable concurrent device
limits (Auth.DeviceLimits), and surface device status and "remove other
devices" management in the account dialog. Adds device/session context to
the auth module stores and exposes limits through the API.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 01:02:05 +08:00
root 875fff825c feat(canvas): add loading state for agent history retrieval 2026-07-10 23:09:42 +08:00
root 0363170eab change(ui): increase font size of disabled button from 13px to 14px 2026-07-10 23:06:38 +08:00
root 4f8c32b5ac change(ui): increase font size of disabled button from 12px to 14px 2026-07-10 23:05:00 +08:00
root b704335f6b change(ui): adjust font size of home prompt editor 2026-07-10 23:03:46 +08:00
root 0edff0e1cb refactor(ui): remove unused toolbar dot indicator
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 22:42:41 +08:00
root 6f998480bc feat(canvas): show loading state while agent history loads
Track agent history loading in the workspace and render a spinner with a
localized "loading conversation history" message in the assistant feed,
so the empty state no longer flashes before history resolves.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 22:42:41 +08:00
root 0a68551bfd change(ui): default composer image quality to medium
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 22:35:08 +08:00
root 0968f10f86 refactor(ui): simplify composer settings chip and animate chevron
Condense the settings-chip summary to quality, ratio, and image count
(dropping resolution and pixel size), wrap the label in an ellipsized
span, and swap the up/down chevron for a single rotating ChevronDown
across the canvas agent and image generator composers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 22:35:08 +08:00
root 59f2b02458 chore: add planning notes for brand kit and agent starter work
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 22:19:28 +08:00
root 71a1b3ace4 feat(frontend): add canvas agent empty state with server-driven starters
Render a CanvasAgentEmptyState in the Agent panel that fetches localized
starter content from the new agent-starters endpoint, with local defaults
as fallback. Clicking a starter focuses the prompt composer (new focus
handle). Includes accompanying UI polish: side-nav cleanup, animated
prompt examples, and canvas panel spacing tweaks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 22:19:22 +08:00
root c94b163540 feat(server): add localized agent starter config endpoint
Add a public GET /api/ui/agent-starters endpoint returning localized
empty-state content (title, description, preview images, and starter
prompts) for the canvas Agent panel. Content is server-configurable via
AgentStarter config with built-in zh-CN/en-US fallbacks, and the route is
exempt from authentication so shared canvases render the same content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 22:19:14 +08:00
root 2df9ae6581 feat(frontend): add brand kit management UI and project binding
Add a brand kit domain model, repository, and dedicated page/route for
managing brand kits, plus a BrandKitSelector used on the home page and
canvas workspace. Home project creation and the workspace can attach a
brand kit to a project, with new i18n strings and a side-nav entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 20:59:05 +08:00
root 789f51b29e feat(server): add brand kit management and project binding
Add a brand kit domain with memory and postgres stores, a BrandKitService
for CRUD and resolution, and REST endpoints to list, upsert, and delete
brand kits. Projects can bind a brand kit whose resolved context and
reference images feed into the agent's long-term memory and design prompts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 20:58:55 +08:00
root 3653474355 refactor(ui): add size variants to Switch and consolidate styles
Introduce sm/md/lg sizes on the Switch component driven by CSS custom
properties, move switch styling into a dedicated switch.css, and remove
the duplicated overrides from styles.css and ToolbarCustomizeDialog.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 20:58:45 +08:00
root d5f9cb366a refactor(infrastructure): modularize designGateway into focused modules
Split the monolithic designGateway.ts (1000+ lines) into organized modules:
- types.ts: type definitions and API contracts
- request.ts: HTTP request utilities
- responses.ts: response type definitions
- canvas.ts: canvas-related API calls
- projects.ts: project management operations
- agents.ts: agent/thread API operations
- generation.ts: image generation operations
- events.ts: event streaming and handlers
- canvasSnapshot.ts: snapshot management
- sharing.ts: share context and permissions
- assets.ts: asset operations
- clientIds.ts: client ID utilities
- shareContext.ts: share context helpers

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-10 16:58:21 +08:00
root 14eaece0ac feat(canvas): add shared workspace access and controls 2026-07-10 14:47:19 +08:00
root f288eb1365 fix(server): resolve latest available agent thread 2026-07-10 14:46:30 +08:00
root 9d47cb9bbd feat(server): add project sharing access control 2026-07-10 14:46:18 +08:00
root 60130b3d9b feat(canvas): build PSD export in the browser from canvas layers
Move PSD generation off the server. The image-generation API only
produces raster formats, so drop the PSD request path, the oov/psd
decoder, and the LayeredDocumentGenerator wiring. Layer separation now
returns clean background, foreground, and text_render_data artifacts
into a transparent frame.

Export that frame (or any image node) as PSD from the canvas context
menu: ag-psd assembles layers, rotation/flip, opacity, editable text,
and stroke effects from the current canvas state at download time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 11:01:46 +08:00
root 4ff246a294 feat(canvas): resolution/ratio composer settings and quality/count controls
Replace the ratio-baked size presets with a resolution tier (1K/2K/4K) plus
ratio selection and normalized dimensions, send imageQuality/imageCount to
the agent, and add the output_format field to GeneratorTaskInputArgs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 20:43:35 +08:00
root f0ae237da5 feat(server): wire quality/count params and layered document generator
Map imageQuality/imageCount and output_format across the HTTP and
WebSocket handlers, pass them into the design service calls, and register
the layered document generator in the service context.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 20:43:20 +08:00
root 41208e566c feat(piagent): support image quality and output_format in image client
Add quality and output_format to ImageRequestOptions, plumb them through
the JSON/multipart request bodies, generalize asset URL collection to
non-image formats, and add GenerateLayeredDocument for PSD output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 20:42:55 +08:00
root cb24ffd185 feat(application): PSD layer separation and image quality/count threading
Convert GPT Image 2 layered PSD output into canvas image/text nodes with a
local separation fallback (new layer_separation.go, oov/psd dependency),
default layer-separation/edit-elements output_format to psd, and thread
imageQuality/imageCount through project generation and job processing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 20:42:42 +08:00
root 00b70298f2 feat(design): thread image quality, count and layered output through domain
Add ImageQuality/ImageCount to AgentRequest, AgentChatRequest and Job,
add OutputFormat to GeneratorTaskInputArgs, and introduce the
LayeredDocument types and LayeredDocumentGenerator port for PSD output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 20:42:26 +08:00
root db41dac5e9 feat(server): add imageQuality/imageCount and output_format to API contract
Extend CreateProject/Generate/AgentChat request types with imageQuality
and imageCount, and add output_format to GeneratorTaskInputArgs for
layered (PSD) generation output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 20:42:11 +08:00
root a1503a1687 feat(canvas): frame-based layer separation UI
Render and manage the separated layers produced by the edit-elements
action as a manual-frame container with attached image and text
children.

- canvasNodeOps: frame container/child helpers, render ordering,
  auto-attach nodes to containing frames, and layer reordering
- CanvasWorkspace wires frame-aware selection, drag, resize, hide/lock,
  and layer reorder through the new ops
- CanvasPanels: expandable layer tree with rename/reorder
- designGateway.submitGeneratorTask + GeneratorTaskSubmitResponse and
  bbox/generator_name artifact metadata in the domain
- ArtboardPreview shows a working state for generating frame layers
- i18n: expandLayer / renameLayer / layerTitlePlaceholder; styles

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 12:27:00 +08:00
root 039d166972 feat(server): add layer-separation generator task
Introduce the `layer-separation` generator (edit-elements node action)
that splits a source image into a clean background layer, foreground
image artifacts with bounding boxes, and editable text render data.

- New layer_separation.go builds the separated result and artifacts
- SubmitGeneratorTask routes layer-separation and move-object via a
  switch; standalone task completion + polling support
- Extend artifact metadata with BBox and GeneratorName across the
  domain, API types, mapper, .api schema, and API.md
- edit-elements gets a transparent manual-frame placeholder holding the
  separated foreground images and text layers beside the original

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 12:26:43 +08:00
root 676e1c4c67 fix(canvas): start selection title rename on single click
Switch the editable selection title from onDoubleClick to onClick so
renaming a node/layer title begins with a single click.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 12:26:26 +08:00
root 299bac6c1a feat(piagent): fall back to concurrent single-image requests when count unsupported
Some image endpoints reject the `n` count parameter (Unknown parameter
tools[0].n / param: n). Detect that error and re-issue the batch as
concurrent count=1 requests, each with a suffixed idempotency key, then
assemble the URLs into a single GeneratedImage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 12:26:17 +08:00
root 568690e2f1 fix(server): widen letter-spacing normalization bounds to ±256
Negative and larger letter spacing values are legitimate for extracted
text layers; clamp only outside ±256 instead of rejecting anything
below 0 (or above 80 in the extractor).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 12:26:08 +08:00
root 906846a717 style(ui): widen image generator model button to 180px
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 09:05:55 +08:00
root 4f2825bb8e feat(ui): localize friendly agent errors and surface them as toasts
Thread a translate function through friendlyAgentErrorMessage/
friendlyProjectFailureMessage and move the hard-coded zh-CN error copy
into the i18n locale files (with a zh-CN fallback map). Generation
stream failures now report through a toast via showGenerationError in
addition to setError, so the removed inline .panel-error footer is
gone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 09:05:44 +08:00
root 3eae2beb12 feat(canvas): clone generator placeholders and place batch results as siblings
When an image-generator target requests multiple images, duplicate the
target placeholder into N generating clones and lay them out beside the
target. Incremental results after the first are appended as siblings
rather than merged into the target, and placeholder cleanup now clears
the target's generating clones on failure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 09:05:33 +08:00
root cc30ae4284 feat(piagent): batch-generate images in one call when generators share a prompt
When multiple image-generator tasks carry the same brief, request all
images from a single GPT Image call with Count=N instead of firing one
call per image. Adds directImageBatchCount/Prompt detection, batch
(incremental) generation paths, and folds the planned count into the
idempotency key. Disables the streaming plan probe for multi-image
requests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 09:05:18 +08:00
root 8a28a0bcea perf(canvas): slow generator task poll interval to 5s
Reduce polling pressure on the generator task status endpoint by raising
the client poll interval from 3s to 5s.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 02:20:33 +08:00
root a5a35648d7 fix(server): complete generator task when thread settles or project ready
Treat a generator task as completed when it produces artifacts, when a
task message reaches a terminal state, or when the project is ready —
even if the project is still exploring another concurrent thread. Adds
generatorTaskMessageCompleted to classify terminal task messages and
covers ready-without-messages and concurrent-thread cases with tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 02:20:23 +08:00
root 94718553c6 feat(ui): redesign image generator floating composer and settings panel
Compact the floating composer with an auto-resizing prompt editor and a
scrollable settings popover, add a titled settings panel, and show the
resolved image size in the settings summary. Add the imageCountLabel
string for the count section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 01:46:24 +08:00
root cbf4e21e2b feat(canvas): per-generator target size, placement and draft preservation
Persist each image-generator node's target resolution in metadata and
surface it in the selection frame and node preview. Place new generators
without overlapping existing ones, keep local draft generators when a
compressed snapshot omits them, and add a dedicated selection-frame
variant plus scale-aware preview styling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 01:46:16 +08:00
root 82683c40ea refactor(canvas): support multiple concurrent image generator streams
Track image-generator streams in a keyed Map/Set instead of a single ref
so several placeholders can generate at once without cancelling each
other. Generating state is derived from the number of open streams.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 01:46:07 +08:00
root 453de420fc fix(ui): show real contents in optimistic image messages and widen settings chip
Use the user-visible contents (without injected image-mode settings) for the
optimistic agent messages so the settings blob is not echoed in the thread.
Widen the composer settings chip to 150px so longer labels are not clipped.
Also picks up regenerated next-env.d.ts and tsbuildinfo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 01:10:17 +08:00
root 9a07f863ea fix(design): preserve existing canvas nodes when compressed snapshot omits them
SaveCanvas treated a nil Nodes/Connections slice from a compressed snapshot
as an empty canvas, wiping existing content. Distinguish nil (field omitted,
keep the project's current nodes/connections) from an explicit empty slice.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 01:10:07 +08:00
root ffd8d78df7 feat(piagent): bypass planner for direct image generation modes
For image / pure-image / image-generator / image-action modes, skip the
task-planning round trip and hand the prompt straight to the image model,
deriving the requested image count from the composer settings. Also
normalize completed image-generator nodes back into regular image nodes
(clearing the image-generator layer role and defaulting Tone to "visual")
when merging generated results and when restoring finished nodes, so a
finished generator node is not re-appended as a duplicate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 01:09:59 +08:00