feat(skills): Scope B A2 — 4 竞品生成器注册表+上下文分派+端点接线

注册表 TOOLBOX +4 entry(continue/expand/de-ai/teardown,全 preview-only writes=[]);
ContextStrategy +with_prior_chapter/text_input;ToolGenerateRequest +text 字段。
toolbox_context 分派新策略(续写→build_continuation_context、原文→build_text_input_context);
路由续写经 chapter_repo 读最新 accepted/draft 正文注入 builder(core 不 import apps/api,仿 accept_op)。
预览仅 commit ledger 不写业务表(#3);只声明 tier(#2);system_prompt 进缓存前缀(#9)。
单测:4 生成器 generate 预览 + 续写读前文/草稿路由 + 扩写/降AI text 路由 + 拆书结构化;
更新 registry/strategy 计数测试(15 工具 / 6 策略)。门禁绿:ruff/format/mypy 196 files/pytest 168(api)+32(skills)。
This commit is contained in:
Yaojia Wang
2026-06-23 19:10:35 +02:00
parent 87dd09a797
commit a5351320a2
9 changed files with 417 additions and 15 deletions

View File

@@ -1,7 +1,8 @@
"""T6.2 创作工具箱注册表(`TOOLBOX`)单测。
校验11 条齐全legacy 3 + 新 8legacy 携 legacy_route 且 spec=None新工具携 spec +
output_schema与 spec.output_schema 一致ingest 工具的 table 在白名单内;`get_tool` 解析。
校验15 条齐全legacy 3 + 新 8 + 竞品快赢 4legacy 携 legacy_route 且 spec=None
新工具携 spec + output_schema与 spec.output_schema 一致ingest 工具的 table 在白名单内;
`get_tool` 解析。
"""
from __future__ import annotations
@@ -18,17 +19,22 @@ _NEW_KEYS = {
"glossary",
"opening",
"fine-outline",
# 竞品快赢Scope B续写 / 扩写 / 降AI率 / 拆书(全 preview-only
"continue",
"expand",
"de-ai",
"teardown",
}
_INGEST_KEYS = {"golden-finger", "glossary", "fine-outline"}
def test_toolbox_has_all_eleven_tools() -> None:
def test_toolbox_has_all_tools() -> None:
# Arrange / Act
keys = set(TOOLBOX.keys())
# Assert
# Assertlegacy 3 + 新 8 + 竞品快赢 4 = 15。
assert keys == _LEGACY_KEYS | _NEW_KEYS
assert len(TOOLBOX) == 11
assert len(TOOLBOX) == 15
def test_legacy_tools_have_route_and_no_spec() -> None: