Skip to content

The only downloader you need. 下载器的集大成者。

feat(context): 添加 Fetched Task Options 及其解析逻辑

XiaoYouChR6ef0c1cc1ed6
diff --git a/CONTEXT.md b/CONTEXT.md
index 195b5e13..0891e4bf 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -77,9 +77,15 @@ The full path of a Task's finished file; equals `outputFolder / name`.
**Task Options**:
The app-owned options used to parse, create, or edit a Task. Frozen dataclass
with subtypes: ResourceTaskOptions, PageTaskOptions, MergeTaskOptions,
-BinaryInstallOptions.
+FetchedTaskOptions, BinaryInstallOptions.
_Avoid_: payload (keep only at raw transport seams)
+**Fetched Task Options**:
+A second-pass parse input for small response bodies already fetched by a
+parser. Used when the HTTP fallback discovers that a URL returned a descriptor
+format owned by a more specific parser, such as BitTorrent metadata.
+_Avoid_: using it for large user files.
+
**Task Parser**:
A FeaturePack-provided capability that turns Task Options into a Task.
Declares a `priority` and a `match(options)` predicate.
@@ -274,7 +280,7 @@ and are checked first; HttpParser (100) is the fallback, checked last.
| MergeParser | 60 | `isinstance(options, MergeTaskOptions)` |
| YouTubeParser | 70 | YouTube domain |
| M3U8Parser | 80 | `.m3u8`/`.mpd` in URL or local manifest |
-| TorrentParser | 85 | `magnet:` scheme or `.torrent` |
+| TorrentParser | 85 | `magnet:` scheme, `.torrent`, or fetched BitTorrent metadata |
| HuggingFaceParser | 85 | HuggingFace domain |
| GitHubParser | 90 | GitHub file URL + proxy configured |
| FtpParser | 95 | `ftp`/`ftps` scheme |
@@ -289,6 +295,11 @@ Delegation patterns:
through the priority chain.
- **InstallParser** delegates the download through
`featureService.parse(TaskOptions(url=...))` so GitHubParser mirrors it.
+- **HttpParser** may fetch a small response body and call
+ `featureService.parse(FetchedTaskOptions(...))` when
+ `featureService.matchFetched(...)` says a more specific parser matches the
+ fetched response metadata. HttpParser does not match Fetched Task Options, so
+ second-pass routing cannot fall back to itself.
## Ownership rules