* feat(skill): replace skill-pack with per-harness conditional compiler
skillbuild compiles the skill tree into per-target harness builds:
- <!-- skill:if omp,!claude --> blocks include text only for matching
targets; name-list conditions only, no else/nesting, fail-loud on
unknown targets and unpaired/nested directives
- fence-aware: directive-looking lines inside code fences are literal
- layout is the filesystem; tree root configured in skillproj.toml
- post-build assertion: zero directive residue, SKILL.md frontmatter
name check
Migration to the new model:
- docs/skill/ becomes the self-contained source root (SKILL.md,
references/, generated api/stdlib/core/guides now under
references/docs/; SDK_OVERVIEW/LICENSE/inspect are ordinary tree
files)
- auto_docs_gen output redirected into the tree (docs/api ->
docs/skill/references/docs/api, likewise stdlib)
- skills/simplecadapi/ is now the compiled omp target output;
dist/generic/simplecadapi the generic target
- dropped skill-pack entry point (plus dangling evolve/make-export
entries and their orphaned test), release workflow builds via
skillbuild + tar; README updated
First real conditional block: harness reading paths in SKILL.md
(skill:// mount on omp vs disk-relative on generic).
Verified: 59 tests pass (skillbuild 31, auto_docs_gen 19, persistence
regression 9); both targets build; outputs residue-clean; full suite
collects (1376 tests).
* refactor(tools): auto_docs_gen moves out of the installed package
tools/ scripts are repo-checkout dev scripts, not packaged CLIs:
- auto_docs_gen.py now lives in tools/ beside the other generators;
auto_tools/ package removed entirely
- path resolution simplifies: repo root = parent of tools/, fail-loud
if pyproject.toml missing; site-packages/cwd fallback branches were
dead code once the script stopped shipping in the wheel
- auto-docs-gen console script dropped from [project.scripts];
release.yml and README invoke python tools/auto_docs_gen.py
- MANIFEST.in stale src/auto_tools include removed; CadQuery-free
runtime scan no longer needs the auto_tools filter
- run_examples.py retired (user removal): README example-runner text
updated to direct examples/ scripts; dangling runner-contract test
(runpy.run_path into the deleted script) removed
Verified: 53 tests pass (auto_docs_gen + skill_build + ocp runtime
scan) and test_example_model_contract passes; regeneration from
tools/ is byte-identical (zero docs drift).
* refactor(skill): strip harness and build-tool content from the skill tree
The skill is plain harness-neutral content again:
- SKILL.md 'Reading skill files' section removed (the omp skill://
mount block and its !omp complement were the only conditional
blocks; the tree compiles identically for every target now)
- references/README.md: build-tool meta removed ('per-harness
conditional compilation', skillbuild packaging/validation claims —
link validation was never implemented, so the claim was false)
- live test now asserts the tree stays harness-neutral (zero blocks)
- skillproj.toml targets aligned with the user's output table
(omp -> skills/simplecadapi-omp, opencode -> skills/simplecadapi-opencode;
leftover 'generic' entry had no output and failed the build)
- compiled outputs are regenerable artifacts: skills/simplecadapi/
untracked from git, skills/simplecadapi-*/ gitignored, release.yml
and README build via skillbuild and tar the omp output directly
(bsdtar has no --transform; inner dir keeps its suffixed name)
Verified: 49 tests pass; both targets build 372 files with zero
conditional blocks; no omp/conditional/directive residue in the tree
or outputs.
* chore(docs): drop stale architecture review and design notes
5.8 KiB
SimpleCADAPI 2.0.4b2 更新说明
Beta 版本提示: 以下改动将在 2.0.4 正式版之前继续验证。用于生产前, 请检查逆向得到的几何以及生成的 CAD 文档。
SimpleCADAPI 2.0.4b2 新增面向 Agent 的 STEP/BREP 逆向工作流。此前已有的检查和 严格比较能力,现在被组织成一套聚焦、与 Agent 框架无关、可以迭代调用的工具接口。 本版本还增加了可回放的插值 B 样条轮廓,用于自由曲线和周期轮廓重建。
1. 带稳定索引的 STEP/BREP 检查
simplecadapi.inverse_engineer.brep 现在会为每个 STEP 输入建立有界缓存的
BRepModel。Body、Face、Edge 和 Vertex 会获得确定性的零基 ID,例如
body:0、face:12 和 edge:4,Agent 可以在多次检查调用之间持续引用同一局部
拓扑实体。
模型摘要会报告有效性、材料实体数量、包围盒、体积、表面积、质心、拓扑数量以及 解析曲面/曲线统计。可选的有界分组会给出重复载体参数、规范轴线和邻接签名,作为 验证假设的证据;这些分组本身不会自动推断阵列或模式。
实体检查会返回几何参数、包围盒、邻接关系、端点微分,以及可选的精确 B 样条或 Bezier 定义。曲面载体定义与修剪环证据保持明确分离,避免把未修剪载体误认为完整 Face。
2. 与 Agent 框架无关的工具接口
新的 agent_tool_schemas() 注册表提供 17 个经过 JSON Schema 校验的工具,
call_agent_tool(...) 则在不依赖特定 Agent 框架的情况下完成分发:
get_model_summary inspect_entity
get_topology_neighborhood measure_relation
make_section extract_face_boundaries
probe_point render_region
compare_global_properties compare_boundary_distance
compute_material_difference compare_sections
build_difference_regions find_nearby_entities
compare_entities evaluate_result
compare_brep_strict
simplecad-brep tools 用于输出工具 Schema;simplecad-brep tool 可以通过内联
JSON 或 --arguments-file 调用单个工具,因此 shell 驱动的 Agent 和外部编排器可以
复用同一份契约。
3. 局部诊断和验收门槛
局部查询工具可以展开有界拓扑邻域,测量受支持的平行、共面、共轴、同心、垂直、 接触和相切关系,生成物理截面,提取有序 Face 边界环,并查找空间点附近的稳定索引 实体。紧凑截面和边界模式会保留结构证据,同时省略大规模采样数组。
候选模型诊断现在包括:
- Body、包围盒、体积、面积、质心和拓扑全局差异;
- 双向“采样边界到精确边界”距离;
- 通过双向 Boolean Cut 获得的严格缺失/多余材料分量;
- 同一物理平面上的目标/候选截面对比;
- 按重要程度排序的材料或边界差异区域及附近实体查找;
- 局部实体参数和邻接关系对比。
evaluate_result(...) 会在一份报告中执行回放、BREP 有效性、材料、包围盒、体积、
面积和边界门槛。带几何标签的严格邻接图比较仍为可选项。使用 fuzzy tolerance 的
Boolean 结果只能用于诊断,不能证明严格材料相等。
4. 不改变几何状态的局部截图
render_region(...) 可以在半透明上下文模型上高亮稳定实体及其可选拓扑邻域。
已有的 render_step_views(...) 继续提供同步的等轴测和正交全景视图。
渲染现在只对脱离原模型的 BREP 副本进行网格化,因此 OpenCascade 三角剖分不会 改变缓存模型的测量包围盒,也不会影响同一进程内后续 Agent 验收。
5. 可回放插值 B 样条
公共建模 API 新增:
make_interpolated_spline_redge(...)
make_interpolated_spline_rwire(...)
make_periodic_spline_rwire(...)
开放和周期曲线通过 OCP 内核穿过输入点完成插值,并检查最少点数和重复点容差。 构造数据会保留在模型图 metadata 中。规范 Model JSON 可以记录并严格回放插值 Edge,包括表达式参数点;周期轮廓还可以继续生成可回放的 Face 和 Loft。
6. Reconstruction Agent 工作流
新的逆向规范定义三种明确模式:
- inspection-only reconstruction:限制读取完整控制点数组;
- report-assisted reconstruction:允许按目标实体读取精确曲线/曲面数据;
- exact BREP transcription:允许使用完整载体、修剪和拓扑证据,但必须把结果 明确标记为转录,而不是推断得到的特征历史。
工作流要求隔离输入和输出、先写出可证伪的特征假设、平面特征默认采用 Sketch-first、 在新进程中完成模型回放、生成有效 BREP,并根据测量结果进行最终分类。昂贵的 Boolean、 密集边界采样和严格拓扑检查只在低成本证据表明候选足够接近后执行。
7. 验证
回归测试覆盖稳定实体 ID、有界工具 Schema、紧凑截面和边界定义、跨模型关系语义、 材料差异严格性、差异区域复用、验收门槛、局部截图无副作用、插值曲线回放、表达式 保留以及周期轮廓 Loft 回放。
此外还使用带通孔实体执行了真实 STEP 往返验证。目标 STEP 与回放 STEP 在全景截图和 局部高亮截图之后,仍通过严格材料、边界、有效性以及带几何标签的邻接图门槛。