feat(agent): 集数待确认的智能体兜底——查看上下文 / 模拟 / 写规则三个能力,写入前强制模拟,接后台调查与授权内恢复

能力 ID 的域名允许单个下划线分词(episode_mapping)。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-10-03 20:08:20 +08:00
1 parent 45a114263b
commit 7793c7b3bc
27 files changed
+1747 -48

No files matched your search

+44 -2
View File
@@ -24,8 +24,11 @@ export const MutationPlan = z.object({
});
export type MutationPlan = z.infer<typeof MutationPlan>;
/** 能力 ID:`域.动作`,如 download.submit */
export const CapabilityId = z.string().regex(/^[a-z][a-z0-9]*\.[a-z][a-z0-9_]*$/);
/**
* 能力 ID:`域.动作`,如 download.submit;域名可用单个下划线分词(episode_mapping.inspect),
* 不以下划线结尾、不含连续下划线,工具名(`域__动作`)按第一个 `__` 反向切分仍无歧义
*/
export const CapabilityId = z.string().regex(/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*\.[a-z][a-z0-9_]*$/);
export type CapabilityId = z.infer<typeof CapabilityId>;
// ── 能力描述符与首批能力(任务书 §3.1-9;REQ §10.3) ──
@@ -94,6 +97,9 @@ export const CAPABILITY_IDS = [
"metadata.enrich",
"metadata.resolve_organize",
"schedule.draft_check",
"episode_mapping.inspect",
"episode_mapping.simulate",
"episode_mapping.apply_rule",
] as const;
export const KnownCapabilityId = z.enum(CAPABILITY_IDS);
export type KnownCapabilityId = z.infer<typeof KnownCapabilityId>;
@@ -629,6 +635,39 @@ export const CAPABILITY_CATALOG: Record<KnownCapabilityId, CapabilityDescriptor>
false,
"safe",
),
"episode_mapping.inspect": d(
"episode_mapping.inspect",
"看集数映射上下文",
"集数待确认时用:按事项(或作品 + 来源季 + 发布组)取上下文——事项内资源的原标题、发布时间、原始季集与当前结果,同组近期其他资源,季表(每季总集数、每集播出日期与标题),现有规则(含停用原因),确定性建议规则。写规则前先看这个",
"read",
"EpisodeMappingInspect",
"read",
"low",
true,
false,
),
"episode_mapping.simulate": d(
"episode_mapping.simulate",
"模拟映射规则",
"试一条草稿映射规则(expression 偏移表达式 / table 对照表 / special 特别篇·花絮·忽略),逐条给出套用后的季集与校验,并汇总事项内样本是否全部解决、有没有让已对上的资源变成待确认。不写规则;智能体会话里带 decisionId 且模拟通过时,规则和理由会作为智能体建议留在事项上,由用户确认",
"preview",
"EpisodeMappingSimulate",
"read",
"low",
true,
false,
),
"episode_mapping.apply_rule": d(
"episode_mapping.apply_rule",
"写映射规则",
"把草稿映射规则写进作品并按作品重算资源的集数。服务端先强制模拟:事项内样本必须全部解决、已对上的资源不能变成待确认,否则拒绝不写。先用 episode_mapping.simulate 确认通过再调用,每个事项只写一次;拿不准就不要写",
"execute",
"EpisodeMappingApplyRule",
"organize.execute",
"medium",
false,
true,
),
};
/**
@@ -691,6 +730,9 @@ export const CAPABILITY_ACTIVITY: Record<KnownCapabilityId, CapabilityActivity>
"web.fetch": act("读", "网页", "个"),
"metadata.resolve_organize": act("补全", "整理元数据"),
"metadata.enrich": act("补全", "元数据"),
"episode_mapping.inspect": act("查", "集数映射"),
"episode_mapping.simulate": act("模拟", "映射规则", "次"),
"episode_mapping.apply_rule": act("写入", "映射规则", "条"),
};
function d(