Files
cdsl-cad/backend
likang 738934416e feat(cadfs): 扩展重建引擎能力并固化代表性模型回归
- 扩展 CDSL engine 的 shell、sweep、loft、reference plane、pattern 等运行时能力,
  支持新的实体结果模式、双向拉伸、曲线扫掠、镜像/圆周阵列及相关 selector 解析。
- 完善 Build123d 适配层的拓扑快照、Compound/ShapeList 兼容处理和旋转曲面识别,
  兼容 Python 3.12 / 当前 Build123d 缺少 axis_of_rotation 的合法曲面场景。
- 扩展 CDSL schema、profile schema、capability analysis、semantic validation 和
  sketch solver,使新增建模操作能够被校验、执行并保留可诊断的部分结果。
- 完善 CADFS FeatureScript lowering:
  支持 shell、sweep、surface/实体 loft、圆周阵列副本、镜像副本、删除阵列实例、
  新 body 操作、更多拉伸终止条件和 reference plane 变体。
- 补齐椭圆、B-spline、环形区域、imprint、SWEPT_FACE、CAP_FACE、OFFSET_FACE 等
  草图和拓扑引用的转换逻辑,改善后续特征的工作平面、轴线和 profile 定位精度。
- 改进 selector binding:支持 pattern 前缀复合 B-rep 快照、交集顶点引用、
  多面 match_mode=all、圆柱轴线/半径和面积下限等稳定匹配条件。
- 修复 MID_PLANE 法向统一后交线方向未同步的问题,恢复 00287955 基准面的正确位置;
  修复 00542223 sweep 路径反转后的切线契约和 00423838 的拓扑面数不稳定测试假设。
- 修正 CADFS 比较模块 import 路径,补充重建报告、批量重建脚本、目标文档和 README。
- 新增并扩展 engine、lowering、parser、selector binding、reports、integration 和
  Onshape pipeline 回归测试,覆盖代表性 CADFS 特征链及运行时兼容性。
2026-09-08 11:47:10 +08:00
..
2026-08-25 17:41:24 +08:00
2026-08-19 19:34:30 +08:00
2026-09-01 14:10:23 +08:00
2026-08-19 19:34:30 +08:00
2026-08-31 14:16:08 +08:00
2026-08-27 18:59:33 +08:00
2026-08-26 14:13:11 +08:00
2026-09-01 14:10:23 +08:00

Backend

The backend owns the application API and CAD generation workflow:

  • app/: HTTP API, jobs, orchestration, and persistence adapters.
  • agent/: AI prompts, tools, and skills used by the generation agent.
  • engine/: CDSL compiler, sketch solver, and STEP generation runtime.
  • cdsl_library/: Official CDSL examples, metadata, and search index.
  • tests/: Engine, API, and end-to-end generation tests.

Expected development entrypoint: app.main:app, served by Uvicorn.

Reasoning Effort

The backend uses the Chat Completions API. Configure a provider's reasoning budget with CDSL_<PROVIDER>_REASONING_EFFORT; for the current OpenAI setup:

CDSL_OPENAI_REASONING_EFFORT=medium

Use low, medium, or high according to the latency/cost versus quality tradeoff. The setting is sent as Chat Completions' reasoning_effort field to authoring, streaming, and visual-review requests. Leave it empty to use the provider/model default. The selected OpenAI-compatible endpoint must support the requested value.

Autonomous CDSL Agent Configuration

The autonomous agent writes one frozen free-form requirements.md, then observes, measures, renders and appends one CDSL feature at a time. Its author uses normal function calls; no provider strict JSON Schema capability or complete modelling DAG is required. Candidate fragments are rebuilt in a staging directory through cdsl_only before a checkpoint can be committed.

Final publication requires a separately configured vision-capable review model and the Python OpenCascade/Pillow technical renderer. The agent may build and inspect intermediate checkpoints without image review; a final run fails closed if its independent review configuration is unavailable.

# Must name one configured provider and one model listed in that provider's
# CDSL_<PROVIDER>_VISION_MODELS setting. It is intentionally not inferred
# from the authoring model.
CDSL_REVIEW_PROVIDER=deepseek
CDSL_REVIEW_MODEL=deepseek-v4-flash-vision-exp
CDSL_DEEPSEEK_VISION_MODELS=deepseek-v4-flash-vision-exp

# Install Python rendering dependencies. The renderer reads the revision STEP
# file and creates canonical images without a browser or GPU driver.
pip install -r requirements.txt

# Limits apply to the current checkpoint head, never to total task complexity.
CDSL_AGENT_TOOL_CALLS_PER_CYCLE=12
CDSL_AGENT_CANDIDATE_ATTEMPTS_PER_HEAD=3
CDSL_AGENT_CONSECUTIVE_NO_PROGRESS_LIMIT=6
CDSL_AGENT_MAX_FEATURES_PER_FRAGMENT=6
CDSL_AGENT_CONTEXT_CHAR_LIMIT=24000
CDSL_AGENT_RENDER_CACHE=true

The author chooses each coherent 1-6 feature batch. Every rebuilt batch is rendered and independently reviewed before it can become a checkpoint; only an accepted reviewer verdict advances the working model. Every checkpoint is rebuilt from its fully materialized CDSL through the cdsl_only runtime. Checkpoint GLB files are preview-only; STEP, CDSL, and reports are available only after the task reaches COMPLETED.

The backend assigns feature and sketch IDs, appends causal dependencies and expands only opaque current-snapshot selector tokens. It does not compile geometry templates or correct workplanes, profiles, sizes, directions or boolean semantics authored by the model. Failed candidates remain auditable but never become revisions.