diff --git a/.project-docs/30-worklog/tasks/20261012-agent-chat-files-review-e87b41c6.md b/.project-docs/30-worklog/tasks/20261012-agent-chat-files-review-e87b41c6.md index 3a4560c8..d7bfba01 100644 --- a/.project-docs/30-worklog/tasks/20261012-agent-chat-files-review-e87b41c6.md +++ b/.project-docs/30-worklog/tasks/20261012-agent-chat-files-review-e87b41c6.md @@ -13,17 +13,19 @@ ## Scope - 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. +- Local follow-up: hide internal process files using conservative saved-assistant reply links and current-conversation file verification. The user explicitly forbids updating the temporary app for this follow-up. ## Intent And Constraints -- Discussion completed. The user explicitly approved implementation and updating the latest temporary app. Keep Chinese product communication and existing Makelore light visual language. +- For the original header/panel change, discussion completed and the user explicitly approved implementation and updating the temporary app. The later local filtering follow-up supersedes that deployment instruction. 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. - 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. +- Latest instruction: implement the client-side compatibility filter locally only. No live application actions, build activation, runtime pointer/manifest changes or cloud calls. Yuxi's formal delivery mechanism is assigned to the user's colleague and is not assumed available. ## Outcome - 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. +- Opening the entry shows a right-side Sheet with “你上传的” and “助手生成的” groups. Uploaded files can be selected for reuse or saved; explicitly delivered generated files can be saved. Linked files in output subfolders are verified through the current Main-owned file API, without showing folder navigation. Uploaded paths are excluded from the generated group to avoid double counting. This local filtering follow-up has not been deployed to the temporary app, which still shows the original broader collection. - 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. @@ -33,15 +35,25 @@ ### File Visibility Discussion Follow-up -- The user questioned the 55-file collection and agreed that internal process files should be hidden. This follow-up explains a proposed classification and implementation boundary; it does not implement or deploy that filtering change. +- At the discussion stage, the user questioned the 55-file collection and agreed that internal process files should be hidden. The findings below preceded the later approved local implementation; no filtering was deployed during that discussion. - Same-task Concurrent/Planning Gates passed again: current ownership matches; 43 peers and 129 required sections read-only, including the new knowledge-picker discussion which explicitly isolates chat attachments. No concrete semantic conflict. The historical child-language peer remains undefined without a dependency. - Code review confirms `CloudFile` only has name/path/directory/size fields (`shared/cloud-agents.ts:163`) and messages/history have no structured delivered-file relationship (`shared/cloud-agents.ts:98–107`). Current UI recursively collects all files and calls every non-uploaded path generated. That includes scripts, caches and tool-call outputs. A downloadable path or an `outputs` directory does not establish delivery intent. - Recommendation: retain confirmed uploaded attachments; show Agent files only after explicit delivery to the user. Yuxi should validate and persist a stable delivered-file identity linked to the current conversation, run and assistant reply, plus display name and availability. The client should show/count that authoritative collection. Process files stay usable internally and are not deleted. Code files remain visible when explicitly delivered; no extension/name/directory heuristic should decide purpose. - A conservative interim client filter could use valid file links in persisted assistant replies, normalized and matched to actual files of the same conversation. Exclude reasoning, tool/system content, code examples and plain path mentions; unknown files stay hidden. This is only a compatibility bridge and can miss valid old deliverables lacking links. Formal delivery records and any legacy backfill require Yuxi assessment and must not be claimed implemented from this discussion. - No source, tests, cloud content or live app interaction changed in this follow-up. Existing build and runtime remain the delivered header/panel version; a docs-only handoff may update its source record without changing product payloads. +### Local File Visibility Implementation + +- The user approved the conservative client filter and explicitly requested no temporary-app update. Same-task ownership and Planning Gates passed again; 43 peer records / 129 required sections reread with no concrete conflict. The now-approved knowledge-picker task continues on separate configuration surfaces. +- A pure Markdown AST helper extracts local links, image links and reference links only from saved assistant reply content of the current conversation. User/system messages, reasoning, code examples, raw HTML, plain path mentions, external URLs, unsafe paths and other conversation artifact links are excluded. File extensions and directory names do not classify purpose. +- The composer reads only the parent directories of these explicit links through Main and includes exact existing leaf-file matches. It no longer recursively enumerates all workspace folders. Uploads remain independent and parsed/original copies are excluded from generated output counts. Collection state is keyed by conversation and normalized linked paths, so an old collection cannot be shown or counted under new history. Equivalent history refreshes reuse the same target set; explicit refresh and authoritative revision changes still recheck availability. +- The locked transitive Markdown parser `mdast-util-from-markdown@2.0.3` is declared as an exact direct frontend dependency; the existing lock graph is unchanged and frozen lockfile-only validation passed. No package download or runtime installation is needed for this task's existing local dependencies. +- Local implementation and independent review are complete: 45 helper checks, 53 focused UI/workflow checks, and 16 isolated Chrome layout checks passed. Typecheck, production build, scoped ESLint and frozen lockfile validation passed. The existing temporary application remains bound to the previously verified Renderer build `0d54690dd63de39e007f2e1f54f9aea157670f61` and source handoff `922b09bda02299528478617ef5c47789ea39ac39`; this local implementation is not deployed there. No runtime pointer, payload, manifest, profile, cloud data or live app interaction was changed. + ## Verification +- Local visibility follow-up: helper suite 45/45 passed; focused attachment/composer/workflow suites 53/53 passed, including the 15-case composer suite rerun after stabilizing the normalized target set. Isolated Chrome layout suite 16/16 passed, including narrow-window internal-file filtering and native saving of an explicitly delivered Python file. The prior upload/confirmation/parse/retry/deselection/thread-isolation boundaries remain covered. +- Local follow-up typecheck and production Renderer/Main/preload/utility build passed. Scoped ESLint has no errors and only the two pre-existing CloudChat warnings. Frozen lockfile-only offline validation passed without changing the resolved package graph; final whitespace and task-document drift checks passed. Validation uses fixtures and local build outputs only; the live temporary app was neither refreshed nor updated. - 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. @@ -53,10 +65,10 @@ ## Follow-ups - 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. -- The current file-list contract does not distinguish final deliverables from intermediate Agent files. The generated group preserves the accessible conversation collection, including intermediate tool outputs when present. A future final-deliverable marker should be defined with Yuxi rather than inferring delivery from file names/extensions. +- The current file-list contract does not distinguish final deliverables from intermediate Agent files. The local reply-link compatibility filter is conservative: old deliverables with only plain paths may remain hidden. Yuxi's stable reply-linked delivery records are still needed for complete classification; no future fields are invented or assumed in the client. - Local task commits and the confirmed trial Renderer are ready for later integration. No remote push, merge or worktree removal was requested or performed. ## Promotion Candidates - 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. -- Target: personal-cloud-agent client/API specification. Proposal under discussion: count/display only confirmed user uploads and explicitly delivered results, backed by Yuxi reply-linked delivery records; unknown and internal files hidden without deletion. Evidence: user screenshot of internal artifacts and contract review above. Future impact: clear deliverables and durable history without relying on filename guesses. Semantic conflict: narrows the current all-non-uploaded-files generated group. Human confirmation: the user agreed with hiding process files and asked how; the detailed registration/compatibility approach remains a proposal, not an implemented contract. +- Target: personal-cloud-agent client/API specification. Proposal: count/display only confirmed user uploads and explicitly delivered results; the now-approved local compatibility filter uses verified saved-assistant file links while Yuxi's formal reply-linked delivery records remain assigned to the colleague. Unknown/internal files stay hidden without deletion; explicitly delivered source files remain visible. Evidence: user approval, 45 helper checks, 53 focused UI/workflow checks and 16 browser scenarios. Future impact: clear attachment counts and less repeated directory reading; old plain-path deliverables may remain hidden until formal records/backfill are available. Semantic conflict: supersedes treating all non-uploaded workspace files as generated results. Human confirmation: already supplied for local compatibility behavior and withholding temporary-app deployment; Yuxi registration/backfill details are not implemented or assumed and need their own assessment. diff --git a/README.md b/README.md index a8c300a9..2eb1db88 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Makelore 是一个面向软件、视觉创作、智能机器人与个人云智 - `Makelore Code|AI 编程`:管理本地项目、项目智能体、对话、文件上下文、代码变更和运行时。 会话工作台采用浅蓝项目栏、彩色通用手柄图标与卡片选中态;中间对话/作品使用圆角标签,作品预览的后退、前进、刷新与网址输入统一放在标签右侧;只在作品页显示,窄窗口自动换行。右侧智能体咨询使用奶油色标题区。沿用真实项目和会话入口、侧栏伸缩与账户菜单,样式只作用于 Code 会话工作台。可编辑的空对话在输入区上方的可用区域中央显示童趣欢迎语;「去作品广场逛逛」入口紧贴输入框上方,两者一起位于底部。老师介绍以固定宽度浮在右上角,不占用中间布局;欢迎语和底部输入区始终相对项目栏右侧的整个内容区域居中;小窗口的欢迎内容独立滚动;发送首条消息后收起欢迎区。侧栏保留「作品广场」入口,只有点击后才在系统浏览器打开公共广场,不请求、摘取或内嵌展示广场作品。打开广场保留当前项目、对话、草稿和附件,不自动发送消息;老师求助按钮保留临时应用的最新文案「帮我整体看🧠」。 -- `Makelore Agents|AI 智能体`:从模块首页进入时先打开“我的智能体”卡片列表,保留此前对话与操作恢复记录;返回首页箭头与侧栏折叠按钮同排,折叠后仍可返回;智能体模块的侧栏只通过按钮点击或键盘激活展开,鼠标经过左侧、收纳按钮或顶栏不会展开,切换模块不沿用旧悬停预览;其他模块仍保留原预览方式。“我的智能体”使用浅紫对话机器人图标,“渠道”使用浅蓝连接节点图标。macOS 原生窗口按钮留出安全空间。首页围绕自己的智能体和创建入口,显示童趣问候“Hi,今天想创造还是想聊聊?”,不再显示更多、收到的分享、活动或归档筛选。卡片恢复原有尺寸与留白,显示名称、可为空的一句话介绍及状态,支持聊天、调整、继续制作和确认删除;删除沿用云端归档机制,移出列表并停用新调用,历史和费用保留。创建先填写名称并选择平台像素头像或上传头像,下一步进入独立配置。顶部名称有编辑图标,头像可点击修改;未设置头像时使用同一张默认像素头像,从创建到配置、改名、保存和重新打开保持一致。基础页为“介绍与提示词”,一句话介绍可留空,完整提示词保留原始文本;模型作为高级设置第一项必选,未选择时不能开始使用,草稿可分步保存,不自动选模型。介绍与提示词采用浅蓝介绍卡和浅紫提示词卡;高级设置按模型、工具箱(Tool)、做事手册(Skill)、MCP 服务、子智能体和知识库纵向呈现,不再设内部分类切换;不展示 Tool/Skill 解释、资源开放规则提示、云端能力管理、费用上限或运行限制卡片,保存其他配置时保留既有运行限制,费用规则不变。顶层页签切换保留搜索、资源选择、知识表单及未保存输入。配置页移除聊天、自动任务和使用与接入导航,独立聊天仍从卡片进入,微信账号仍在侧栏渠道管理。草稿明确保存(Ctrl/⌘+S);保存只更新草稿,“应用最新修改”使新配置生效,失败重试保持原操作身份;点击“开始使用”完成必要的私有启用后直接打开聊天,不再展示二次确认页;未保存修改、缺少模型、冲突或尚未确认的请求会留在配置页处理,打开聊天不自动发送消息。独立对话沿用奶油底色和浅蓝、浅紫、薄荷色:顶部展示返回、只读头像和名称;有附件时在同一行右侧显示回形针“附件”入口和文件数量,不展示调整、保存/应用状态、客户端/微信来源、费用/版本说明或历史/新对话图标;配置由列表卡片的“调整”进入。空对话展示当前智能体头像与名称,示例只填入草稿;用户消息使用浅紫圆角气泡,助手 Markdown、表格和代码在消息区内滚动。文件或图片从输入框内添加,上传成功后以待发送卡片呈现,可移除本次携带;移除不会删除云端文件,添加不会自动发送。确认失败沿用同一文件和对话重试,发送前需完成或取消添加;支持仅发送附件,使用明确的附件提问。输入框的“+”添加文件或图片;右上角“附件”打开右侧面板,按“你上传的”和“助手生成的”分组,支持再次选用已上传附件及保存生成文件,子文件夹中的产物也纳入总数。没有文件时隐藏入口;打开、关闭面板保留聊天与输入,Escape 关闭并返回入口焦点;最近对话自动恢复、审批、停止和未发送内容的离开保护保留。模型返回的思考独立于正文展示,运行时可展开、手动折叠,完成后折叠;无思考内容时不显示。重连事件去重并隔离当前运行与主对话,终态历史未到达时保留已收到的片段并有限补读;服务端返回的最终回答思考可在历史中回看,不进入后续提问。历史回看需要 Yuxi API 思考投影补丁上线,当前未部署;实时思考沿用既有事件流。头像上传、Main-owned Host API、访问隔离、费用与不可变版本规则保持;介绍留空需要配套 Yuxi DraftCreate/DraftSave 的空字符串契约。 +- `Makelore Agents|AI 智能体`:从模块首页进入时先打开“我的智能体”卡片列表,保留此前对话与操作恢复记录;返回首页箭头与侧栏折叠按钮同排,折叠后仍可返回;智能体模块的侧栏只通过按钮点击或键盘激活展开,鼠标经过左侧、收纳按钮或顶栏不会展开,切换模块不沿用旧悬停预览;其他模块仍保留原预览方式。“我的智能体”使用浅紫对话机器人图标,“渠道”使用浅蓝连接节点图标。macOS 原生窗口按钮留出安全空间。首页围绕自己的智能体和创建入口,显示童趣问候“Hi,今天想创造还是想聊聊?”,不再显示更多、收到的分享、活动或归档筛选。卡片恢复原有尺寸与留白,显示名称、可为空的一句话介绍及状态,支持聊天、调整、继续制作和确认删除;删除沿用云端归档机制,移出列表并停用新调用,历史和费用保留。创建先填写名称并选择平台像素头像或上传头像,下一步进入独立配置。顶部名称有编辑图标,头像可点击修改;未设置头像时使用同一张默认像素头像,从创建到配置、改名、保存和重新打开保持一致。基础页为“介绍与提示词”,一句话介绍可留空,完整提示词保留原始文本;模型作为高级设置第一项必选,未选择时不能开始使用,草稿可分步保存,不自动选模型。介绍与提示词采用浅蓝介绍卡和浅紫提示词卡;高级设置按模型、工具箱(Tool)、做事手册(Skill)、MCP 服务、子智能体和知识库纵向呈现,不再设内部分类切换;不展示 Tool/Skill 解释、资源开放规则提示、云端能力管理、费用上限或运行限制卡片,保存其他配置时保留既有运行限制,费用规则不变。顶层页签切换保留搜索、资源选择、知识表单及未保存输入。配置页移除聊天、自动任务和使用与接入导航,独立聊天仍从卡片进入,微信账号仍在侧栏渠道管理。草稿明确保存(Ctrl/⌘+S);保存只更新草稿,“应用最新修改”使新配置生效,失败重试保持原操作身份;点击“开始使用”完成必要的私有启用后直接打开聊天,不再展示二次确认页;未保存修改、缺少模型、冲突或尚未确认的请求会留在配置页处理,打开聊天不自动发送消息。独立对话沿用奶油底色和浅蓝、浅紫、薄荷色:顶部展示返回、只读头像和名称;有附件时在同一行右侧显示回形针“附件”入口和文件数量,不展示调整、保存/应用状态、客户端/微信来源、费用/版本说明或历史/新对话图标;配置由列表卡片的“调整”进入。空对话展示当前智能体头像与名称,示例只填入草稿;用户消息使用浅紫圆角气泡,助手 Markdown、表格和代码在消息区内滚动。文件或图片从输入框内添加,上传成功后以待发送卡片呈现,可移除本次携带;移除不会删除云端文件,添加不会自动发送。确认失败沿用同一文件和对话重试,发送前需完成或取消添加;支持仅发送附件,使用明确的附件提问。输入框的“+”添加文件或图片;右上角“附件”打开右侧面板,按“你上传的”和“助手生成的”分组,支持再次选用已上传附件及保存明确交付的生成文件。生成文件仅取当前对话已保存助手回复中的本地文件链接(含图片与引用式链接),核对实际文件后展示和计数;只读取链接所在的文件夹,不遍历全部工作文件。未交付的脚本、缓存和工具记录不展示、不计数,明确交付的代码照常展示;仅写了路径的旧成果可能暂时隐藏,后续接入 Yuxi 的正式交付记录。没有文件时隐藏入口;打开、关闭面板保留聊天与输入,Escape 关闭并返回入口焦点;最近对话自动恢复、审批、停止和未发送内容的离开保护保留。模型返回的思考独立于正文展示,运行时可展开、手动折叠,完成后折叠;无思考内容时不显示。重连事件去重并隔离当前运行与主对话,终态历史未到达时保留已收到的片段并有限补读;服务端返回的最终回答思考可在历史中回看,不进入后续提问。历史回看需要 Yuxi API 思考投影补丁上线,当前未部署;实时思考沿用既有事件流。头像上传、Main-owned Host API、访问隔离、费用与不可变版本规则保持;介绍留空需要配套 Yuxi DraftCreate/DraftSave 的空字符串契约。 云知识库的 embedding 模型只由平台管理员在 Yuxi 后台维护:在「智能体管理 → 模型供应商」启用供应商,按供应商要求填写有效的服务地址和 API Key,添加并启用 embedding 模型并填写实际向量维度;embedding 向量化费用由平台承担,不计入用户用量、词元点数或智能体费用上限;one-api 不参与 embedding 配置,Works Square 只负责其他应计费模型调用的创建者词元点数账本。客户端区分目录加载中、加载失败与无可用模型,空状态提供管理员配置说明;「刷新知识库与模型」保留未提交名称,未确认的创建请求沿用原操作身份。 diff --git a/package.json b/package.json index ad370a43..9078ab0d 100644 --- a/package.json +++ b/package.json @@ -173,6 +173,7 @@ "i18next": "^25.8.11", "jsdom": "^28.1.0", "lucide-react": "^0.563.0", + "mdast-util-from-markdown": "2.0.3", "mpg123-decoder": "^1.0.3", "opusscript": "^0.1.1", "playwright-core": "1.59.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6b57e139..63d41a35 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -219,6 +219,9 @@ importers: lucide-react: specifier: ^0.563.0 version: 0.563.0(react@19.2.4) + mdast-util-from-markdown: + specifier: 2.0.3 + version: 2.0.3 mpg123-decoder: specifier: ^1.0.3 version: 1.0.3 diff --git a/src/pages/CloudAgents/CloudChat.tsx b/src/pages/CloudAgents/CloudChat.tsx index e307e636..8a65b6d3 100644 --- a/src/pages/CloudAgents/CloudChat.tsx +++ b/src/pages/CloudAgents/CloudChat.tsx @@ -389,6 +389,7 @@ export function CloudChat({ slug, previewRevision: latestRevision, initialThread