Repository navigation
feat: 通过现有能力接口预览工作区图片 - #1
Draft
renji1hao8 wants to merge 1 commit into
Draft
renji1hao8 wants to merge 1 commit into
renji1hao8 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本地 MATLAB 或绘图程序生成的图片目前不能直接作为 MCP image 内容返回给聊天客户端。本变更通过现有
capability_discover/capability_execute增加file.preview:先发现完整定义,再用工作区图片路径调用,客户端收到图片内容及路径、MIME、大小元数据。公共 Tool surface 保持 12 个。图片在目标设备经
WorkspaceManager读取,受read.max_bytes和 512 KiB 硬上限约束;读取采用 limit+1,拒绝越界、非普通文件、超大内容和不支持的签名。支持 PNG/JPEG/GIF/WebP/BMP,不依赖 Chrome 扩展或新增 Python 包。Hub 仅在 MCP 边界把 Agent 的 JSON 图片载荷转换为内容块,既有浏览器能力调用仍返回原字典结构。本 PR 只贡献有界图片预览,不包含个人 Plus 分支的附件导入、通用上传下载、HTTP 下载入口或 PDF/Office 转换。中英文 README、能力说明和结果契约已补充。
验证环境:Windows / Python 3.12.14,按上游锁文件安装 dev 与 pywebview-gui 依赖。
pytest -q -k 'not native':2210 passed、41 skipped、29 deselected、1 failed。失败为已有test_recursive_delete_timeout_disconnect_and_reconnect_never_replay[True]的 30 ms 时序断言,收到 capability_timeout 而非 capability_unavailable;本 PR 未改变该浏览器执行路径。后续独立复核结果见补充记录。git diff --check通过。补充复核:
pytest -q tests/test_browser_phase4c.py tests/test_file_preview.py tests/test_browser_integration.py得到 65 passed、1 skipped,包含上面失败用例及新增的真实远程图片传输。本次没有改写或放宽那个 30 ms 断言;全量首次失败记录仍保留供审阅。客户端是否内联展示图片仍由其 MCP 多模态支持决定;此次验证的是字节与协议传输,不将其当作所有 ChatGPT 客户端的界面兼容性证明。