feat(agent): downloader.list 能力与汇报计数规则(FIX-7)

智能体原先只能从 site.list 推断下载器,会把没看到汇报成下载器不在系统内。
新增只读能力 downloader.list(下载器与媒体服务器、连通状态、管理的任务数);
原因码表补能力错误、下载盘判定、站点登录与待处理类型,带分类前缀的码按后半段查;
汇报格式加「数量以工具返回为准」。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 23:59:51 +08:00
1 parent 68f53390f6
commit 1b22bb5131
12 files changed
+163 -9

No files matched your search

+31 -1
View File
@@ -48,6 +48,35 @@ const REASONS: Record<string, ReasonText> = {
not_imported_kind: { text: "这类文件不入库" },
target_root_not_managed: { text: "目标目录不是本工具管理的媒体库目录", action: "在设置 → 媒体库与目录里检查" },
download_removed: { text: "下载任务已从下载器删除" },
// FIX-7:智能体汇报与工具结果里常见的码(能力错误、下载计划的空间判定、站点登录、待处理类型)
invalid_input: { text: "参数不对" },
invalid_output: { text: "返回结果格式不对" },
unauthorized: { text: "需要你批准" },
forbidden: { text: "没有权限" },
not_found: { text: "没找到" },
precondition: { text: "前置条件不满足" },
internal: { text: "内部错误" },
volume_state_unknown: { text: "下载盘用量未知", action: "在下载面板检查下载盘" },
hard_threshold_reached: { text: "下载盘已到暂停线" },
projected_over_threshold: { text: "下完会超过下载盘暂停线" },
awaiting_resume_watermark: { text: "等下载盘降到恢复线" },
request_size_unknown: { text: "资源大小未知" },
inflight_size_unknown: { text: "在下的任务大小未知" },
budget_exceeded: { text: "超出下载额度" },
budget_unknown_size: { text: "资源大小未知,无法核对下载额度" },
no_downloader_instance: { text: "没有可用的下载器", action: "在设置 → 下载器里添加" },
download_save_path_unmapped: { text: "下载目录没有路径映射", action: "在设置 → 下载器里添加路径映射" },
site_out_of_scope: { text: "站点不在这次的范围内" },
slot_changed_or_reserved: { text: "收录版本已变化或被占用" },
auth_missing: { text: "站点没有配置 Cookie", action: "在站点账号里填写" },
auth_expired: { text: "站点登录已过期", action: "刷新站点登录" },
auth_invalid: { text: "站点登录无效", action: "检查站点账号" },
source_unreachable: { text: "站点连不上" },
download_failed: { text: "下载失败" },
download_stalled: { text: "下载无进展" },
space_insufficient: { text: "空间不足" },
unidentifiable: { text: "没识别出作品" },
user_deleted: { text: "已删除" },
};
/**
@@ -69,7 +98,8 @@ export function reasonText(raw: string | null | undefined): ReasonText | null {
...(parts[0]?.action ? { action: parts[0].action } : {}),
};
}
return REASONS[s] ?? REASONS[head] ?? null;
// 带分类前缀的码(`cache:volume_state_unknown`、`deferred:no_downloader_instance`)按冒号后的码查
return REASONS[s] ?? REASONS[head] ?? (rest ? (REASONS[rest.trim()] ?? null) : null);
}
/** 只要一句话:"没识别出作品。指定作品后重新整理";不认识的码返回 fallback */