feat(asset-download): share download_asset across agent, MCP and CLI

Turn the agent-only download_asset tool into an Operation on all three
surfaces.

- download_asset takes up to 50 file or version stack IDs and returns
  presigned links. proxy (default true) picks the web preview when there
  is one, as the agent always did; proxy: false returns the original.
  Folders are rejected. Read is checked on every ID before anything runs.
- Agent: an extension saves the files into the .pi sandbox and keeps the
  agent-only storage key mode (e.g. frames from read_asset). Agent tool
  extensions gain description, parameterOverrides and intercept.
- CLI: `shumai-cli download <assetId...> [--out <dir>] [--original]`
  streams files to disk without overwriting existing names.
- read_asset's unsupported-type error now names the right way to
  download on each surface (download_asset, or `shumai-cli download`).
- Add the Download Asset toggle to agent settings.
This commit is contained in:
yiling
2026-10-26 22:33:30 +08:00
parent b7dccad6e5
commit bc3368f3e3
40 changed files with 1323 additions and 579 deletions
@@ -112,6 +112,11 @@ const BUILTIN_TOOLS = [
name: () => m.agent_tool_create_version_name(),
description: () => m.agent_tool_create_version_desc(),
},
{
id: 'download_asset',
name: () => m.agent_tool_download_asset_name(),
description: () => m.agent_tool_download_asset_desc(),
},
{
id: 'generate_image',
name: () => m.agent_tool_generate_image_name(),
+2
View File
@@ -609,6 +609,8 @@
"agent_tool_read_skill_desc": "Allows the agent to load and read skill definitions to perform specialized actions.",
"agent_tool_read_asset_name": "Read Asset",
"agent_tool_read_asset_desc": "Allows the agent to view and inspect images, video frames, and document pages.",
"agent_tool_download_asset_name": "Download Asset",
"agent_tool_download_asset_desc": "Allows the agent to download files to its workspace to process them with scripts or terminal commands.",
"agent_tool_get_asset_render_name": "Get Asset Render",
"agent_tool_get_asset_render_desc": "Allows the agent to pick up video frames or document pages that took longer to render.",
"agent_tool_list_projects_name": "List Projects",
+2
View File
@@ -609,6 +609,8 @@
"agent_tool_read_skill_desc": "允许智能体加载和读取技能定义以执行特定操作。",
"agent_tool_read_asset_name": "读取资源",
"agent_tool_read_asset_desc": "允许智能体查看和分析图片、视频画面和文档页面。",
"agent_tool_download_asset_name": "下载资源",
"agent_tool_download_asset_desc": "允许智能体将文件下载到其工作区,以便用脚本或终端命令处理。",
"agent_tool_get_asset_render_name": "获取资源渲染结果",
"agent_tool_get_asset_render_desc": "允许智能体获取渲染耗时较长的视频画面或文档页面。",
"agent_tool_list_projects_name": "列出项目",