From 809364ecbed9119003ea8e4dbb9325850d704ccf Mon Sep 17 00:00:00 2001
From: brother7 <7brother7@gmail.com>
Date: Wed, 12 Aug 2026 20:45:24 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20AI=20=E8=AE=BE?=
=?UTF-8?q?=E8=AE=A1=E5=9B=BE=E7=94=9F=E5=9B=BE=E9=80=89=E5=9B=BE=E4=BA=A4?=
=?UTF-8?q?=E4=BA=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...60812-design-image-to-image-client-c91e.md | 92 +++++++++++
README.md | 4 +-
src/pages/ImageCanvas/index.tsx | 125 ++++++++-------
tests/unit/image-canvas-page.test.tsx | 148 ++++++++++++++++++
4 files changed, 312 insertions(+), 57 deletions(-)
create mode 100644 .project-docs/30-worklog/tasks/20260812-design-image-to-image-client-c91e.md
diff --git a/.project-docs/30-worklog/tasks/20260812-design-image-to-image-client-c91e.md b/.project-docs/30-worklog/tasks/20260812-design-image-to-image-client-c91e.md
new file mode 100644
index 0000000..2e7465c
--- /dev/null
+++ b/.project-docs/30-worklog/tasks/20260812-design-image-to-image-client-c91e.md
@@ -0,0 +1,92 @@
+# Task: 支持 AI Design 图生图选图交互
+
+## Identity
+
+- Task ID: 20260812-design-image-to-image-client-c91e
+- Mode: Feature
+- Branch: codex/20260812-design-image-to-image-client-c91e-design-image-to-image
+- Worktree: D:\Datas\OthersProjects\makelore-design-image-to-image-client-c91e
+- Base commit: 3a80625fe2fb74ab4e0a883188a52eade8cd23b9
+- Owner: codex
+- Status: Completed
+
+## Scope
+
+- Generalize the existing video-first-frame picker into a single-image source
+ picker that supports both image reference generation and video first frames.
+- Reuse existing workspace generated-image selection, local upload and
+ `attachmentAssetIds` transport without adding a parallel upload path.
+- Send medium-correct user intent text to the Design Agent and cover both
+ interactions with focused page tests.
+
+## Intent And Constraints
+
+- Image-to-image accepts exactly one image from the current workspace or one
+ local upload; task and asset ownership remain Workspace-scoped.
+- Do not alter Workspace / Conversation / Task ownership or event routing.
+- Preserve the currently deployed string quick-reply trigger for compatibility,
+ while removing video-only labels and submission semantics from the picker.
+- A structured picker action is preferable long-term, but is outside this
+ server-compatible increment and is recorded as a follow-up.
+
+## Outcome
+
+- The former video-only first-frame dialog is now a reusable single-image source
+ picker. For an image Brief it presents “选择图生图参考图” and sends one selected
+ Workspace result Asset or one uploaded Asset through the existing
+ `attachmentAssetIds` Turn transport; for a video Brief it retains the original
+ first-frame wording and behavior.
+- The picker closes as soon as a completed work is selected and after a local
+ upload succeeds, while request failures continue to surface through the
+ existing design-conversation error path.
+- Only an explicit `brief.medium === 'image'` selects image-reference semantics;
+ `video`, null and missing medium values default to the historical video
+ behavior for compatibility with delayed or older server snapshots.
+- The deployed exact quick reply “从作品列表选择图片” remains supported. README
+ now documents text-to-image, single-reference image-to-image, project-work
+ selection and local upload; no parallel upload API or client state model was
+ introduced.
+
+## Verification
+
+- `pnpm exec vitest run tests/unit/image-canvas-page.test.tsx`: `25 passed`.
+- `pnpm run typecheck`: passed.
+- `pnpm exec eslint src/pages/ImageCanvas/index.tsx
+ tests/unit/image-canvas-page.test.tsx`: passed.
+- `pnpm run build:vite`: passed; only the repository's existing dynamic-import
+ and chunk-size warnings were emitted.
+- `git diff --check`: passed.
+- Independent read-only Sol review: `PASS`, with no P0-P3 findings after
+ inspecting both the client and matching server diffs; the reviewer reran this
+ 25-test page suite.
+- No packaged desktop smoke or live Works Square provider request was performed.
+
+## Follow-ups
+
+- Evolve `DesignMessage.quickReplies` from display-only strings to structured
+ entries such as `select_image_asset` plus
+ `image_reference | video_first_frame`. The current release preserves the
+ deployed exact Chinese string for compatibility, but localization or wording
+ changes remain coupled to behavior until the protocol evolves.
+- Add a first-class “remove reference image” control if the server introduces an
+ explicit clear-source action; omission of an attachment must not implicitly
+ clear a Conversation's frozen reference.
+
+## Promotion Candidates
+
+- Target canonical documents: `20-architecture/system-overview.md`,
+ `20-architecture/module-map.md`, `20-architecture/data-flow.md`, and
+ `40-domain/business-rules.md`. Proposal: record the generalized single-image
+ source picker, its single-Asset attachment boundary, medium-specific intent,
+ and null-medium video compatibility fallback. Evidence: the 25 focused page
+ tests plus typecheck, scoped ESLint and production build listed above. Future
+ impact: future picker redesigns must preserve Workspace ownership and attach
+ one real Asset ID rather than relying on a visual description. No semantic
+ conflict; canonical promotion belongs to a serialized Integration task.
+- Target canonical ADR/protocol documentation: the accepted AI Design
+ Conversation/Gateway contract. Proposal: replace localized quick-reply string
+ matching with a structured picker action before adding more asset-input
+ purposes. Evidence: one display string now intentionally opens both image and
+ video source flows, with purpose inferred from current Brief medium. Future
+ impact: removes localization and delayed-state coupling. This is a future
+ protocol change and requires coordinated server/client design confirmation.
diff --git a/README.md b/README.md
index 96c9009..b80ef1b 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
Makelore 是一个面向软件与视觉创作的 AI 桌面工作台。当前版本为 `2.0.0`,包含两个已开通产品模块,并保留一个学习模块入口:
- `Makelore Code|AI 编程`:管理本地项目、项目 Agent、会话、文件上下文、代码变更和运行时,并为服务端可运行版本提供真机扫码预览。
-- `Makelore Canvas|AI 绘画`:以设计项目(Workspace)组织 Agent 对话、方向确认、图片/视频生成任务和私有结果。
+- `Makelore Canvas|AI 绘画`:以设计项目(Workspace)组织 Agent 对话、方向确认、文生图、单参考图生图、视频生成任务和私有结果;参考图可从当前项目作品选择或从本地上传。
- `Makelore Learning|AI 学习`:数学与知识宇宙主题的学习入口,当前暂未开通;开屏页和模块切换菜单保留置灰入口,不能进入。
作品广场、素材广场、独立发布上传和云部署页面不属于 Makelore 2.0 工作台。新建项目可选择“小游戏”“小程序”或“自定义项目”:小游戏和小程序会创建完整的平台发布模板,项目配置底部提供“一键提交审核”;Main 自动预检、安全打包并提交,构建通过后进入运营审核,审核通过即直接发布。自定义项目只创建工作空间,不配置默认发布方式。项目成果预览 `/deliverables` 继续保留。
@@ -17,7 +17,7 @@ Makelore 是一个面向软件与视觉创作的 AI 桌面工作台。当前版
- 共享开发浏览器:AI 编程右侧提供项目级浏览器,用户与 Agent 查看并调试同一实时页面、Console 和 Network,支持本地与公网开发地址。
- 真机预览:AI 编程项目空间可读取当前静态 Release 状态;待审版本使用短时预览地址,已发布版本使用同源 HTTPS `play_url`,供手机直接测试触控、屏幕和移动网络环境。
- 后端边界:Renderer 通过 Main 所有的 Host API 访问认证、模型、同步、更新、语音、图像与运行时能力。
-- AI 绘画:每个设计项目固定一个设计 Agent,并可包含多条互相独立的设计会话。消息、Brief、Quote 和 `turnRevision` 属于 Conversation;图片/视频生成任务与资产属于 Workspace,切换或新建会话不会创建新项目,也不会隐藏项目任务。每条 Conversation 复用服务端持久 Agent Gateway Session,任务进度通过实时流推送并在统一列表中展示,断流时使用低频 REST 同步。生产环境使用 Works Square 云端 Workspace 契约,上游不可用时明确报错。
+- AI 绘画:每个设计项目固定一个设计 Agent,并可包含多条互相独立的设计会话。消息、Brief、Quote 和 `turnRevision` 属于 Conversation;图片/视频生成任务与资产属于 Workspace,切换或新建会话不会创建新项目,也不会隐藏项目任务。图片创作既支持文生图,也支持从当前项目已完成作品或本地上传中选择一张参考图继续生成;视频沿用同一单图选择器绑定首帧。每条 Conversation 复用服务端持久 Agent Gateway Session,任务进度通过实时流推送并在统一列表中展示,断流时使用低频 REST 同步。生产环境使用 Works Square 云端 Workspace 契约,上游不可用时明确报错。
- 视觉系统:单一浅色主题,品牌蓝 `#3A5578`、星火橙 `#F26A3D`、白色画布与低饱和蓝灰层级。
- 品牌资产:生产 SVG、PNG、应用图标、托盘图标与安装器视觉位于 [`resources/brand/`](resources/brand/README.md) 和 `resources/icons/`。
diff --git a/src/pages/ImageCanvas/index.tsx b/src/pages/ImageCanvas/index.tsx
index a733fd3..7cb4f68 100644
--- a/src/pages/ImageCanvas/index.tsx
+++ b/src/pages/ImageCanvas/index.tsx
@@ -78,7 +78,7 @@ const GENERATION_CONFIRMATION_INTENTS = new Set([
'确认开始制作',
'确认并开始制作',
]);
-const VIDEO_FIRST_FRAME_PICKER_REPLY = '从作品列表选择图片';
+const IMAGE_SOURCE_PICKER_REPLY = '从作品列表选择图片';
function isGenerationConfirmationIntent(message: string): boolean {
const normalized = message.trim().replace(/[\s,,。.!!??、]/g, '');
@@ -259,7 +259,7 @@ function AssetPreview({ asset }: { asset: DesignAsset }) {
);
}
-function FirstFrameAssetOption({
+function ImageSourceAssetOption({
asset,
busy,
onSelect,
@@ -424,10 +424,10 @@ export function ImageCanvas() {
const [submittingConversationId, setSubmittingConversationId] = useState(null);
const [confirmingQuoteId, setConfirmingQuoteId] = useState(null);
const [actionError, setActionError] = useState(null);
- const [firstFramePickerOpen, setFirstFramePickerOpen] = useState(false);
- const [firstFrameBusyKey, setFirstFrameBusyKey] = useState(null);
- const [firstFrameError, setFirstFrameError] = useState(null);
- const [uploadedFirstFrameAsset, setUploadedFirstFrameAsset] = useState(null);
+ const [imageSourcePickerOpen, setImageSourcePickerOpen] = useState(false);
+ const [imageSourceBusyKey, setImageSourceBusyKey] = useState(null);
+ const [imageSourceError, setImageSourceError] = useState(null);
+ const [uploadedImageSourceAsset, setUploadedImageSourceAsset] = useState(null);
const conversationEndRef = useRef(null);
const quote = useMemo(
@@ -435,20 +435,21 @@ export function ImageCanvas() {
[conversation],
);
const generationAvailable = bootstrap?.capabilities.generation ?? false;
- const firstFrameAssets = useMemo(
+ const imageSourceAssets = useMemo(
() => {
const assets = tasks
.filter((task) => task.status === 'succeeded')
.flatMap((task) => task.resultAssets)
.filter((asset) => asset.mediaType === 'image' && asset.mimeType === 'image/png');
- if (uploadedFirstFrameAsset
- && uploadedFirstFrameAsset.workspaceId === workspace?.workspaceId) {
- assets.unshift(uploadedFirstFrameAsset);
+ if (uploadedImageSourceAsset
+ && uploadedImageSourceAsset.workspaceId === workspace?.workspaceId) {
+ assets.unshift(uploadedImageSourceAsset);
}
return [...new Map(assets.map((asset) => [asset.assetId, asset])).values()];
},
- [tasks, uploadedFirstFrameAsset, workspace?.workspaceId],
+ [tasks, uploadedImageSourceAsset, workspace?.workspaceId],
);
+ const selectingImageReference = conversation?.brief.medium === 'image';
const conversationMessages = useMemo(() => {
if (!conversation) return [];
const messages: RenderedDesignMessage[] = [...conversation.messages];
@@ -499,8 +500,8 @@ export function ImageCanvas() {
setPrompt('');
setActionError(null);
setConfirmingQuoteId(null);
- setFirstFramePickerOpen(false);
- setFirstFrameError(null);
+ setImageSourcePickerOpen(false);
+ setImageSourceError(null);
}, [taskConversationId]);
useEffect(() => {
@@ -569,17 +570,22 @@ export function ImageCanvas() {
void handleSend();
};
- const handleFirstFrameSelect = async (asset: DesignAsset) => {
- if (!workspace || !conversation || submitting || firstFrameBusyKey) return;
+ const handleImageSourceSelect = async (asset: DesignAsset) => {
+ if (!workspace || !conversation || submitting || imageSourceBusyKey) return;
const requestedWorkspaceId = workspace.workspaceId;
const requestedConversationId = conversation.conversationId;
- setFirstFrameBusyKey(asset.assetId);
- setFirstFrameError(null);
+ setImageSourceBusyKey(asset.assetId);
+ setImageSourceError(null);
setActionError(null);
setSubmittingConversationId(requestedConversationId);
- setFirstFramePickerOpen(false);
+ setImageSourcePickerOpen(false);
try {
- await sendMessage('使用作品图片作为视频首帧', [asset.assetId]);
+ await sendMessage(
+ selectingImageReference
+ ? '使用作品图片作为图生图参考图'
+ : '使用作品图片作为视频首帧',
+ [asset.assetId],
+ );
} catch (error) {
const current = useImageWorkspaceStore.getState();
if (current.activeWorkspaceId === requestedWorkspaceId
@@ -587,39 +593,44 @@ export function ImageCanvas() {
setActionError(error instanceof Error ? error.message : String(error));
}
} finally {
- setFirstFrameBusyKey(null);
+ setImageSourceBusyKey(null);
setSubmittingConversationId((current) => (
current === requestedConversationId ? null : current
));
}
};
- const handleFirstFrameUpload = async (event: ChangeEvent) => {
+ const handleImageSourceUpload = async (event: ChangeEvent) => {
const file = event.currentTarget.files?.[0];
event.currentTarget.value = '';
- if (!workspace || !conversation || !file || submitting || firstFrameBusyKey) return;
+ if (!workspace || !conversation || !file || submitting || imageSourceBusyKey) return;
const requestedWorkspaceId = workspace.workspaceId;
const requestedConversationId = conversation.conversationId;
- setFirstFrameBusyKey('upload');
- setFirstFrameError(null);
+ setImageSourceBusyKey('upload');
+ setImageSourceError(null);
setSubmittingConversationId(requestedConversationId);
try {
const asset = await uploadImageWorkspaceAsset(requestedWorkspaceId, file);
- setUploadedFirstFrameAsset(asset);
- await sendMessage('使用上传的图片作为视频首帧', [asset.assetId]);
+ setUploadedImageSourceAsset(asset);
+ await sendMessage(
+ selectingImageReference
+ ? '使用上传图片作为图生图参考图'
+ : '使用上传的图片作为视频首帧',
+ [asset.assetId],
+ );
const current = useImageWorkspaceStore.getState();
if (current.activeWorkspaceId === requestedWorkspaceId
&& current.activeConversationId === requestedConversationId) {
- setFirstFramePickerOpen(false);
+ setImageSourcePickerOpen(false);
}
} catch (error) {
const current = useImageWorkspaceStore.getState();
if (current.activeWorkspaceId === requestedWorkspaceId
&& current.activeConversationId === requestedConversationId) {
- setFirstFrameError(error instanceof Error ? error.message : String(error));
+ setImageSourceError(error instanceof Error ? error.message : String(error));
}
} finally {
- setFirstFrameBusyKey(null);
+ setImageSourceBusyKey(null);
setSubmittingConversationId((current) => (
current === requestedConversationId ? null : current
));
@@ -837,9 +848,9 @@ export function ImageCanvas() {
size="sm"
className="h-8 rounded-full px-3 text-xs font-semibold"
onClick={() => {
- if (reply === VIDEO_FIRST_FRAME_PICKER_REPLY) {
- setFirstFrameError(null);
- setFirstFramePickerOpen(true);
+ if (reply === IMAGE_SOURCE_PICKER_REPLY) {
+ setImageSourceError(null);
+ setImageSourcePickerOpen(true);
return;
}
if (!isGenerationConfirmationIntent(reply)) {
@@ -935,19 +946,23 @@ export function ImageCanvas() {
- {firstFrameError ? (
+ {imageSourceError ? (
- {firstFrameError}
+ {imageSourceError}
) : null}
- {firstFrameAssets.length > 0 ? (
+ {imageSourceAssets.length > 0 ? (
- {firstFrameAssets.map((asset) => (
- (
+ void handleFirstFrameSelect(asset)}
+ busy={Boolean(imageSourceBusyKey)}
+ onSelect={() => void handleImageSourceSelect(asset)}
/>
))}
diff --git a/tests/unit/image-canvas-page.test.tsx b/tests/unit/image-canvas-page.test.tsx
index 407ee84..dbf7f59 100644
--- a/tests/unit/image-canvas-page.test.tsx
+++ b/tests/unit/image-canvas-page.test.tsx
@@ -711,11 +711,152 @@ describe('ImageCanvas Workspace-first design experience', () => {
expect(sendImageWorkspaceMessageMock).not.toHaveBeenCalled();
});
+ it('keeps the historical video picker behavior when the brief medium is not decided yet', async () => {
+ fetchImageWorkspaceConversationMock.mockResolvedValueOnce({
+ ...conversationFixture(),
+ phase: 'shaping',
+ brief: {
+ version: 2,
+ status: 'draft',
+ medium: null,
+ summary: '',
+ ready: false,
+ missingDecision: '请选择首帧来源',
+ },
+ messages: [
+ ...conversationFixture().messages,
+ {
+ id: 'message-undecided-source',
+ role: 'assistant',
+ kind: 'choice',
+ text: '请选择视频首帧来源。',
+ quickReplies: ['从作品列表选择图片'],
+ generationQuote: null,
+ turnRevision: 2,
+ createdAt: '2026-08-12T09:00:00Z',
+ },
+ ],
+ turnRevision: 2,
+ } satisfies DesignConversation);
+ render();
+
+ fireEvent.click(await screen.findByRole('button', { name: '从作品列表选择图片' }));
+ const picker = screen.getByRole('dialog', { name: '选择视频首帧' });
+ const selectButton = within(picker).getByRole('button', { name: '选择此图片' });
+ await waitFor(() => expect(selectButton).toBeEnabled());
+ fireEvent.click(selectButton);
+
+ await waitFor(() => expect(sendImageWorkspaceMessageMock).toHaveBeenCalledWith(
+ 'workspace-cloud',
+ 'conversation-cloud',
+ 2,
+ '使用作品图片作为视频首帧',
+ expect.stringMatching(/^turn-/),
+ ['asset-one'],
+ ));
+ expect(screen.queryByRole('dialog', { name: '选择视频首帧' }))
+ .not.toBeInTheDocument();
+ });
+
+ it('opens the image reference picker and submits a successful work Asset id', async () => {
+ fetchImageWorkspaceConversationMock.mockResolvedValueOnce({
+ ...conversationFixture(),
+ phase: 'shaping',
+ brief: {
+ version: 2,
+ status: 'draft',
+ medium: 'image',
+ summary: '参考海洋公益海报生成新图',
+ ready: false,
+ missingDecision: '请选择参考图来源',
+ },
+ messages: [
+ ...conversationFixture().messages,
+ {
+ id: 'message-image-source',
+ role: 'assistant',
+ kind: 'choice',
+ text: '请选择图生图参考图。',
+ quickReplies: ['从作品列表选择图片'],
+ generationQuote: null,
+ turnRevision: 2,
+ createdAt: '2026-08-12T09:00:00Z',
+ },
+ ],
+ turnRevision: 2,
+ } satisfies DesignConversation);
+ render();
+
+ fireEvent.click(await screen.findByRole('button', { name: '从作品列表选择图片' }));
+ const picker = screen.getByRole('dialog', { name: '选择图生图参考图' });
+ expect(within(picker).getByText(/作为图生图参考/)).toBeInTheDocument();
+ const selectButton = within(picker).getByRole('button', { name: '选择此图片' });
+ await waitFor(() => expect(selectButton).toBeEnabled());
+ fireEvent.click(selectButton);
+
+ await waitFor(() => expect(sendImageWorkspaceMessageMock).toHaveBeenCalledWith(
+ 'workspace-cloud',
+ 'conversation-cloud',
+ 2,
+ '使用作品图片作为图生图参考图',
+ expect.stringMatching(/^turn-/),
+ ['asset-one'],
+ ));
+ expect(screen.queryByRole('dialog', { name: '选择图生图参考图' }))
+ .not.toBeInTheDocument();
+ });
+
+ it('uploads a local image reference and submits its Asset id to the Agent', async () => {
+ fetchImageWorkspaceConversationMock.mockResolvedValueOnce({
+ ...conversationFixture(),
+ messages: [
+ ...conversationFixture().messages,
+ {
+ id: 'message-image-source',
+ role: 'assistant',
+ kind: 'choice',
+ text: '请选择图生图参考图。',
+ quickReplies: ['从作品列表选择图片'],
+ generationQuote: null,
+ turnRevision: 2,
+ createdAt: '2026-08-12T09:00:00Z',
+ },
+ ],
+ turnRevision: 2,
+ } satisfies DesignConversation);
+ render();
+ fireEvent.click(await screen.findByRole('button', { name: '从作品列表选择图片' }));
+ const picker = screen.getByRole('dialog', { name: '选择图生图参考图' });
+ const file = new File(['image-bytes'], 'reference.png', { type: 'image/png' });
+
+ fireEvent.change(within(picker).getByLabelText('上传本地图片'), {
+ target: { files: [file] },
+ });
+
+ await waitFor(() => expect(uploadImageWorkspaceAssetMock)
+ .toHaveBeenCalledWith('workspace-cloud', file));
+ await waitFor(() => expect(sendImageWorkspaceMessageMock).toHaveBeenCalledWith(
+ 'workspace-cloud',
+ 'conversation-cloud',
+ 2,
+ '使用上传图片作为图生图参考图',
+ expect.stringMatching(/^turn-/),
+ ['asset-uploaded'],
+ ));
+ await waitFor(() => expect(
+ screen.queryByRole('dialog', { name: '选择图生图参考图' }),
+ ).not.toBeInTheDocument());
+ });
+
it('submits a successful work Asset id when it is selected as the video first frame', async () => {
const pendingSelection = deferred();
sendImageWorkspaceMessageMock.mockReturnValueOnce(pendingSelection.promise);
fetchImageWorkspaceConversationMock.mockResolvedValueOnce({
...conversationFixture(),
+ brief: {
+ ...conversationFixture().brief,
+ medium: 'video',
+ },
turnRevision: 2,
messages: [
...conversationFixture().messages,
@@ -759,6 +900,10 @@ describe('ImageCanvas Workspace-first design experience', () => {
it('uploads a local first-frame image and submits its Asset id to the Agent', async () => {
fetchImageWorkspaceConversationMock.mockResolvedValueOnce({
...conversationFixture(),
+ brief: {
+ ...conversationFixture().brief,
+ medium: 'video',
+ },
messages: [
...conversationFixture().messages,
{
@@ -793,6 +938,9 @@ describe('ImageCanvas Workspace-first design experience', () => {
expect.stringMatching(/^turn-/),
['asset-uploaded'],
));
+ await waitFor(() => expect(
+ screen.queryByRole('dialog', { name: '选择视频首帧' }),
+ ).not.toBeInTheDocument());
});
it('renders policy-blocked generation tasks with a user-facing design message', async () => {
From 8e3d4a186d7c7a60b9639839e972c679426b1422 Mon Sep 17 00:00:00 2001
From: brother7 <7brother7@gmail.com>
Date: Thu, 13 Aug 2026 14:14:48 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=9B=BE=E7=94=9F?=
=?UTF-8?q?=E5=9B=BE=E5=AE=A2=E6=88=B7=E7=AB=AF=E4=B8=BB=E7=BA=BF=E9=9B=86?=
=?UTF-8?q?=E6=88=90=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...20260813-integrate-i2i-client-main-5d9e.md | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 .project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
diff --git a/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md b/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
new file mode 100644
index 0000000..e8e6623
--- /dev/null
+++ b/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
@@ -0,0 +1,54 @@
+# Task: Merge AI Design image-to-image into current client main
+
+## Identity
+
+- Task ID: 20260813-integrate-i2i-client-main-5d9e
+- Mode: Integration
+- Branch: codex/20260813-integrate-i2i-client-main-5d9e-integrate-i2i-client-main
+- Worktree: D:\Datas\OthersProjects\makelore-integrate-i2i-main-5d9e
+- Base commit: a03043d048826609cb4f8cb7d782bde93e0e77f4
+- Owner: codex
+- Status: In Progress
+
+## Scope
+
+- Integrate the already reviewed AI Design single-reference image-to-image client
+ change (`809364e`) onto the current client `main` baseline `a03043d`.
+- Preserve the already integrated local release-build and first-conversation
+ latency work while resolving any overlapping README, page, test, or canonical
+ documentation edits semantically.
+- Re-run the focused page suite, typecheck, scoped lint and Renderer build on the
+ resulting integration head, then obtain an independent read-only review.
+- Land the verified result on local `main` only if its existing updater task can
+ be left intact; never overwrite, stash, reset, or absorb that task's
+ uncommitted files.
+
+## Intent And Constraints
+
+- The picker continues to submit one real Workspace Asset ID through the
+ existing `attachmentAssetIds` transport; no parallel upload or local-file
+ description path is introduced.
+- Only `brief.medium === 'image'` selects image-reference semantics. `video`,
+ null and missing medium retain the historical video-first-frame behavior.
+- Preserve Workspace / Conversation / Task ownership from ADR-001 and keep
+ image/video tasks Workspace-scoped.
+- Preserve the deployed exact quick reply `从作品列表选择图片` for this compatible
+ increment; a structured action/purpose remains future protocol work.
+- Keep all Git and file mutations rooted in this isolated integration worktree
+ until the original `main` worktree is clean and ownership-safe.
+
+## Outcome
+
+- Not completed.
+
+## Verification
+
+- Not run.
+
+## Follow-ups
+
+- None recorded.
+
+## Promotion Candidates
+
+- None recorded.
From caabeff7adfdbe4be9a9d89073449149a1940ed7 Mon Sep 17 00:00:00 2001
From: brother7 <7brother7@gmail.com>
Date: Thu, 13 Aug 2026 14:20:29 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=87=E6=A1=A3=EF=BC=9A=E9=9B=86?=
=?UTF-8?q?=E6=88=90=E5=9B=BE=E7=94=9F=E5=9B=BE=E5=AE=A2=E6=88=B7=E7=AB=AF?=
=?UTF-8?q?=E5=A5=91=E7=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.project-docs/20-architecture/data-flow.md | 4 ++-
.project-docs/20-architecture/module-map.md | 5 +--
.../20-architecture/system-overview.md | 7 ++--
.project-docs/30-worklog/current-state.md | 7 ++--
...20260813-integrate-i2i-client-main-5d9e.md | 33 +++++++++++++++++--
.project-docs/40-domain/business-rules.md | 6 +++-
.project-docs/50-evidence/evidence-index.md | 1 +
.project-docs/80-commitments/commitments.md | 2 ++
8 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/.project-docs/20-architecture/data-flow.md b/.project-docs/20-architecture/data-flow.md
index 46004af..de12e42 100644
--- a/.project-docs/20-architecture/data-flow.md
+++ b/.project-docs/20-architecture/data-flow.md
@@ -16,6 +16,7 @@
| AI 编程模型代理错误 | OpenCode provider 请求 | Main Host AI proxy → Works 模型上游 | 配额耗尽保持独立终止态;只有明确的分组上游饱和才投影为 OpenCode 终止状态,通用限速仍保留 `429` |
| 设计会话创建/切换 | AI 绘画页面或侧栏 | Renderer API → Main → Workspace Conversation API | 新会话属于现有 Workspace;读取独立消息、Brief、Quote 和 `turnRevision` |
| 设计消息与确认 | 当前 Conversation | Main → 持久 Agent Gateway Session → Conversation 快照 | 请求和流式结果同时绑定 Workspace + Conversation |
+| 设计单图来源选择 | 当前 Workspace 已完成图片 / 本地图片 | 现有 Asset 上传或选择 → `attachmentAssetIds` → 当前 Conversation Turn | 图片 Brief 用作图生图参考图;视频 Brief 用作首帧;只提交一个真实 Workspace Asset ID |
| 设计任务同步 | 任一 Conversation 的事件流 / REST | Renderer Workspace 任务列表 | Task 和 Asset 按 Workspace 归并,切换 Conversation 后仍可见 |
## State Ownership
@@ -26,6 +27,7 @@
- 本地构建临时目录、HTTP origin 和预检 WebContents/partition 只属于一次调用;预检读取与 `built_archive` 相同的内存字节,但结果不写为可信上传 receipt,也不覆盖生产 opaque-origin。
- 旧 schema v1 `submitted` 记录迁移并保留;旧 `armed`、`waiting_for_package`、`waiting_for_login`、`uploading`、`failed` 归一为 `legacy_retired`,不再启动 watcher 或上传任务。
- AI 绘画 Conversation 持有消息、Brief、Quote、`turnRevision` 和服务端 Session 绑定;Workspace 持有 Conversation 列表、生成任务和资产。
+- 图生图参考图与视频首帧都先归一为当前 Workspace 的 Asset;从作品选择时复用生成结果 Asset,本地选择时先走既有上传接口,再把唯一 Asset ID 随 Turn 提交。选择或上传成功后关闭选择器。
- 本地开发适配器将旧单会话 schema v2 原子迁移为带默认 Conversation 的 schema v3;打包应用不使用该本地适配器作为云端失败回退。
- 注销和退出会关闭本地事件流并清除本机 Conversation Session-id 缓存;服务端持久 Session 保留,下一次访问从 Conversation API 重新读取。
- AI 编程 Store 的 `sessionMessagesBySessionId` own-key 是加载状态契约:键缺失表示历史未知,存在且值为 `[]` 表示已知为空。只有后者可使用不读取历史的快速选择;普通历史会话选择继续刷新消息。
@@ -41,4 +43,4 @@
## Last Updated
-2026-08-12
+2026-08-13
diff --git a/.project-docs/20-architecture/module-map.md b/.project-docs/20-architecture/module-map.md
index a25a738..ab86c1e 100644
--- a/.project-docs/20-architecture/module-map.md
+++ b/.project-docs/20-architecture/module-map.md
@@ -25,7 +25,7 @@
| `electron/image-workspace/works-square-workspace.ts` | Works Square 多 Conversation 云端适配器与 Gateway 事件映射 | 使用服务端持久 Session;本地清理不 DELETE 远端 Session |
| `electron/image-workspace/local-workspace.ts` | 未打包开发模式的本地 Workspace 适配器和 v2→v3 迁移 | 仅开发使用,不得成为打包回退 |
| `src/stores/image-workspace.ts` | 当前 Workspace/Conversation、项目任务及流式更新状态 | 异步结果按 Workspace + Conversation generation/revision 防护 |
-| `src/pages/ImageCanvas/index.tsx` | Conversation 对话、Quote 确认、统一任务列表与新会话入口 | Enter 发送、Shift+Enter 换行、IME 保护 |
+| `src/pages/ImageCanvas/index.tsx` | Conversation 对话、Quote 确认、统一任务列表、新会话入口与单图来源选择器 | 图片 Brief 选择/上传图生图参考图;视频 Brief 绑定首帧;均提交一个 Workspace Asset ID |
| `src/components/layout/ImageWorkspaceSidebar.tsx` | Workspace 与近期 Conversation 切换/创建 | 切换会话不清空项目级任务 |
## Dependency Direction
@@ -45,7 +45,8 @@
- `ai-proxy.ts` 的上游饱和状态投影依赖当前固定 OpenCode 的重试语义和窄化错误文案;升级 runtime 或调整上游错误格式时必须复核,不能把所有 `429` 统一终止。
- 多 Conversation 事件处理必须区分对话快照与 Workspace 任务更新;不得用任务时间戳推进 Conversation 流水位,也不得让旧会话的迟到流覆盖当前会话。
- `closeEventSessions` 只负责本地流和缓存生命周期;远端 Conversation Session 是服务端持久资源。
+- 单图来源选择器当前仍由精确中文 quick reply 触发,并以 Brief medium 判断图生图或视频首帧用途;扩展更多输入用途前应先把消息协议升级为结构化 action/purpose,避免展示文案与行为继续耦合。
## Last Updated
-2026-08-12
+2026-08-13
diff --git a/.project-docs/20-architecture/system-overview.md b/.project-docs/20-architecture/system-overview.md
index 62e4759..a35d766 100644
--- a/.project-docs/20-architecture/system-overview.md
+++ b/.project-docs/20-architecture/system-overview.md
@@ -19,6 +19,7 @@ Makelore 是 Electron 桌面客户端。Renderer 负责项目操作与状态展
| Built Artifact Preflight | 在上传前对最终 built snapshot 做桌面/移动 UX fail-fast | Main 使用临时 loopback origin 与 Electron WebContents/CDP;不使用 Playwright、不生成可信证明 |
| AI Design Workspace | 保存项目身份、Conversation 列表、生成任务和资产 | 任务和资产在切换 Conversation 后继续可见 |
| AI Design Conversation | 保存消息、Brief、Quote、`turnRevision` 与服务端 Agent Session 绑定 | 同一 Workspace 内互相隔离;Session 由服务端持久化 |
+| AI Design Image Source Picker | 当前 Workspace 已完成图片或本地上传 | 图片 Brief 绑定图生图参考图;视频 Brief 绑定首帧;提交一个真实 Asset ID |
| AI Design Event Routing | Main 云端适配器 → Host API/SSE → Renderer store | Conversation 更新按 Workspace + Conversation 路由;任务更新按 Workspace 归并 |
## Important Boundaries
@@ -37,11 +38,13 @@ Makelore 是 Electron 桌面客户端。Renderer 负责项目操作与状态展
- AI 绘画中,一个 Workspace 可包含多条 Conversation;消息、Brief、Quote 和 `turnRevision` 属于 Conversation,生成任务和资产属于 Workspace。新建 Conversation 不得隐式创建新 Workspace。
- 每条 Conversation 复用服务端持久 Agent Gateway Session。客户端不得在注销或退出时 DELETE 该 Session;只关闭本地事件流并清除本机 Session-id 缓存,重新访问时从 Conversation API 刷新。
- Renderer 的异步与流式状态必须同时校验 Workspace + Conversation 身份;项目任务事件只按 Workspace 归并,避免切换会话时丢失任务或接收迟到消息。
+- 图片与视频复用同一个单图来源选择器。图片 Brief 可从当前 Workspace 的已完成作品或本地上传中选择一张参考图继续生成;视频 Brief 使用同一入口绑定首帧。两条路径都必须通过现有 Workspace Asset 上传/选择契约提交一个真实 `attachmentAssetIds`,不得用本地路径或自然语言描述代替资产身份。
+- 当前兼容协议仍通过精确 quick reply `从作品列表选择图片` 打开选择器,并由当前 Brief medium 区分用途;仅 `medium === image` 使用图生图语义,`video`、null 或缺失 medium 保持视频首帧语义。该展示文案耦合不得扩散到更多用途,后续应升级为结构化 action/purpose。
## Related Decisions
-- 当前长期边界记录于 README、ADR-001、集成任务 `20260807-integrate-login-client-a4f8`、源任务 `20260810-static-release-only-a91c`、`20260812-client-built-release-makelore-7e5b` 及本次 Integration Gate;后续如改变唯一入口、凭据所有权、构建执行边界、Conversation 状态归属或重新引入客户端部署协调器,应新增 ADR。
+- 当前长期边界记录于 README、ADR-001、集成任务 `20260807-integrate-login-client-a4f8`、源任务 `20260810-static-release-only-a91c`、`20260812-client-built-release-makelore-7e5b`、`20260812-design-image-to-image-client-c91e` 及本次 Integration Gate;后续如改变唯一入口、凭据所有权、构建执行边界、Conversation 状态归属或重新引入客户端部署协调器,应新增 ADR。
## Last Updated
-2026-08-12
+2026-08-13
diff --git a/.project-docs/30-worklog/current-state.md b/.project-docs/30-worklog/current-state.md
index 7fbd233..4558ca0 100644
--- a/.project-docs/30-worklog/current-state.md
+++ b/.project-docs/30-worklog/current-state.md
@@ -13,12 +13,13 @@ This file is the integrated default-branch snapshot. Feature tasks record progre
- `926056a`:Makelore 内置 Electron WebContents/CDP 发布前本地预览检查。
- `5b44864`:Main-owned 本地 npm/Vite 构建、同字节 Electron 双视口预检、source+built 双归档与 artifact contract 上传。
- `08da976` / `0ee5254`:AI 编程首次发送已知空 session 快速路径与明确上游饱和终止态投影。
+- `809364e` / `88281b8`:AI 绘画单参考图图生图选择/上传交互及其在最新客户端主线上的集成提交。
## Current Focus
客户端面向非专业用户提供“创建小游戏或小程序 → 项目配置中一键提交 → Main 本地 npm/Vite 构建 → Electron 双视口预检最终产物 → 上传 source+built 双归档与 contract → 运营审核”的唯一创建者链路。Main 对安全源码快照运行安装包内固定 npm 11.6.2 的 `npm ci --ignore-scripts`,再显式调用项目 `package-lock.json` 锁定的 Vite;Vite config/plugins 以当前桌面用户权限执行,因此只适用于用户信任的本地项目,不是 sandbox。预检由 Main 以临时 loopback origin 和 Electron WebContents/CDP 检查与最终 `built_archive` 相同的内存文件字节,覆盖桌面/移动视口、运行错误、白屏和外域访问;不使用 Playwright。该检查仍可由非官方客户端绕过,不产生可信 receipt,也不复刻生产 opaque-origin。服务端不再替客户端运行项目 Vite,而是把源码、构建归档和 contract 视为不可信输入,逐字节重算与校验并固化不可变 Release;人工审核仍不可绕过。自定义和缺少类型字段的旧项目不提供该入口。已发布作品优先使用安全投影后的 `play_url`,`runtime_url` 仅保留一个客户端版本的兼容回退。
-AI 绘画的一个 Workspace 可包含多条 Conversation。消息、Brief、Quote 和 `turnRevision` 随 Conversation 隔离;生成任务和资产保持 Workspace 级共享。每条 Conversation 使用服务端持久 Agent Gateway Session,切换会话只重连对应事件流。
+AI 绘画的一个 Workspace 可包含多条 Conversation。消息、Brief、Quote 和 `turnRevision` 随 Conversation 隔离;生成任务和资产保持 Workspace 级共享。图片 Brief 支持文生图,以及从当前项目已完成作品或本地上传中选择一张参考图继续生成;视频复用同一选择器绑定首帧。两条路径都通过现有 Workspace Asset 契约提交一个真实 Asset ID。每条 Conversation 使用服务端持久 Agent Gateway Session,切换会话只重连对应事件流。
AI 编程首次发送在新建 OpenCode session 已知为空时不再等待冗余历史读取,prompt 可直接进入 Host API;普通历史会话仍刷新消息。Main AI proxy 只把明确的上游分组饱和投影为当前 OpenCode 的终止状态,配额耗尽保持独立终止态,通用限速继续保留 `429`。
@@ -32,6 +33,7 @@ AI 编程首次发送在新建 OpenCode session 已知为空时不再等待冗
- 2026-08-12:一键提交前复用当前项目的内置浏览器 loopback preview,以 fresh 临时 Electron WebContents/CDP 执行桌面/移动 UX 预检;服务端仍执行唯一受控构建、不可变 Release 安全门禁和人工审核。
- 2026-08-12:发布架构反转为 Main-owned 本地构建;固定 npm 11.6.2 按项目 lockfile 安装并执行项目 Vite,Electron 预检最终上传同字节产物,再上传 source+built 双归档和严格 contract。服务端仅校验并固化不可信字节,不再承担项目 Vite 构建。
- 2026-08-12:AI 编程新 session 的首条 prompt 不再被已知空历史读取阻塞;明确上游分组饱和会快速终止,通用 `429` 仍保持原有限速语义。
+- 2026-08-13:AI 绘画把原视频首帧选择器泛化为单图来源选择器;图片 Brief 可选择项目作品或上传本地图作为图生图参考图,视频及未决 medium 保持历史首帧行为,成功提交后关闭弹窗。
## In Progress
@@ -62,7 +64,8 @@ AI 编程首次发送在新建 OpenCode session 已知为空时不再等待冗
- 服务端持久 Conversation Session 不由客户端在注销或退出时删除;Main 只关闭本地流、清除本机缓存并撤销本地凭据。
- 客户端对最终构建字节的 loopback 检查没有可信 receipt,且不复刻生产 opaque-origin;服务端必须独立重算 source/built/contract、校验不可变 Release,人工审核仍不可绕过。如未来需要不可绕过的 runtime gate,必须引入可信 verifier 并绑定精确构建产物。
- AI proxy 的明确饱和 `429 → 400` 是与当前 OpenCode 重试契约匹配的内部投影;升级 OpenCode 或上游饱和错误文案变化时必须复核。不得把通用 `429` 或仅含 `rate_limit_exceeded` 的响应误分类为终止饱和。
+- AI 绘画单图选择器仍精确匹配 quick reply `从作品列表选择图片`,用途再从当前 Brief medium 推断;本地化或协议文案变化可能破坏入口。扩展更多素材输入前应升级为结构化 action/purpose。
## Last Updated
-2026-08-12
+2026-08-13
diff --git a/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md b/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
index e8e6623..26aeb23 100644
--- a/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
+++ b/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
@@ -39,15 +39,42 @@
## Outcome
-- Not completed.
+- Merged reviewed feature commit `809364e` into the current `a03043d` client
+ baseline with merge commit `88281b8`; Git resolved the overlapping
+ `ImageCanvas` and page-test history without source conflicts and preserved the
+ existing first-conversation work.
+- Promoted the generalized single-image picker, one-Asset attachment boundary,
+ image/video/null-medium behavior, exact-string compatibility risk and
+ production-smoke obligation into the current canonical project memory.
+- README now describes text-to-image, single-reference image-to-image, project
+ work selection and local upload on top of the latest client product state.
## Verification
-- Not run.
+- Source merge preflight used `git merge-tree` against current `main`; only the
+ README paragraph needed an overlapping semantic merge and the final merge
+ completed automatically.
+- `pnpm install --offline --frozen-lockfile`: passed with the pinned pnpm;
+ dependencies were restored entirely from the local store.
+- `pnpm exec vitest run tests/unit/image-canvas-page.test.tsx`: `25 passed`.
+- `pnpm run typecheck`: passed.
+- `pnpm exec eslint src/pages/ImageCanvas/index.tsx
+ tests/unit/image-canvas-page.test.tsx`: passed.
+- `pnpm run build:vite`: passed for Renderer, Main and Preload; emitted only the
+ repository's existing dynamic-import and chunk-size warnings.
+- `git diff --check`: pending after final documentation edits.
+- `check_project_docs.py`: passed.
+- `check_doc_drift.py --task-id 20260813-integrate-i2i-client-main-5d9e`:
+ passed after keeping the source task record read-only on its source branch,
+ matching the repository's established Integration Gate pattern.
+- Packaged desktop and live Works Square/Bailian provider smoke were not run.
## Follow-ups
-- None recorded.
+- Replace exact localized quick-reply matching with a structured asset-picker
+ action/purpose before adding more input modes or changing that label.
+- Run packaged-desktop and live Works Square/Bailian image-to-image smoke after
+ the matching client and server releases are deployed.
## Promotion Candidates
diff --git a/.project-docs/40-domain/business-rules.md b/.project-docs/40-domain/business-rules.md
index b5c441c..400b802 100644
--- a/.project-docs/40-domain/business-rules.md
+++ b/.project-docs/40-domain/business-rules.md
@@ -24,6 +24,9 @@
- Conversation 持有消息、Brief、Quote 和 `turnRevision`;生成任务和资产属于 Workspace,切换 Conversation 后必须继续可见。
- 每条 Conversation 使用服务端持久 Agent Gateway Session。客户端注销或退出时只关闭本地流并清除本机 Session-id 缓存,不删除服务端 Session。
- Conversation 异步与流式更新必须同时核对 Workspace 和 Conversation 身份;任务事件按 Workspace 归并。
+- 图片生成支持无参考图的文生图和单参考图图生图;参考图必须来自当前 Workspace 的已完成图片 Asset,或先通过现有 Workspace 上传接口把本地图片转成 Asset,再随当前 Conversation Turn 提交唯一 Asset ID。
+- 视频首帧与图生图参考图复用单图选择器,但用途由当前 Brief medium 决定:只有明确 `image` 使用图生图语义,`video`、null 或缺失值保持视频首帧兼容语义。选择作品或上传成功后应关闭弹窗。
+- 当前 quick reply 文案匹配只是兼容契约;新增更多素材输入用途前,应改为结构化 action/purpose,不得继续依赖本地化展示字符串推断行为。
## Open Questions
@@ -31,7 +34,8 @@
- 是否需要在生产发布链引入绑定精确 Release/digest 的可信 runtime verifier;当前客户端 loopback preflight 不能承担该职责。
- 在一个客户端兼容版本且服务端与存量数据稳定提供 `play_url` 后,移除 `runtime_url` 回退。
- 多 Conversation 客户端发布前需确认服务端迁移 `0033`、Conversation API 与持久 Session 契约已经部署。
+- 图生图随客户端发布前,需确认相匹配的服务端 `image_to_image` Brief/Quote/Task 冻结、私有源图复核与 Bailian edit 执行链已部署,并使用真实 Workspace Asset 完成生产 smoke。
## Last Reviewed
-2026-08-12
+2026-08-13
diff --git a/.project-docs/50-evidence/evidence-index.md b/.project-docs/50-evidence/evidence-index.md
index f7c26ab..571e97b 100644
--- a/.project-docs/50-evidence/evidence-index.md
+++ b/.project-docs/50-evidence/evidence-index.md
@@ -9,6 +9,7 @@ Use this index for searchable, traceable evidence records.
| 2026-08-12 | Makelore 内置浏览器发布前预检 | 本地功能验证通过;不构成可信发布证明 | `30-worklog/tasks/20260812-client-browser-preflight-c8e2.md`、`926056a` | 121 项聚焦回归、typecheck、scoped lint、三端 build 与真实 Electron 双视口 E2E 通过;loopback UX 预检无 receipt/provenance/opaque-origin parity,服务端门禁仍需生产整链验收 |
| 2026-08-12 | Makelore Main-owned 本地静态 Release 构建 | 本地功能与 Windows 安装产物验证通过;安装器未发布 | `30-worklog/tasks/20260812-client-built-release-makelore-7e5b.md`、`5b44864` | 6 files / 129 focused tests、typecheck、scoped lint、Vite build、真实 Electron 双视口 E2E 与实际 npm/Vite smoke 通过;安装器 223,547,912 bytes,SHA-256 `08A0BB7BC66EE4AD8B120E8955B149951CD86AF53CC966C7973AD4D77A5815C1`,内置 npm 11.6.2 已由 packaged verifier 验证,但未上传或发布 |
| 2026-08-12 | AI 编程首次会话等待与上游饱和重试 | 本地功能验证通过;真实冷启动各阶段耗时尚未遥测 | 源任务 `20260812-first-chat-fix-b84fd29c`、`08da976`、`0ee5254` | 4 个相关单测文件 228/228、typecheck、scoped lint、Vite build 与真实 Electron E2E 通过;全量单测的 3 个失败与 `main` 基线一致,修复证明 prompt 不等待已知空历史,但不宣称消除所有 runtime 冷启动耗时 |
+| 2026-08-13 | AI 绘画单参考图图生图客户端 | 本地功能验证通过;未执行安装包或真实 Provider smoke | 源任务 `20260812-design-image-to-image-client-c91e`、`809364e`、集成 `88281b8` | 聚焦页面测试覆盖图片作品选择、本地上传、视频首帧及 null-medium 兼容;typecheck、scoped lint 与 Vite build 在集成头重跑,生产部署与付费生成另行验收 |
## When To Add Evidence
diff --git a/.project-docs/80-commitments/commitments.md b/.project-docs/80-commitments/commitments.md
index 07be42b..1e04e3a 100644
--- a/.project-docs/80-commitments/commitments.md
+++ b/.project-docs/80-commitments/commitments.md
@@ -9,6 +9,8 @@ Track future-facing memory: promised follow-ups, unfinished loops, timed checks,
| 2026-08-10 | 删除客户端 `runtime_url` 兼容回退 | 一个客户端兼容版本结束,且服务端与存量数据稳定提供 `play_url` | 客户端 | Pending | 删除类型字段、读取分支和对应回归测试 |
| 2026-08-11 | 部署并验收 AI 绘画多 Conversation 服务端契约 | 发布包含多会话客户端之前 | 客户端/服务端集成 | Pending | 确认迁移 `0033`、Conversation list/create/read/turn/confirm API、持久 Agent Session 与事件字段已上线 |
| 2026-08-12 | 复核 AI 编程上游饱和终止态投影 | 升级 bundled OpenCode 或上游饱和错误格式时 | 客户端/OpenCode 集成 | Pending | 重新验证 retry contract;继续区分配额耗尽、明确分组饱和与通用 `429`,必要时调整或移除 `429 → 400` 内部投影 |
+| 2026-08-13 | 将 AI 绘画素材选择 quick reply 升级为结构化 action/purpose | 新增第三种素材输入用途、调整本地化文案或重构 Design Message 协议时 | 客户端/服务端集成 | Pending | 用 `select_image_asset` + `image_reference | video_first_frame` 等稳定字段替代精确中文字符串匹配,并覆盖延迟 Brief 快照兼容 |
+| 2026-08-13 | 完成图生图客户端与服务端生产整链 smoke | 相匹配客户端与服务端部署后 | 客户端/服务端集成 | Pending | 用当前 Workspace 已完成作品与本地上传各执行一次图生图,核对 Asset 所有权、Quote、任务创建、结果展示与下载;不以本地单测替代付费 Provider 验收 |
## Use
From 7a807a2f5269455aafa2973a7b37831d7329e38a Mon Sep 17 00:00:00 2001
From: brother7 <7brother7@gmail.com>
Date: Thu, 13 Aug 2026 14:28:28 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A7=E7=89=88?=
=?UTF-8?q?=E8=AE=BE=E8=AE=A1=20Brief=20=E5=AA=92=E4=BB=8B=E5=85=BC?=
=?UTF-8?q?=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../image-workspace/works-square-workspace.ts | 17 +++++--
.../works-square-design-workspace.test.ts | 44 ++++++++++++++++++-
2 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/electron/image-workspace/works-square-workspace.ts b/electron/image-workspace/works-square-workspace.ts
index 3a5c496..fb69d1d 100644
--- a/electron/image-workspace/works-square-workspace.ts
+++ b/electron/image-workspace/works-square-workspace.ts
@@ -36,7 +36,7 @@ import {
type ServerBrief = {
version: number;
status: DesignBrief['status'];
- medium: DesignBrief['medium'];
+ medium?: DesignBrief['medium'];
summary: string;
ready: boolean;
missing_decision: string | null;
@@ -219,10 +219,18 @@ const AGENT_RUN_TIMEOUT_MS = 10 * 60_000;
const DESIGN_EVENT_DELIVERY_BARRIER_TIMEOUT_MS = 1_000;
function mapBrief(brief: ServerBrief): DesignBrief {
+ const medium = brief.medium ?? null;
+ if (medium !== null && medium !== 'image' && medium !== 'video') {
+ throw new DesignWorkspaceModuleError(
+ 502,
+ 'DESIGN_WORKSPACE_RESPONSE_INVALID',
+ 'AI 设计服务返回了无效的媒介类型',
+ );
+ }
return {
version: brief.version,
status: brief.status,
- medium: brief.medium,
+ medium,
summary: brief.summary,
ready: brief.ready,
missingDecision: brief.missing_decision,
@@ -357,7 +365,10 @@ function isServerConversation(value: unknown): value is ServerConversation {
&& Boolean(brief)
&& Number.isInteger(brief?.version)
&& ['draft', 'ready', 'confirmed'].includes(String(brief?.status))
- && (brief?.medium === null || brief?.medium === 'image' || brief?.medium === 'video')
+ && (brief?.medium === undefined
+ || brief.medium === null
+ || brief.medium === 'image'
+ || brief.medium === 'video')
&& typeof brief?.summary === 'string'
&& typeof brief?.ready === 'boolean'
&& (brief?.missing_decision === null || typeof brief?.missing_decision === 'string')
diff --git a/tests/unit/works-square-design-workspace.test.ts b/tests/unit/works-square-design-workspace.test.ts
index 528e26b..91cdb94 100644
--- a/tests/unit/works-square-design-workspace.test.ts
+++ b/tests/unit/works-square-design-workspace.test.ts
@@ -232,6 +232,30 @@ describe('Works Square AI design adapter', () => {
);
});
+ it('normalizes a missing Brief medium to null and rejects invalid non-null values', async () => {
+ const { medium: _medium, ...legacyBrief } = serverConversation.brief;
+ const legacyConversation = {
+ ...serverConversation,
+ brief: legacyBrief,
+ };
+ const invalidConversation = {
+ ...serverConversation,
+ brief: { ...serverConversation.brief, medium: 'audio' },
+ };
+ const fetchMock = vi.fn()
+ .mockResolvedValueOnce(jsonResponse(legacyConversation))
+ .mockResolvedValueOnce(jsonResponse(invalidConversation));
+ const adapter = new WorksSquareDesignWorkspace({
+ apiBaseUrl: 'https://square.example',
+ fetchImpl: fetchMock,
+ });
+
+ await expect(adapter.getConversation('workspace-one', 'conversation-one'))
+ .resolves.toMatchObject({ brief: { medium: null } });
+ await expect(adapter.getConversation('workspace-one', 'conversation-one'))
+ .rejects.toMatchObject({ code: 'DESIGN_WORKSPACE_RESPONSE_INVALID' });
+ });
+
it('submits a conversation turn through the persistent Agent Gateway Session', async () => {
const fetchMock = vi.fn()
.mockResolvedValueOnce(jsonResponse(serverConversation))
@@ -940,6 +964,11 @@ describe('Works Square AI design adapter', () => {
});
it('reuses one design Agent Session and normalizes matching task events from fresh WebSocket tickets', async () => {
+ const { medium: _medium, ...legacyBrief } = serverConversation.brief;
+ const legacyConversation = {
+ ...serverConversation,
+ brief: legacyBrief,
+ };
const snapshotTask = {
task_id: 'task-snapshot',
workspace_id: 'workspace-one',
@@ -964,10 +993,21 @@ describe('Works Square AI design adapter', () => {
workspace_id: 'workspace-one',
conversation_id: 'conversation-one',
workspace_view_revision: 2,
- conversation: serverConversation,
+ conversation: legacyConversation,
generation_tasks: [snapshotTask],
},
};
+ const invalidSnapshotEvent = {
+ ...snapshotEvent,
+ sequence: 98,
+ payload: {
+ ...snapshotEvent.payload,
+ conversation: {
+ ...serverConversation,
+ brief: { ...serverConversation.brief, medium: 'audio' },
+ },
+ },
+ };
const assistantDeltaEvent = {
session_id: 'session-one',
sequence: 2,
@@ -1038,6 +1078,7 @@ describe('Works Square AI design adapter', () => {
const { sockets, webSocketFactory } = scriptedSockets([
{
frames: [
+ { type: 'event', event: invalidSnapshotEvent },
{ type: 'event', event: snapshotEvent },
{ type: 'event', event: malformedDeltaEvent },
{ type: 'event', event: assistantDeltaEvent },
@@ -1077,6 +1118,7 @@ describe('Works Square AI design adapter', () => {
conversation: expect.objectContaining({
conversationId: 'conversation-one',
title: serverConversation.title,
+ brief: expect.objectContaining({ medium: null }),
messages: [expect.objectContaining({
text: serverConversation.messages[0].text,
})],
From f11eb49ea1d4e7d2d6cc351c6a365f056933c13b Mon Sep 17 00:00:00 2001
From: brother7 <7brother7@gmail.com>
Date: Thu, 13 Aug 2026 14:28:55 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E6=94=B6=E5=8F=A3=E5=9B=BE=E7=94=9F?=
=?UTF-8?q?=E5=9B=BE=E5=AE=A2=E6=88=B7=E7=AB=AF=E9=9B=86=E6=88=90=E9=AA=8C?=
=?UTF-8?q?=E8=AF=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.project-docs/30-worklog/current-state.md | 2 +-
.../20260813-integrate-i2i-client-main-5d9e.md | 14 ++++++++++++--
.project-docs/50-evidence/evidence-index.md | 2 +-
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/.project-docs/30-worklog/current-state.md b/.project-docs/30-worklog/current-state.md
index 4558ca0..d469316 100644
--- a/.project-docs/30-worklog/current-state.md
+++ b/.project-docs/30-worklog/current-state.md
@@ -13,7 +13,7 @@ This file is the integrated default-branch snapshot. Feature tasks record progre
- `926056a`:Makelore 内置 Electron WebContents/CDP 发布前本地预览检查。
- `5b44864`:Main-owned 本地 npm/Vite 构建、同字节 Electron 双视口预检、source+built 双归档与 artifact contract 上传。
- `08da976` / `0ee5254`:AI 编程首次发送已知空 session 快速路径与明确上游饱和终止态投影。
-- `809364e` / `88281b8`:AI 绘画单参考图图生图选择/上传交互及其在最新客户端主线上的集成提交。
+- `809364e` / `88281b8` / `7a807a2`:AI 绘画单参考图图生图选择/上传交互、最新客户端主线集成及旧版 Brief medium 缺失兼容。
## Current Focus
diff --git a/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md b/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
index 26aeb23..51b5dd2 100644
--- a/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
+++ b/.project-docs/30-worklog/tasks/20260813-integrate-i2i-client-main-5d9e.md
@@ -8,7 +8,7 @@
- Worktree: D:\Datas\OthersProjects\makelore-integrate-i2i-main-5d9e
- Base commit: a03043d048826609cb4f8cb7d782bde93e0e77f4
- Owner: codex
-- Status: In Progress
+- Status: Completed
## Scope
@@ -48,6 +48,10 @@
production-smoke obligation into the current canonical project memory.
- README now describes text-to-image, single-reference image-to-image, project
work selection and local upload on top of the latest client product state.
+- Independent review found that legacy snapshots with an omitted Brief medium
+ were rejected by the cloud adapter before the page fallback. Commit `7a807a2`
+ now accepts only an omitted/null/image/video medium at the boundary, normalizes
+ omission to null, and continues to reject other non-null values.
## Verification
@@ -57,17 +61,23 @@
- `pnpm install --offline --frozen-lockfile`: passed with the pinned pnpm;
dependencies were restored entirely from the local store.
- `pnpm exec vitest run tests/unit/image-canvas-page.test.tsx`: `25 passed`.
+- `pnpm exec vitest run tests/unit/works-square-design-workspace.test.ts`:
+ `22 passed`, including REST and WebSocket missing-medium normalization and
+ invalid-medium rejection.
- `pnpm run typecheck`: passed.
- `pnpm exec eslint src/pages/ImageCanvas/index.tsx
tests/unit/image-canvas-page.test.tsx`: passed.
- `pnpm run build:vite`: passed for Renderer, Main and Preload; emitted only the
repository's existing dynamic-import and chunk-size warnings.
-- `git diff --check`: pending after final documentation edits.
+- `git diff --check`: passed.
- `check_project_docs.py`: passed.
- `check_doc_drift.py --task-id 20260813-integrate-i2i-client-main-5d9e`:
passed after keeping the source task record read-only on its source branch,
matching the repository's established Integration Gate pattern.
- Packaged desktop and live Works Square/Bailian provider smoke were not run.
+- Initial independent Sol review: FAIL with one P2 missing-medium adapter gap
+ and one P3 stale verification record; both were corrected. Final independent
+ Sol review is rerun against the corrected head before promotion.
## Follow-ups
diff --git a/.project-docs/50-evidence/evidence-index.md b/.project-docs/50-evidence/evidence-index.md
index 571e97b..4ab2725 100644
--- a/.project-docs/50-evidence/evidence-index.md
+++ b/.project-docs/50-evidence/evidence-index.md
@@ -9,7 +9,7 @@ Use this index for searchable, traceable evidence records.
| 2026-08-12 | Makelore 内置浏览器发布前预检 | 本地功能验证通过;不构成可信发布证明 | `30-worklog/tasks/20260812-client-browser-preflight-c8e2.md`、`926056a` | 121 项聚焦回归、typecheck、scoped lint、三端 build 与真实 Electron 双视口 E2E 通过;loopback UX 预检无 receipt/provenance/opaque-origin parity,服务端门禁仍需生产整链验收 |
| 2026-08-12 | Makelore Main-owned 本地静态 Release 构建 | 本地功能与 Windows 安装产物验证通过;安装器未发布 | `30-worklog/tasks/20260812-client-built-release-makelore-7e5b.md`、`5b44864` | 6 files / 129 focused tests、typecheck、scoped lint、Vite build、真实 Electron 双视口 E2E 与实际 npm/Vite smoke 通过;安装器 223,547,912 bytes,SHA-256 `08A0BB7BC66EE4AD8B120E8955B149951CD86AF53CC966C7973AD4D77A5815C1`,内置 npm 11.6.2 已由 packaged verifier 验证,但未上传或发布 |
| 2026-08-12 | AI 编程首次会话等待与上游饱和重试 | 本地功能验证通过;真实冷启动各阶段耗时尚未遥测 | 源任务 `20260812-first-chat-fix-b84fd29c`、`08da976`、`0ee5254` | 4 个相关单测文件 228/228、typecheck、scoped lint、Vite build 与真实 Electron E2E 通过;全量单测的 3 个失败与 `main` 基线一致,修复证明 prompt 不等待已知空历史,但不宣称消除所有 runtime 冷启动耗时 |
-| 2026-08-13 | AI 绘画单参考图图生图客户端 | 本地功能验证通过;未执行安装包或真实 Provider smoke | 源任务 `20260812-design-image-to-image-client-c91e`、`809364e`、集成 `88281b8` | 聚焦页面测试覆盖图片作品选择、本地上传、视频首帧及 null-medium 兼容;typecheck、scoped lint 与 Vite build 在集成头重跑,生产部署与付费生成另行验收 |
+| 2026-08-13 | AI 绘画单参考图图生图客户端 | 本地功能验证通过;未执行安装包或真实 Provider smoke | 源任务 `20260812-design-image-to-image-client-c91e`、`809364e`、集成 `88281b8`、兼容修复 `7a807a2` | 25 项页面回归覆盖图片作品选择、本地上传、视频首帧及 null-medium 兼容;22 项云端适配器回归覆盖 REST/WebSocket 缺失 medium 归一化与非法值拒绝;typecheck、scoped lint 与 Vite build 通过,生产部署与付费生成另行验收 |
## When To Add Evidence