跳转到内容

RFC-0005:STEP / 3MF / GLB 出口、损失与证书边界

状态:Proposed 文档版本:0.1.0 日期:2026-08-31 上位路线:Aira 长期架构计划 Phase 0B 相关规范:RFC-0003、RFC-0004

Aira 将交换文件视为 Revision 的有损边界投影,不把任何 STEP、3MF、GLB 或其导入结果升级为 AMIR authoring truth。.aira.json 是唯一承诺保留 Aira 参数、feature、constraint、SemanticRef、历史与锁定 规范的项目交换格式;几何出口必须绑定源 Revision/Evaluation/Artifact,并同时产生 Loss Report 与 Export Certificate。

v0.1 固定三种不重叠的出口 profile:

Profile 首要用途 合法源表示 主要实现候选 不允许声称
step.ap242-exact@0.1 工业精确几何与装配交付 ExactSolid / exact assembly OCCT XDE STEP writer Aira feature history/constraint 无损
3mf.manufacturing@0.1 增材制造 mesh、材料与显式 lattice certified MeshSolid / manufacturing assembly / Beam Lattice Lib3MF B-rep 精确曲面、通用 Field3D 无损
glb.visualization@0.1 Web/下游渲染与展示 RenderPacket / DisplayMesh Three.js GLTFExporter CAD、制造或测量权威

不提供“自动选择一个格式”的模糊 exporter。AI 必须根据用途发现具名 profile;输入表示不匹配时返回 typed Diagnostic 与显式 conversion 候选,不能静默 triangulate、fit surface 或换格式。

一次成功出口产生一个内容寻址 bundle,而不是只有一个下载文件:

  1. ExportArtifact:目标格式的原始 bytes、media type、byte size 与 content hash;
  2. ExportManifest:源 Revision/model/authoring lock、Evaluation/Artifact、format profile、exporter descriptor/build、execution location、单位/坐标/容差与全部选项;
  3. LossReport:每个语义维度的保留状态、原因与证据;
  4. ExportCertificate:格式 conformance、转换/round-trip/checker 结论与 assurance;
  5. 可选的目标格式内 provenance pointer,只指向上述 bundle identity。

文件名、下载路径、对象地址和浏览器 Blob URL 不进入身份。目标格式允许时可以嵌入 provenance 副本,但 接收器可能删除 extras、metadata 或附件,因此嵌入内容不是权威证据;Aira sidecar/bundle 才是。

Loss Report 不是自由文本警告。每项 claim 使用:

preserved | approximated | flattened | omitted | unsupported | notApplicable | unknown。

最小 claim matrix 必须覆盖:

  • 几何表示与误差界;
  • topology/assembly occurrence 与实例 transform;
  • 参数、feature history、constraint/formula;
  • SemanticRef 与 lineage;
  • 单位、坐标系、容差;
  • name、color、layer、material;
  • PMI/GD&T、validation property;
  • Field/lattice/voxel 语义;
  • Certificate、Diagnostic 与 source mapping。

preserved 必须有 checker evidence;仅因为 encoder 写出了字段,最多证明 encoded。无法检查时使用 unknown,不得把“库调用成功”翻译成“语义已保留”。任何 approximated 项必须记录误差 metric、limit、 checker ID/version 和结果 assurance。

当前工业目标固定为 ISO 10303-242 的具名 edition/profile,而不是裸字符串 STEP。ISO 已发布 ISO 10303-242:2025 Edition 4,其范围包括机械设计、装配、产品 数据管理、制造信息、验证与长期归档;但标准范围不等于某个 exporter 已覆盖全部 AP242。

OCCT 的 Data Exchange 模块声明支持 STEP AP203/AP214/AP242;XDE 可以处理 name、color、layer、material 等附加属性,官方概览也明确 shape healing 可能修改、删除或创建 sub-shape。因此 step.ap242-exact@0.1 必须锁定:

  • ISO edition 与具体 conformance class / implementation subset;
  • STEPCAFControl_Writer/XDE 的 build、参数、写模式与 resource files;
  • 源 ExactSolid/assembly Artifact 和全部 healing/transformation policy;
  • 支持并实际检查的 geometry、topology、assembly、unit、name/color/layer/material、PMI/GD&T 列表。

MeshSolid/Field3D 不能被无提示输出为“精确 STEP”。需要 STEP 时必须先执行显式、可诊断的表示转换;没有 可信 surface reconstruction contract 时返回 unsupported。Aira feature history、constraint、SemanticRef 和完整 Revision history 默认 omitted;即使写入非标准属性,也不能改报 preserved。

最低 Certificate 检查:writer status、STEP schema/profile、独立 parser 可读、导回后的 solid validity、 assembly occurrence、单位与几何/拓扑容差比较。PMI/GD&T 只在逐项 round-trip corpus 通过后声明 preserved。

3MF Consortium 当前把 Core、Beam Lattice、Materials/Properties、Production 等规范列为 ISO/IEC 25422:2025 规范套件。Aira v0.1 基线锁定:

  • Core 1.3.0;
  • Production 1.1.2;
  • Materials and Properties 1.2.1(按任务启用);
  • Beam Lattice 1.2.0(仅显式 beam graph);
  • 所有实际启用 extension 的 required/optional 状态和版本。

3MF Core 是带显式单位的 manufacturing mesh,不是 B-rep。Lane F 的规则是:

  • 通用 Field3D 先经过具名、可认证的 bounded meshing,再写 Core mesh;
  • 可表达为 node/beam/diameter graph 的结构可直接使用 Beam Lattice Extension;
  • 不能把三角化后的 lattice 冒充 beam graph,也不能把 beam graph 冒充原 Field 函数;
  • Production UUID 只用于包内构件追踪,不替代 Aira Artifact/SemanticRef identity。

Volumetric/Implicit Extension 1.0.0 已发布;发布状态不自动证明 browser writer、Lib3MF/WASM extension 覆盖或独立 consumer 互操作。Aira 将该 profile 标为 gated-unavailable,直到 schema/conformance suite 与 独立 consumer round-trip Gate 关闭;在此之前不得成为 production Field 出口或“无损 Field”承诺。

实现优先评估 Consortium 的 Lib3MF。其官方 WASM/JS wrapper 可用于现代 browser bundler,但当前发布成熟度、 内存初值、extension 覆盖与 conformance 必须由独立 spike 测量;仓库中现有传递依赖 @jscadui/3mf-export 不自动获得 production 资格。

最低 Certificate 检查:3MF schema/conformance suite、闭合定向 manifold mesh、单位、build item/UUID 唯一性、启用 extension 一致性、材料引用、beam radius/connectivity,以及导回后 geometry/assembly 比较。

glTF 是 Khronos 定义的 runtime 3D asset delivery 格式。规范定义 scene/node/mesh/material/animation,并固定 右手系、+Y up 与线性单位米;mesh primitive 面向 GPU draw call。参见 glTF 2.0.1 Registry 与 glTF 2.0 Specification。

因此 GLB 的权威源是 RenderPacket/DisplayMesh,不是 AMIR/ExactSolid 本体。Three.js GLTFExporter 是 v0.1 首选实现候选,但必须从规范 RenderPacket 构造专用 export scene;不能直接序列化当前交互 scene、selection helper、camera、grid 或调试对象。

必须记录 Aira→glTF 的轴、单位和 transform 变换。name 与 extras 只作提示/追溯副本,不是稳定 identity。 所有 parameter、constraint、B-rep surface、manufacturing tolerance、Field guarantee、Certificate authority 默认 omitted/approximated;GLB 通过 Khronos validator 也只证明格式有效,不证明 CAD 或可制造性。

最低 Certificate 检查:glTF validator、buffer/accessor bounds、finite transform、unit/basis transform、 triangle/material count、source-map coverage 与固定视图渲染 smoke。不得从截图相似推导几何正确。

出口拆为两个不同 effect:

  • export.prepare:bufferable,在任务隔离区生成 bundle;失败/取消零外部写入;
  • export.publish:irreversible,把已验证 bundle 写入下载、对象存储或外部系统,必须单步、最后执行并 重新检查 Session Grant、目标、content hash 与用户批准。

当前九元 Meta-operation transport 不扩张,也不得把 export.publish 伪装成 model.read 或 model.commit。production export 启用前必须通过 RFC-0002 的版本升级显式投影这两个 operation;用户在 纯 UI 中手动下载仍需先完成 prepare/validate,但发布授权来自用户动作而非 AI 自签。

执行位置是 policy,不改变格式语义:

  • GLB 默认浏览器客户端;
  • 3MF 在 Lib3MF WASM 的内存、包体和 conformance Gate 通过后优先浏览器,超预算转受信 worker;
  • STEP 对小/中模型可使用 capability-minimal OCCT browser worker,完整 XDE/AP242 或超预算装配可转 native/server worker;
  • 所有位置消费同一 Export Request,产生同一结构的 Manifest/Loss/Certificate,并在 ExecutionManifest 中披露 build/platform/feature set。

local-first 不等于“必须浏览器执行所有文件”。也不能因转到 server 就允许另一套容差、healing 或损失 语义;profile 不满足时返回 unavailable/unknown。

三个 profile 分别验收,不能以一个格式通过替代另一个:

  1. 官方 schema/validator/conformance suite 与 malformed/zip-bomb/oversize 安全 corpus;
  2. 至少两个独立下游实现的 import interoperability;
  3. source → export → independent import 的 geometry/topology/assembly/unit round-trip;
  4. 每个 Loss Report claim 的 mutation test,防止 preserved 误报;
  5. checker registry、版本、unknown propagation 与 Certificate DAG;
  6. browser/native/server 的 profile/manifest/receipt conformance;
  7. cancellation、失败和批准拒绝时零外部写入;
  8. 包体、峰值内存、时延、文件大小与大模型降级阈值。

RFC 进入 Accepted 前还需发布 Export Bundle schema、三个 locked profile、至少一个实现 Gate 和下一版 Meta-operation 投影。当前决议只关闭 Phase 0B 的格式职责、损失语义、Certificate 与 effect 边界;没有 启用 exporter,也没有增加现有 capability/transport surface。