feat(agent): add read-only download.list capability

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-30 18:47:15 +08:00
1 parent 0023872b9b
commit 0f20c19b7c
6 files changed
+294 -7

No files matched your search

+44
View File
@@ -322,6 +322,47 @@ export const DownloadInspectOutput = z.object({
otherMatches: z.array(Id),
});
/** download.list(AG-5):列出下载任务(按状态 / 作品 / 名称筛选),给模型"先列再看",不用向用户要 ID 或 hash */
export const DownloadListInput = z.object({
/** 只列这些状态;缺省全部(不含已移除) */
status: z.array(DownloadStatus).max(11).optional(),
/** 按下载任务名或作品名模糊匹配(至少 2 个字符) */
query: z.string().trim().min(2).max(200).optional(),
mediaEntityId: Id.optional(),
/** 也列外部任务(不是本工具提交的);缺省只列本工具管理的 */
includeExternal: z.boolean().default(false),
limit: z.number().int().min(1).max(50).default(20),
});
export const DownloadListOutput = z.object({
total: NonNegInt,
/** 按状态计数(筛选后、limit 前) */
byStatus: z.array(z.object({ status: DownloadStatus, label: z.string(), count: NonNegInt })),
items: z.array(
z.object({
/** 下载任务 ID,交给 download.inspect / download.recheck */
id: Id,
name: z.string(),
/** 关联作品名 */
title: z.string().nullable(),
status: DownloadStatus,
/** 界面用词:下载中 / 已入库 / 失败… */
statusLabel: z.string(),
/** "37%" */
progress: z.string(),
/** "12.3 GB";未知为 null */
size: z.string().nullable(),
downloader: z.string().nullable(),
managed: z.boolean(),
/** 相对时间:"3 小时前" */
lastProgress: z.string().nullable(),
noProgressSince: z.string().nullable(),
completed: z.string().nullable(),
/** 最近一次错误的一句话 */
error: z.string().nullable(),
}),
),
});
/** downloader.list(FIX-7):已配置的下载器与媒体服务器(只读本地记录,不含地址和凭证) */
export const DownloaderListInput = z.object({
includeDisabled: z.boolean().default(true),
@@ -879,6 +920,7 @@ export const CAPABILITY_IO = {
"subscription.list": { input: SubscriptionListInput, output: SubscriptionListOutput },
"decision.list": { input: DecisionListInput, output: DecisionListOutput },
"download.inspect": { input: DownloadInspectInput, output: DownloadInspectOutput },
"download.list": { input: DownloadListInput, output: DownloadListOutput },
"downloader.list": { input: DownloaderListInput, output: DownloaderListOutput },
"agent.spawn": { input: AgentSpawnInput, output: AgentSpawnOutput },
"agent.await": { input: AgentAwaitInput, output: AgentAwaitOutput },
@@ -956,6 +998,8 @@ export type DecisionListInput = z.infer<typeof DecisionListInput>;
export type DecisionListOutput = z.infer<typeof DecisionListOutput>;
export type DownloadInspectInput = z.infer<typeof DownloadInspectInput>;
export type DownloadInspectOutput = z.infer<typeof DownloadInspectOutput>;
export type DownloadListInput = z.infer<typeof DownloadListInput>;
export type DownloadListOutput = z.infer<typeof DownloadListOutput>;
export type DownloaderListInput = z.infer<typeof DownloaderListInput>;
export type DownloaderListOutput = z.infer<typeof DownloaderListOutput>;
export type AgentSpawnInput = z.infer<typeof AgentSpawnInput>;