refactor: add DesignIR distillation pipeline
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
# DesignIR Pipeline
|
||||
|
||||
This directory owns the STEP reconstruction and distillation boundary:
|
||||
|
||||
```text
|
||||
teacher STEP
|
||||
-> deterministic private evidence extraction
|
||||
-> reconstruction agent authors DesignIR 2.0
|
||||
-> isolated compiler rebuilds STEP without teacher access
|
||||
-> acceptance agent compares teacher and rebuilt STEP
|
||||
-> deterministic publisher promotes repeated validated experience
|
||||
```
|
||||
|
||||
## Security boundary
|
||||
|
||||
| Component | Teacher STEP | Private evidence | DesignIR | Rebuilt STEP |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Ingestion service | read | write | no | no |
|
||||
| Reconstruction agent | denied | read | write | request compilation |
|
||||
| Isolated compiler | denied | no | read | write |
|
||||
| Acceptance agent | read | read | read | read |
|
||||
| Publisher | denied | aggregate only | schema only | reports only |
|
||||
|
||||
The reconstruction environment must remain functional after the teacher STEP is
|
||||
removed. `scripts/designir_pipeline.py anti-cheat` rejects source STEP
|
||||
references, imported B-Reps, embedded meshes, topology references, and generator
|
||||
source that calls STEP import APIs.
|
||||
|
||||
## Workspace
|
||||
|
||||
Runtime data is role-separated under `workspace/`:
|
||||
|
||||
For the exact input, process, acceptance, and output locations, see
|
||||
[`workspace/README.md`](workspace/README.md).
|
||||
|
||||
```text
|
||||
workspace/
|
||||
teacher/inbox/ uploaded STEP/STP files
|
||||
teacher/evidence/ private deterministic evidence
|
||||
reconstruction/inbox/ evidence packets for Agent A
|
||||
reconstruction/designir/ authored DesignIR 2.0
|
||||
reconstruction/output/ independently rebuilt STEP
|
||||
acceptance/inbox/ manifests visible to Agent B
|
||||
acceptance/reports/ geometry and editability reports
|
||||
promotion/candidates/ untrusted generalized methods
|
||||
promotion/replay_validated/
|
||||
promotion/promoted/ deterministic published experience
|
||||
quarantine/ unsupported vocabulary and failed cases
|
||||
```
|
||||
|
||||
Only `.gitkeep` files are versioned in runtime directories. Teacher geometry,
|
||||
private evidence, generated parts, and reports stay local.
|
||||
|
||||
## DesignIR 2.0
|
||||
|
||||
The executable contract is documented by
|
||||
`contracts/designir-2.0.schema.json`. It describes coordinate systems, datums,
|
||||
parameters, expressions, sketches, constraints, features, patterns,
|
||||
attachments, construction stages, edit interfaces, and validation contracts.
|
||||
It never contains teacher geometry.
|
||||
|
||||
The initial compiler deliberately supports a small, honest vocabulary through
|
||||
both Build123d and SimpleCADAPI adapters:
|
||||
|
||||
- `extrude_circle`
|
||||
- `extrude_rectangle`
|
||||
- `add_cylinder`
|
||||
- `through_hole`
|
||||
- `polar_hole_pattern`
|
||||
|
||||
Unsupported geometry is quarantined with explicit missing capabilities instead
|
||||
of embedding the source B-Rep.
|
||||
|
||||
The SimpleCADAPI adapter also emits its replayable
|
||||
`*.simplecad.model.json` operation graph beside the STEP. DesignIR remains the
|
||||
backend-neutral source of truth.
|
||||
|
||||
## Agents
|
||||
|
||||
- `agents/reconstruction-agent.md`: Agent A authors DesignIR from private
|
||||
evidence and promoted methods, then requests an isolated rebuild.
|
||||
- `agents/acceptance-agent.md`: Agent B independently checks geometry and
|
||||
parameter perturbations against the teacher.
|
||||
|
||||
Neither agent publishes experience. `config/promotion-policy.json` is evaluated
|
||||
by deterministic code after several independent cases pass.
|
||||
|
||||
## Commands
|
||||
|
||||
Use the CAD Python environment:
|
||||
|
||||
```bash
|
||||
../text-to-cad/.venv/bin/python scripts/designir_pipeline.py validate part.designir.json
|
||||
../text-to-cad/.venv/bin/python scripts/designir_pipeline.py compile \
|
||||
part.designir.json --output rebuilt.step
|
||||
../text-to-cad/.venv/bin/python scripts/designir_pipeline.py isolated-rebuild \
|
||||
part.designir.json --output rebuilt.step --backend simplecadapi
|
||||
../text-to-cad/.venv/bin/python scripts/designir_pipeline.py accept \
|
||||
--teacher teacher.step --designir part.designir.json \
|
||||
--rebuilt rebuilt.step --report acceptance.json
|
||||
```
|
||||
Reference in New Issue
Block a user