feat(agents): move conversation attachments into a header side panel

This commit is contained in:
鲨鱼辣椒 committed 2026-10-12 23:12:24 +08:00
1 parent e9f204776a
commit 0d54690dd6
10 files changed
+589 -98

No files matched your search

@@ -8,34 +8,42 @@
- Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20261012-agent-chat-files-review-e87b41c6
- Base commit: bcb1b61564b05c92fb51d8791ce15db3ab8e8b2c
- Owner: codex
- Status: Ready for Integration
- Status: In Progress
## Scope
- Discussion-only review of the personal Agent conversation's “对话文件” entry, grounded in the currently deployed source. Only this task record changes.
- Review and implement the approved personal Agent attachment interaction: counted entry in the top-right identity header, a right-side file panel grouped by uploaded/generated files, composer plus action, and trial Renderer update.
## Intent And Constraints
- Explain the current function in Chinese product language and recommend clearer file/image interactions for the child-facing product. The user has not authorized implementation of this proposal.
- Discussion completed. The user explicitly approved implementation and updating the latest temporary app. Keep Chinese product communication and existing Makelore light visual language.
- Preserve Main-owned upload/confirmation/download, per-conversation access, attachment retry identity and chat history. Removing an attachment from the pending message only deselects it; it does not delete the cloud file.
- Do not modify source, shared canonical documents, the temporary application, deployment pointers or remote branches.
- Limit source changes to this attachment UI, its focused tests and README. Do not change cloud contracts, shared canonical project memory or push remote branches. Stage Renderer updates in an isolated ignored runtime directory; root alone activates and verifies the live app.
## Outcome
- Source review confirms “对话文件” expands a panel containing previously uploaded files selectable for the current message, an optional upload/reading-method flow, and a per-thread generated-file browser with folder navigation and download. This mixes sending materials, choosing reading settings and collecting outputs behind one vague label.
- Recommendation pending user approval: use the composer’s plus menu for uploading files/images and reusing files from this conversation; show selected files as removable cards/thumbnails before sending and as attachments with the sent user message; present generated files as view/save cards within the relevant assistant reply. Avoid exposing storage paths, folder management and technical reading choices in the ordinary flow. Preview support and message/file linkage require contract assessment before any implementation.
- Concurrent and Planning Gates passed. 42 peer scopes checked read-only; no dependency blocks this discussion. Existing composer and history tasks supply preservation constraints. Older ADR interface details are historical context; the user's later simplification decisions govern this discussion.
- The previously vague inline “对话文件” area is now a counted “附件” entry beside the Agent identity at the top right. It is hidden when both uploaded and generated collections are successfully known to be empty. Initial failures expose a retryable entry without claiming a precise count.
- Opening the entry shows a right-side Sheet with “你上传的” and “助手生成的” groups. Uploaded files can be selected for reuse or saved; generated files can be saved. Existing output subfolders are collected into the flat library through the current Main-owned file API, without showing folder navigation. Uploaded paths are excluded from the generated group to avoid double counting.
- The composer’s plus menu adds files/images and retains the optional reading-method flow. Pending cards, confirmation retries, cancellation and removal retain their existing semantics; browsing or closing the panel never sends a message or deletes a file. Conversation changes cancel stale list reads. Authoritative history/run updates refresh generated-file availability.
- The panel follows the existing cream, lilac and mint UI. It preserves chat/input state, uses accessible dialog/menu behavior and restores focus on close. Long Agent names are limited to two visible lines with the full name available on hover, preserving the header and composer in narrow short windows.
- Independent review identified and resolved uploaded download loss, initial-error misclassification/counting, inaccessible initial retry and long-name overflow. The existing attachment suite was migrated without dropping its 14 boundary cases.
- Concurrent and Planning Gates passed. 42 peer scopes checked read-only on same-task resumption; no concrete dependency blocks this implementation. Existing composer/history tasks supply preservation constraints. Earlier proposal details are historical context; the user’s approved header/panel design and simplification decisions govern the delivered change.
- Production build completed. Live trial activation and visible native verification are the remaining delivery step.
## Verification
- Inspected `src/pages/CloudAgents/CloudComposerAttachments.tsx` and `CloudChat.tsx` at base `bcb1b61564b05c92fb51d8791ce15db3ab8e8b2c`, inherited from the confirmed deployed card-restoration source. No new native UI screenshot, real cloud upload, file preview or model call was performed.
- Typecheck and production Renderer/Main/preload/utility build passed. Scoped ESLint passed with only the two existing CloudChat warnings (export/refresh and ref cleanup); no errors.
- `cloud-agent-attachments`, `cloud-agents-workflows` and the migrated `cloud-composer-attachments` suites: 47/47 passed. They cover empty/generated-only counts, list failure/retry, uploaded/generated downloads, recursive output paths, reuse/deselection, disabled actions, immutable confirmation/parse retries, late responses and thread isolation.
- Related start-use, guidance and page suites: 48/48 passed sequentially with one worker. An earlier concurrent run hit a single existing five-second test timeout while build/layout checks ran; the isolated run passed without changing the test timeout or product code.
- Installed Chrome layout suite: all 14 chat/panel cases passed at 375/768/1024/1440 widths; the additional long-name short-window case passed separately after fixing the test harness query routing. Coverage includes sheet bounds, Escape/focus, chat scrolling, selection return, native-save arguments and thinking/approval/stop layout.
- Real trial was observed logged in with an existing conversation, no unsent text/selected attachments and existing generated outputs. No real upload, model call or file preview was needed for verification. Final live UI observations will be recorded after activation.
- Required project context and relevant personal-cloud-agent decision read; peer review verified all 42 records were readable. One old peer scope remains undefined without any concrete dependency.
- Documentation drift and whitespace checks recorded at completion. Product code/build unchanged; application tests/build are unnecessary for a discussion-only record.
## Follow-ups
- Continue discussion and obtain the user's approval before implementation. If approved, inspect cloud history/attachment contracts for sent-message attachment association, supported preview formats and generated-file linkage; preserve upload/retry/download boundaries.
- Activate the isolated Renderer build in the existing temporary app, refresh without restarting Main, and verify the header entry and generated-file panel using existing conversation files.
- Inline file previews and association of generated files with individual assistant replies remain future work requiring cloud contract assessment; they are not part of this approved header/panel change.
## Promotion Candidates
- No accepted product change to promote. The interaction above remains a proposal and requires human confirmation before updating README or accepted decisions.
- Target: personal-cloud-agent client interaction specification and integrated current state. Proposal: replace the vague inline file browser with the approved counted header entry and right panel grouped by uploaded/generated files, while keeping adding files in the composer’s plus menu. Evidence: explicit user approval, 47 focused + 48 related unit checks and 15 browser layout scenarios. Future impact: file access stays visible without crowding the composer, and generated output subfolders no longer require navigation. Semantic conflicts: earlier proposal’s folder-browser and trial-chat layouts are superseded by the user’s later simplification decisions. Human confirmation: already supplied for this UI behavior; canonical promotion still requires a serialized integration task.