maestro/docs/tools/downloadfile.md
oss-sync 29ccaf1e92
Some checks failed
CI / build-and-test (push) Has been cancelled
sync: update from private repo (dfadcd5f)
2026-06-23 06:38:48 +00:00

61 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# DownloadFile
URL からファイルをダウンロードしてワークスペースに保存する。
## 基本
```js
DownloadFile({
url: "https://example.com/chart.png",
filename: "images/sales-chart.png",
section: "output"
})
```
## パラメータ
- `url`: ダウンロード元 URL
- `filename`: 保存先パスsection 配下からの相対パス)
- `section`: `"input"` / `"output"` / `"source"`
- `"input"`: 後続処理の入力(既定)
- `"output"`: 成果物
- `"source"`: 調べ物・参照資料。スペースのソースライブラリ(`source/`)に蓄積され、出典付きで Files タブに一覧される。research 系のダウンロードはこれを推奨
## ファイル命名規約
### 画像(成果物に埋め込む場合)
- パス: `images/{わかりやすい名前}.png` (または .jpg / .webp / .gif
- section: `"output"`
- 命名は内容を表すスラッグkebab-case 推奨): `sales-q3-chart.png`, `product-screenshot-home.png`
### ダウンロード履歴
`logs/downloads.jsonl` に各ダウンロードのメタ情報URL, 保存先, サイズ)が記録される。
### ソースライブラリsection: "source"
スペースのタスクで `section: "source"` を指定すると、ファイルは `source/` に保存され、
出典メタファイル名・URL・取得日時・サイズ・ツール名`source/index.jsonl` に 1 行追記される。
これらは「そのスペースのソース(資料)」として蓄積され、後から追加調査やグラウンディングに使える。
WebFetch がスペース文脈でページ本文を取得した場合や、BrowseWeb がブラウザでページを閲覧した場合も、同じ `source/index.jsonl` に自動で記録される。
## 成果物への画像埋め込み
ダウンロードした画像は Markdown レポートから相対パスで埋め込める:
```markdown
![Q3 売上推移](./images/sales-q3-chart.png)
```
レポートoutput/report.mdと画像output/images/*.pngが同じ section 配下にあれば `./images/` で参照可能。
## SSRF 保護
WebFetch と同じく、ローカル/プライベート IP はデフォルトブロック。Settings UI の「SSRF Allowed Hosts」で例外設定可能。
## 注意
- 大きすぎるファイル数百MB以上はタイムアウトしやすい
- バイナリファイルPDF, 動画等)も保存可能だが、画像以外の用途では ReadPdf / TranscribeAudio 等の専用ツールも検討