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:
@@ -1,7 +1,7 @@
|
||||
"""T6 创作工具箱声明式描述符类型单测(Wave-0 契约)。
|
||||
|
||||
仅校验描述符**类型**本身(无 TOOLBOX 注册表 seeding——那是 Wave A):
|
||||
- `ContextStrategy`:4 种注入策略字面量;
|
||||
- `ContextStrategy`:注入策略字面量(4 基础 + 续写/原文输入 2 竞品策略);
|
||||
- `InputField`:声明式表单字段(label/type/required/default/help);
|
||||
- `IngestSpec`:可选入库目标(table 必须在 KNOWN_TABLES,None=纯预览);
|
||||
- `GeneratorTool`:生成器声明(legacy 带 legacy_route 且 spec 可为 None;新工具带 spec+schema)。
|
||||
@@ -45,18 +45,20 @@ def _spec() -> AgentSpec:
|
||||
# ---- ContextStrategy ----
|
||||
|
||||
|
||||
def test_context_strategy_has_four_values() -> None:
|
||||
def test_context_strategy_values() -> None:
|
||||
# Arrange / Act
|
||||
from typing import get_args
|
||||
|
||||
values = set(get_args(ContextStrategy))
|
||||
|
||||
# Assert
|
||||
# Assert:4 基础策略 + 竞品快赢 2 策略(续写读前文 / 原文输入)。
|
||||
assert values == {
|
||||
"brief_only",
|
||||
"with_project",
|
||||
"with_world",
|
||||
"with_outline_chapter",
|
||||
"with_prior_chapter",
|
||||
"text_input",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"""T6.2 创作工具箱注册表(`TOOLBOX`)单测。
|
||||
|
||||
校验:11 条齐全(legacy 3 + 新 8);legacy 携 legacy_route 且 spec=None;新工具携 spec +
|
||||
output_schema(与 spec.output_schema 一致);ingest 工具的 table 在白名单内;`get_tool` 解析。
|
||||
校验:15 条齐全(legacy 3 + 新 8 + 竞品快赢 4);legacy 携 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
|
||||
# Assert:legacy 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:
|
||||
|
||||
Reference in New Issue
Block a user