@metamesh/generator-sdk 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +62 -50
  3. package/dist/authoring.d.ts +11 -2
  4. package/dist/authoring.d.ts.map +1 -1
  5. package/dist/authoring.js +11 -2
  6. package/dist/authoring.js.map +1 -1
  7. package/dist/docs/guides/authoring.md +4 -4
  8. package/dist/docs/guides/package.md +62 -50
  9. package/dist/docs/guides/parameters.md +8 -9
  10. package/dist/docs/manifest.json +272 -384
  11. package/dist/docs/reference/fonts/FontSelection.md +6 -3
  12. package/dist/docs/reference/fonts/isFontSelection.md +3 -3
  13. package/dist/docs/reference/index/ArrayParameterDefinition.md +3 -2
  14. package/dist/docs/reference/index/BaseParameterDefinition.md +5 -2
  15. package/dist/docs/reference/index/BooleanParameterDefinition.md +3 -2
  16. package/dist/docs/reference/index/ChoiceOption.md +3 -2
  17. package/dist/docs/reference/index/ChoiceParameterDefinition.md +3 -2
  18. package/dist/docs/reference/index/ChoiceSetParameterDefinition.md +3 -2
  19. package/dist/docs/reference/index/ColorParameterDefinition.md +3 -2
  20. package/dist/docs/reference/index/ConditionExpression.md +3 -2
  21. package/dist/docs/reference/index/ContourAnchor.md +1 -1
  22. package/dist/docs/reference/index/ContourParameterDefinition.md +3 -2
  23. package/dist/docs/reference/index/ContourParameterUi.md +3 -2
  24. package/dist/docs/reference/index/ContourPoint.md +1 -1
  25. package/dist/docs/reference/index/ContourSegment.md +3 -2
  26. package/dist/docs/reference/index/ContourValue.md +6 -3
  27. package/dist/docs/reference/index/FontParameterDefinition.md +3 -2
  28. package/dist/docs/reference/index/GeneratorDefinition.md +3 -2
  29. package/dist/docs/reference/index/GeneratorIssue.md +1 -1
  30. package/dist/docs/reference/index/GeneratorModule.md +1 -1
  31. package/dist/docs/reference/index/GeneratorModuleOptions.md +5 -2
  32. package/dist/docs/reference/index/GeneratorParamId.md +1 -1
  33. package/dist/docs/reference/index/GeneratorParams.md +1 -1
  34. package/dist/docs/reference/index/GeneratorPreset.md +3 -2
  35. package/dist/docs/reference/index/GeneratorProgram.md +1 -1
  36. package/dist/docs/reference/index/GeneratorServices.md +6 -2
  37. package/dist/docs/reference/index/GeneratorTextArcBaseline.md +1 -1
  38. package/dist/docs/reference/index/GeneratorTextLayout.md +1 -1
  39. package/dist/docs/reference/index/GeneratorTextMetrics.md +10 -3
  40. package/dist/docs/reference/index/GeneratorTextOptions.md +7 -1
  41. package/dist/docs/reference/index/MAX_CONTOUR_SEGMENTS.md +1 -1
  42. package/dist/docs/reference/index/MAX_SIDE_PROFILE_SEGMENTS.md +1 -1
  43. package/dist/docs/reference/index/NumberArrayItemDefinition.md +3 -2
  44. package/dist/docs/reference/index/NumberArrayParameterDefinition.md +3 -2
  45. package/dist/docs/reference/index/NumberParameterDefinition.md +4 -3
  46. package/dist/docs/reference/index/NumberParameterUi.md +3 -2
  47. package/dist/docs/reference/index/ParameterDefinition.md +3 -2
  48. package/dist/docs/reference/index/ParameterDefinitionDocument.md +3 -2
  49. package/dist/docs/reference/index/ParameterGroup.md +1 -1
  50. package/dist/docs/reference/index/ParameterIssue.md +4 -3
  51. package/dist/docs/reference/index/ParameterIssueCode.md +1 -1
  52. package/dist/docs/reference/index/ParameterIssueSeverity.md +3 -2
  53. package/dist/docs/reference/index/ParameterScaleReference.md +5 -3
  54. package/dist/docs/reference/index/ParameterUi.md +5 -3
  55. package/dist/docs/reference/index/ParameterValidationResult.md +3 -2
  56. package/dist/docs/reference/index/ParameterValue.md +3 -2
  57. package/dist/docs/reference/index/ParameterValues.md +3 -2
  58. package/dist/docs/reference/index/RowParameterUi.md +3 -2
  59. package/dist/docs/reference/index/ScalarParameterValue.md +3 -2
  60. package/dist/docs/reference/index/SideProfileAnchor.md +1 -1
  61. package/dist/docs/reference/index/SideProfileParameterDefinition.md +3 -2
  62. package/dist/docs/reference/index/SideProfileParameterUi.md +3 -2
  63. package/dist/docs/reference/index/SideProfilePoint.md +1 -1
  64. package/dist/docs/reference/index/SideProfileSegment.md +3 -2
  65. package/dist/docs/reference/index/SideProfileValue.md +6 -3
  66. package/dist/docs/reference/index/SourceVisibility.md +1 -1
  67. package/dist/docs/reference/index/StringArrayItemDefinition.md +3 -2
  68. package/dist/docs/reference/index/StringArrayParameterDefinition.md +3 -2
  69. package/dist/docs/reference/index/SvgParameterDefinition.md +3 -2
  70. package/dist/docs/reference/index/TextParameterDefinition.md +3 -2
  71. package/dist/docs/reference/index/UNPREPARED_GENERATOR_SERVICES.md +1 -1
  72. package/dist/docs/reference/index/cloneContourValue.md +3 -3
  73. package/dist/docs/reference/index/cloneSideProfileValue.md +3 -3
  74. package/dist/docs/reference/index/contourValuesEqual.md +1 -1
  75. package/dist/docs/reference/index/defineGenerator.md +7 -3
  76. package/dist/docs/reference/index/defineGeneratorModule.md +1 -1
  77. package/dist/docs/reference/index/definePresets.md +8 -3
  78. package/dist/docs/reference/index/evaluateCondition.md +1 -1
  79. package/dist/docs/reference/index/isContourValue.md +1 -1
  80. package/dist/docs/reference/index/isSideProfileValue.md +1 -1
  81. package/dist/docs/reference/index/sideProfileValuesEqual.md +1 -1
  82. package/dist/docs/reference/modeling/GeneratorModel.md +1 -1
  83. package/dist/docs/reference/modeling/ModelDeliveryEncoder.md +14 -5
  84. package/dist/docs/reference/modeling/defineGeneratorModel.md +4 -1
  85. package/dist/docs/reference/modeling/parseGeneratorModel.md +8 -6
  86. package/dist/docs/reference/packages/GENERATOR_PACKAGE_FORMAT_VERSION.md +2 -2
  87. package/dist/docs/reference/packages/GeneratorAccess.md +3 -2
  88. package/dist/docs/reference/packages/GeneratorDefinitionIssue.md +3 -2
  89. package/dist/docs/reference/packages/GeneratorDefinitionParseResult.md +3 -2
  90. package/dist/docs/reference/packages/GeneratorDescriptor.md +3 -2
  91. package/dist/docs/reference/packages/GeneratorPackageManifest.md +3 -2
  92. package/dist/docs/reference/packages/GeneratorPackageSource.md +3 -2
  93. package/dist/docs/reference/packages/GeneratorPackageValidationError.md +3 -2
  94. package/dist/docs/reference/packages/GeneratorRuntimeReference.md +3 -2
  95. package/dist/docs/reference/packages/InstalledGenerator.md +3 -2
  96. package/dist/docs/reference/packages/MAX_ARRAY_ITEMS.md +2 -2
  97. package/dist/docs/reference/packages/MAX_CONDITION_BRANCHES.md +2 -2
  98. package/dist/docs/reference/packages/MAX_CONDITION_DEPTH.md +2 -2
  99. package/dist/docs/reference/packages/MAX_DESCRIPTOR_LIST_ITEMS.md +2 -2
  100. package/dist/docs/reference/packages/MAX_GENERATOR_ID_LENGTH.md +1 -1
  101. package/dist/docs/reference/packages/MAX_GENERATOR_PACKAGE_BYTES.md +2 -2
  102. package/dist/docs/reference/packages/MAX_GENERATOR_PRESETS.md +2 -2
  103. package/dist/docs/reference/packages/MAX_METADATA_TEXT_LENGTH.md +1 -1
  104. package/dist/docs/reference/packages/MAX_PARAMETERS.md +2 -2
  105. package/dist/docs/reference/packages/MAX_PARAMETER_GROUPS.md +2 -2
  106. package/dist/docs/reference/packages/MAX_PARAMETER_OPTIONS.md +2 -2
  107. package/dist/docs/reference/packages/MAX_TEXT_PARAMETER_LENGTH.md +2 -2
  108. package/dist/docs/reference/packages/METAMESH_RUNTIME_VERSION.md +3 -3
  109. package/dist/docs/reference/packages/compareSemanticVersions.md +7 -2
  110. package/dist/docs/reference/packages/isRuntimeCompatible.md +8 -2
  111. package/dist/docs/reference/packages/parseGeneratorDefinition.md +3 -2
  112. package/dist/docs/reference/packages/parseGeneratorDescriptor.md +3 -2
  113. package/dist/docs/reference/packages/parseGeneratorPackageManifest.md +8 -2
  114. package/dist/docs/reference/packages/parseParameterDefinitionDocument.md +3 -2
  115. package/dist/docs/reference/packages/safeParseGeneratorDefinition.md +1 -1
  116. package/dist/docs/reference/packages/safeParseParameterDefinitionDocument.md +1 -1
  117. package/dist/docs/reference/packages/validateGeneratorPresets.md +9 -3
  118. package/dist/docs/reference/parameters/EMPTY_SVG_PARAMETER_DEFAULT.md +2 -2
  119. package/dist/docs/reference/parameters/MAX_PARAMETER_ISSUES.md +2 -2
  120. package/dist/docs/reference/parameters/MAX_PARAMETER_ISSUE_MESSAGE_LENGTH.md +2 -2
  121. package/dist/docs/reference/parameters/MAX_PROJECT_SVG_PARAMETER_BYTES.md +2 -2
  122. package/dist/docs/reference/parameters/MAX_SVG_PARAMETER_BYTES.md +2 -2
  123. package/dist/docs/reference/parameters/ParamCodec.md +3 -2
  124. package/dist/docs/reference/parameters/ParamDecodeCode.md +3 -2
  125. package/dist/docs/reference/parameters/ParamDecodeError.md +3 -2
  126. package/dist/docs/reference/parameters/ParamDecodeIssue.md +3 -2
  127. package/dist/docs/reference/parameters/ParamParseResult.md +3 -2
  128. package/dist/docs/reference/parameters/aggregateParameterIssues.md +6 -2
  129. package/dist/docs/reference/parameters/createParamCodec.md +3 -1
  130. package/dist/docs/reference/parameters/getDefaultParameters.md +3 -2
  131. package/dist/docs/reference/parameters/normalizeParameters.md +3 -1
  132. package/dist/docs/reference/parameters/parameterValueEquals.md +3 -2
  133. package/dist/docs/reference/parameters/parseParameterIssues.md +5 -5
  134. package/dist/docs/reference/parameters/svgParameterBytes.md +3 -2
  135. package/dist/docs/reference/runtime/ExecuteGeneratorOptions.md +4 -2
  136. package/dist/docs/reference/runtime/GenerateRequest.md +3 -2
  137. package/dist/docs/reference/runtime/GenerationError.md +3 -2
  138. package/dist/docs/reference/runtime/GenerationInvalid.md +3 -2
  139. package/dist/docs/reference/runtime/GenerationSuccess.md +3 -2
  140. package/dist/docs/reference/runtime/GeneratorExecutionGenerated.md +3 -2
  141. package/dist/docs/reference/runtime/GeneratorExecutionInvalid.md +3 -2
  142. package/dist/docs/reference/runtime/GeneratorExecutionResult.md +3 -2
  143. package/dist/docs/reference/runtime/MeshResourceData.md +1 -1
  144. package/dist/docs/reference/runtime/MeshTopologyMode.md +3 -3
  145. package/dist/docs/reference/runtime/ModelBounds.md +3 -2
  146. package/dist/docs/reference/runtime/ModelData.md +1 -1
  147. package/dist/docs/reference/runtime/ModelDelivery.md +1 -1
  148. package/dist/docs/reference/runtime/ModelPartData.md +5 -4
  149. package/dist/docs/reference/runtime/ModelStats.md +1 -1
  150. package/dist/docs/reference/runtime/ModelTimings.md +6 -4
  151. package/dist/docs/reference/runtime/ParsedGeneratorModule.md +3 -2
  152. package/dist/docs/reference/runtime/PartDelivery.md +1 -1
  153. package/dist/docs/reference/runtime/PartDeliveryDecoder.md +6 -2
  154. package/dist/docs/reference/runtime/PartDeliveryLimits.md +7 -3
  155. package/dist/docs/reference/runtime/RuntimeError.md +3 -2
  156. package/dist/docs/reference/runtime/ValidateRequest.md +3 -2
  157. package/dist/docs/reference/runtime/ValidationError.md +3 -2
  158. package/dist/docs/reference/runtime/ValidationSuccess.md +3 -2
  159. package/dist/docs/reference/runtime/WorkerRequest.md +4 -3
  160. package/dist/docs/reference/runtime/WorkerResponse.md +4 -3
  161. package/dist/docs/reference/runtime/canonicalizeParameters.md +8 -3
  162. package/dist/docs/reference/runtime/executeGenerator.md +1 -1
  163. package/dist/docs/reference/runtime/generationIssues.md +9 -3
  164. package/dist/docs/reference/runtime/parseGenerationSentAt.md +7 -3
  165. package/dist/docs/reference/runtime/parseGeneratorModule.md +8 -3
  166. package/dist/docs/reference/runtime/parseModelParts.md +4 -1
  167. package/dist/fonts.d.ts +5 -2
  168. package/dist/fonts.d.ts.map +1 -1
  169. package/dist/fonts.js +1 -1
  170. package/dist/fonts.js.map +1 -1
  171. package/dist/generator-module.d.ts +3 -0
  172. package/dist/generator-module.d.ts.map +1 -1
  173. package/dist/generator-module.js.map +1 -1
  174. package/dist/generator-package/constants.d.ts +6 -1
  175. package/dist/generator-package/constants.d.ts.map +1 -1
  176. package/dist/generator-package/constants.js +6 -2
  177. package/dist/generator-package/constants.js.map +1 -1
  178. package/dist/generator-package/contracts.d.ts +2 -0
  179. package/dist/generator-package/contracts.d.ts.map +1 -1
  180. package/dist/generator-package/index.d.ts +0 -1
  181. package/dist/generator-package/index.d.ts.map +1 -1
  182. package/dist/generator-package/index.js.map +1 -1
  183. package/dist/generator-package/parse-package.d.ts +7 -0
  184. package/dist/generator-package/parse-package.d.ts.map +1 -1
  185. package/dist/generator-package/parse-package.js +7 -0
  186. package/dist/generator-package/parse-package.js.map +1 -1
  187. package/dist/generator-package/schemas/descriptor.schema.d.ts +1 -0
  188. package/dist/generator-package/schemas/descriptor.schema.d.ts.map +1 -1
  189. package/dist/generator-package/schemas/manifest.schema.d.ts +4 -1
  190. package/dist/generator-package/schemas/manifest.schema.d.ts.map +1 -1
  191. package/dist/generator-package/validate-manifest.d.ts +7 -1
  192. package/dist/generator-package/validate-manifest.d.ts.map +1 -1
  193. package/dist/generator-package/validate-manifest.js +7 -1
  194. package/dist/generator-package/validate-manifest.js.map +1 -1
  195. package/dist/generator-package/versions.d.ts +11 -0
  196. package/dist/generator-package/versions.d.ts.map +1 -1
  197. package/dist/generator-package/versions.js +11 -0
  198. package/dist/generator-package/versions.js.map +1 -1
  199. package/dist/generator-services.d.ts +19 -2
  200. package/dist/generator-services.d.ts.map +1 -1
  201. package/dist/generator-services.js.map +1 -1
  202. package/dist/index.d.ts +0 -2
  203. package/dist/index.d.ts.map +1 -1
  204. package/dist/index.js +0 -1
  205. package/dist/index.js.map +1 -1
  206. package/dist/modeling-delivery.d.ts +14 -8
  207. package/dist/modeling-delivery.d.ts.map +1 -1
  208. package/dist/modeling-delivery.js +12 -13
  209. package/dist/modeling-delivery.js.map +1 -1
  210. package/dist/modeling.d.ts +10 -5
  211. package/dist/modeling.d.ts.map +1 -1
  212. package/dist/modeling.js +10 -5
  213. package/dist/modeling.js.map +1 -1
  214. package/dist/parameters/conditions.d.ts +1 -0
  215. package/dist/parameters/conditions.d.ts.map +1 -1
  216. package/dist/parameters/conditions.js.map +1 -1
  217. package/dist/parameters/contours.d.ts +6 -2
  218. package/dist/parameters/contours.d.ts.map +1 -1
  219. package/dist/parameters/contours.js +1 -1
  220. package/dist/parameters/contours.js.map +1 -1
  221. package/dist/parameters/contracts.d.ts +8 -1
  222. package/dist/parameters/contracts.d.ts.map +1 -1
  223. package/dist/parameters/definitions.d.ts +33 -3
  224. package/dist/parameters/definitions.d.ts.map +1 -1
  225. package/dist/parameters/issues.d.ts +10 -4
  226. package/dist/parameters/issues.d.ts.map +1 -1
  227. package/dist/parameters/issues.js +10 -4
  228. package/dist/parameters/issues.js.map +1 -1
  229. package/dist/parameters/limits.d.ts +7 -1
  230. package/dist/parameters/limits.d.ts.map +1 -1
  231. package/dist/parameters/limits.js +7 -1
  232. package/dist/parameters/limits.js.map +1 -1
  233. package/dist/parameters/recovery.d.ts +3 -0
  234. package/dist/parameters/recovery.d.ts.map +1 -1
  235. package/dist/parameters/recovery.js +3 -0
  236. package/dist/parameters/recovery.js.map +1 -1
  237. package/dist/parameters/side-profiles.d.ts +6 -2
  238. package/dist/parameters/side-profiles.d.ts.map +1 -1
  239. package/dist/parameters/side-profiles.js +1 -1
  240. package/dist/parameters/side-profiles.js.map +1 -1
  241. package/dist/parameters/strict.d.ts +7 -0
  242. package/dist/parameters/strict.d.ts.map +1 -1
  243. package/dist/parameters/strict.js +3 -0
  244. package/dist/parameters/strict.js.map +1 -1
  245. package/dist/parameters/values.d.ts +5 -0
  246. package/dist/parameters/values.d.ts.map +1 -1
  247. package/dist/parameters/values.js +5 -0
  248. package/dist/parameters/values.js.map +1 -1
  249. package/dist/runtime/execute-generator.d.ts +12 -1
  250. package/dist/runtime/execute-generator.d.ts.map +1 -1
  251. package/dist/runtime/execute-generator.js +7 -1
  252. package/dist/runtime/execute-generator.js.map +1 -1
  253. package/dist/runtime/model-contracts.d.ts +11 -6
  254. package/dist/runtime/model-contracts.d.ts.map +1 -1
  255. package/dist/runtime/parameter-identities.d.ts +6 -1
  256. package/dist/runtime/parameter-identities.d.ts.map +1 -1
  257. package/dist/runtime/parameter-identities.js +6 -1
  258. package/dist/runtime/parameter-identities.js.map +1 -1
  259. package/dist/runtime/parse-generator-module.d.ts +7 -1
  260. package/dist/runtime/parse-generator-module.d.ts.map +1 -1
  261. package/dist/runtime/parse-generator-module.js +6 -1
  262. package/dist/runtime/parse-generator-module.js.map +1 -1
  263. package/dist/runtime/part-delivery.d.ts +13 -2
  264. package/dist/runtime/part-delivery.d.ts.map +1 -1
  265. package/dist/runtime/part-delivery.js +8 -1
  266. package/dist/runtime/part-delivery.js.map +1 -1
  267. package/dist/runtime/worker-contracts.d.ts +18 -29
  268. package/dist/runtime/worker-contracts.d.ts.map +1 -1
  269. package/dist/runtime/worker-contracts.js +5 -1
  270. package/dist/runtime/worker-contracts.js.map +1 -1
  271. package/dist/validation/errors.d.ts +4 -1
  272. package/dist/validation/errors.d.ts.map +1 -1
  273. package/dist/validation/errors.js +2 -1
  274. package/dist/validation/errors.js.map +1 -1
  275. package/dist/validation/parse-definition.d.ts +2 -0
  276. package/dist/validation/parse-definition.d.ts.map +1 -1
  277. package/dist/validation/parse-definition.js +2 -0
  278. package/dist/validation/parse-definition.js.map +1 -1
  279. package/dist/validation/portable-data.d.ts.map +1 -1
  280. package/dist/validation/portable-data.js +1 -0
  281. package/dist/validation/portable-data.js.map +1 -1
  282. package/dist/validation/schemas/common.schema.d.ts +0 -1
  283. package/dist/validation/schemas/common.schema.d.ts.map +1 -1
  284. package/dist/validation/schemas/common.schema.js +1 -1
  285. package/dist/validation/schemas/common.schema.js.map +1 -1
  286. package/dist/validation/schemas/definition.schema.d.ts +0 -7
  287. package/dist/validation/schemas/definition.schema.d.ts.map +1 -1
  288. package/dist/validation/schemas/definition.schema.js +1 -1
  289. package/dist/validation/schemas/definition.schema.js.map +1 -1
  290. package/package.json +3 -3
  291. package/dist/docs/reference/index/FontSelection.md +0 -14
  292. package/dist/docs/reference/index/isFontSelection.md +0 -10
  293. package/dist/docs/reference/modeling/toWorldMeshes.md +0 -10
  294. package/dist/docs/reference/packages/GeneratorPreset.md +0 -14
  295. package/dist/docs/reference/runtime/Export3mfRequest.md +0 -18
  296. package/dist/docs/reference/runtime/ExportError.md +0 -13
  297. package/dist/docs/reference/runtime/ExportSuccess.md +0 -13
  298. package/dist/docs/reference/runtime/ExportedFile.md +0 -13
  299. package/dist/generator-package/versions.spec.d.ts +0 -2
  300. package/dist/generator-package/versions.spec.d.ts.map +0 -1
  301. package/dist/generator-package/versions.spec.js +0 -12
  302. package/dist/generator-package/versions.spec.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # @metamesh/generator-sdk
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fe33c89: Give modeling operations, pure geometry values, numerical kernels, and mechanical calculations distinct public entry points. Import fluent values from `/geometry`, tuple and matrix kernels from `/geometry/math`, and mechanical calculations from `/geometry/mechanical`. Remove root geometry factory re-exports and ambient `matchProfiles` and thread-preflight wrappers; pure preparation accepts explicit resolution and limits exposed by the generation context.
8
+
9
+ Bounds extrema and pattern/attachment placements return fluent values. Construct anchors with one options object, project fluent vectors onto planes, and multiply raw matrices with `multiplyTransform3(left, right)`. Remove retired exports and update the SDK, CLI, Studio authoring environment, and consumers without compatibility aliases.
10
+
11
+ - 5654590: Give every public declaration exactly one import path. Shared types remain available from their owning module; consuming entries reference those types without re-exporting them. Import all export writers from `@metamesh/modeling/export`; remove the format subpaths. Import SDK font selections from `/fonts` and Generator presets from the SDK root. Remove alternate import metadata and enforce unique source and published declaration ownership without compatibility aliases.
12
+ - 6455ccf: Support chamfered ends on twisted extrusions, measuring normal-section setbacks on the finished
13
+ helical walls and preserving corner and hole correspondence. Ordinary extrusions retain their
14
+ native fast path. Enabled twisted end treatments support chamfers; other treatments and taper
15
+ with ends remain unsupported.
16
+
17
+ Breaking: replace extrusion `scaleTop` with `scale` and `divisions` with positive `slices`, counting
18
+ longitudinal intervals. Loft `slices` also counts intervals per supplied gap. End treatments add
19
+ required rings to the extrusion's requested grid. Open sweep scalar and XY `scale` now taper from
20
+ one to the final scale by path length; station arrays retain explicit scale control. Scale in the
21
+ profile's local axes before twisting, and refine untwisted sweep deformation by physical resolution.
22
+
23
+ Compiled Generators require execution protocol and runtime major 13. Rebuild packages for the new
24
+ binding; package format 5 is unchanged.
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [fe33c89]
29
+ - Updated dependencies [d5dd213]
30
+ - Updated dependencies [ae34a4f]
31
+ - Updated dependencies [d5dd213]
32
+ - Updated dependencies [52e4e07]
33
+ - Updated dependencies [5654590]
34
+ - Updated dependencies [382d312]
35
+ - Updated dependencies [6455ccf]
36
+ - @metamesh/modeling@0.20.0
37
+
38
+ ## 0.19.0
39
+
40
+ ### Minor Changes
41
+
42
+ - c9de510: Extend straight extrusion end finishing to concave outlines, holes, and disconnected regions.
43
+ Add independent-solid `join` with a feature datum and a smooth (default) or straight width/height
44
+ transition against validated planar, angled, and curved sampled support patches. Both profiles use
45
+ the same support, collar, and whole-volume containment proofs.
46
+
47
+ Breaking: compiled Generators require Modeling runtime major 12. Rebuild packages for the new
48
+ host contract; old compiled runtimes are rejected. Joining preserves the supplied operands and
49
+ does not promise a circular fillet radius or perform automatic placement.
50
+
51
+ Replace named lazy `computed` readers with eager `memo(fn, ...args)` values. Stable pure helpers
52
+ reuse immutable arguments and tracked current params/context reads, with bounded recent histories
53
+ and native geometry retention. Update Studio diagnostics to warn about fresh function identities.
54
+ All authored and compiled callers must use the new API; there is no compatibility surface.
55
+
56
+ - de3d234: Add runtime-neutral STL, 3MF, and GLB export under `@metamesh/modeling/export`, with isolated
57
+ format entry points and backpressure-aware streaming writers. All formats consume captured local
58
+ geometry, placement, and appearance, with independent limits, cancellation, and structured
59
+ information-loss diagnostics. Standard 3MF color groups carry appearance, while base materials
60
+ and multiproperties retain explicit material identities independently of RGB values. These
61
+ properties do not assign slicer filaments or physical device trays. Add `mesh.render()` for
62
+ shared crease-aware display buffers that preserve exact triangle coordinates.
63
+
64
+ Breaking: remove `export3mf` and export types from `/engine`, remove SDK export request protocols
65
+ and `toWorldMeshes`, and return owned `Uint8Array` bytes with format metadata from the shared
66
+ exporters. Studio uses one export worker for every format. CLI captures use format version 3;
67
+ replace `run --export-3mf` with `metamesh export RUN_DIRECTORY --format 3mf --output model.3mf`.
68
+ Captured-run export also supports STL and GLB without rerunning source. No legacy export paths
69
+ or capture readers are retained.
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [c9de510]
74
+ - Updated dependencies [de3d234]
75
+ - @metamesh/modeling@0.19.0
76
+
3
77
  ## 0.18.0
4
78
 
5
79
  ### Minor Changes
package/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # `@metamesh/generator-sdk`
2
2
 
3
- Define typed controls, presets, and portable contracts for MetaMesh Generators. Use one definition
4
- for the editing interface, saved parameter values, and model execution.
3
+ Turn a parametric model into a reusable MetaMesh Generator. Define its controls and presets once,
4
+ then use that definition to infer parameter types, validate saved values, and connect the model
5
+ to an editing interface.
5
6
 
6
7
  > **Preview:** `0.x` minor releases may break compatibility. Patches remain compatible within the
7
8
  > same minor line.
8
9
 
9
10
  ## Installation
10
11
 
11
- For the modeling example below, install matching SDK and Modeling releases:
12
+ Install matching SDK and Modeling releases to build the Generator below:
12
13
 
13
14
  ```bash
14
15
  pnpm add @metamesh/generator-sdk @metamesh/modeling
@@ -18,13 +19,15 @@ The package publishes ES modules only. Use Node.js 24 or newer. TypeScript consu
18
19
  TypeScript 6.0 or newer, `strict` checking, and `NodeNext` or `Bundler` module resolution.
19
20
  Browser hosts need an ES2023-compatible runtime; the SDK's data contracts require no WebAssembly.
20
21
 
21
- The SDK can also be used alone for definitions, parameter handling, and package validation.
22
- Only its optional `/modeling` adapter imports the Modeling runtime.
22
+ You can also use the SDK on its own for definitions, parameter handling, and package validation.
23
+ The optional `/modeling` adapter connects it to Modeling; your application supplies the interface
24
+ and execution host.
23
25
 
24
26
  ## Define controls
25
27
 
26
- A Generator combines serializable metadata with a synchronous model program. This module defines
27
- a sleeve, infers its parameter types, and checks the relationship between its diameters:
28
+ A Generator combines a definition with a synchronous model program. This example makes a sleeve
29
+ with two diameter controls. Parameter types come from the definition, and an assertion checks
30
+ that the bore fits inside the outer wall:
28
31
 
29
32
  ```ts
30
33
  import { defineGenerator } from "@metamesh/generator-sdk";
@@ -57,21 +60,16 @@ export default defineGeneratorModel(definition, ({ params, assert, part }) => {
57
60
  });
58
61
  ```
59
62
 
60
- The adapter binds the definition to the model and produces a Generator module. Use
61
- `defineGeneratorModule({ definition, program })` to bind an existing program. A Generator runtime
62
- is itself a Modeling program: engines and direct model tests execute `runtime`.
63
- Format 5 carries the callback and identity in one object; nested
64
- format-4 runtimes are unsupported. Hosts normalize parameters, prepare assets,
65
- and execute the model; they own the forms, viewing, persistence, and export.
66
- Add named, complete starting values with `definePresets(definition, presets)`.
67
-
68
- `defineGenerator` validates structural and semantic metadata immediately; `definePresets` validates
69
- preset metadata and complete canonical parameter values. Invalid input throws
70
- `GeneratorPackageValidationError` at declaration. Both helpers retain the supplied object or array
71
- and its inferred literal types. Inline parameter, editor, choice, and preset objects receive
72
- TypeScript excess-property checks. Structural typing can hide extra fields in variables or generic
73
- factories; runtime validation checks those fields too. These helpers validate metadata and values,
74
- not model geometry or cross-parameter assertions.
63
+ `defineGeneratorModel` binds the definition to the model and infers its parameters and services.
64
+ If you already have a program, use `defineGeneratorModule({ definition, program })`. The resulting
65
+ runtime is a Modeling program that an engine or model test can execute directly.
66
+ Add named starting configurations with `definePresets(definition, presets)`; each preset supplies
67
+ a complete parameter map.
68
+
69
+ Definitions and presets contain serializable data, without callbacks. Hosts normalize parameters,
70
+ prepare assets, and execute the model. They also own forms, viewing, persistence, and export.
71
+ Generator modules use format 5, which carries the callback and identity in one object;
72
+ nested format-4 runtimes are unsupported.
75
73
 
76
74
  ## Generator capabilities
77
75
 
@@ -82,43 +80,57 @@ not model geometry or cross-parameter assertions.
82
80
  | Parameters and presets | Inferred TypeScript types, defaults, recovering normalization, strict codecs, and complete serializable presets. |
83
81
  | Host integration | Validated package manifests, module execution, Worker messages, and incremental mesh delivery. |
84
82
 
85
- Definitions and presets contain data, not callbacks. Conditional visibility changes the editing
86
- interface; hidden values remain saved and still require validation. Cross-parameter constraints
87
- belong in the model's assertions.
83
+ Conditional visibility changes which controls appear. Hidden values remain saved and still
84
+ require validation. Put constraints between parameters in the model's assertions.
85
+
86
+ ## Validate definitions and values
87
+
88
+ `defineGenerator` checks the definition as soon as you declare it. `definePresets` checks preset
89
+ metadata and complete canonical values. Invalid declarations throw
90
+ `GeneratorPackageValidationError`. These helpers retain the supplied object or array and its
91
+ inferred literal types; they don't execute geometry or model assertions.
92
+
93
+ Inline parameter, editor, choice, and preset objects receive TypeScript excess-property checks.
94
+ Runtime validation also catches extra fields that structural typing can hide in variables or
95
+ generic factories.
88
96
 
89
97
  Use `normalizeParameters` to recover saved values: it drops unknown keys, restores defaults, and
90
- clamps numbers. At strict boundaries, `createParamCodec(definition)` rejects incomplete, unknown, invalid, or
91
- noncanonical values. The [parameter guide](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/develop/parameters-and-validation.mdx)
98
+ clamps numbers. Use `createParamCodec(definition)` when inputs must already be complete and
99
+ canonical; it rejects missing or unknown fields and invalid values. The
100
+ [parameter guide](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/develop/parameters-and-validation.mdx)
92
101
  covers controls, conditions, and validation.
93
102
 
94
- Use the codec's `parse()` to throw on invalid input, or `safeParse()` for a discriminated result.
95
- Failure produces issues without substitute parameters. Codec issues use the shared `ParameterIssue`
96
- shape: `parameterId` names the control, and an optional `path` is relative to that control's value.
97
- Hosts can pass the issues directly to `aggregateParameterIssues`.
103
+ Use the codec's `parse()` to throw on invalid input, or `safeParse()` for a result you can check
104
+ without catching an exception. A failed parse reports issues without substitute parameters. Each `ParameterIssue` names
105
+ a control with `parameterId`; an optional `path` addresses a field within that control's value.
106
+ Hosts can pass these issues directly to `aggregateParameterIssues`.
107
+
108
+ ## Execute and deliver a model
98
109
 
99
110
  `executeGenerator` always validates its single `parameters` map against the current definition.
100
- Hosts may validate before loading assets, but execution does not accept a prior parse result as a
101
- validation bypass. Modeling hosts use `parseGeneratorModel(value, definition)` from `/modeling`
102
- to validate an unknown module and infer its executable `GeneratorModel<typeof definition>` type.
103
- Pass the default export itself for local entries that also export their definition; packaged
104
- namespaces contain only the default export. The runtime-neutral `parseGeneratorModule` remains
105
- available from `/runtime`. Invalid envelopes throw `TypeError`. Package validation exposes MetaMesh
106
- issues and errors, keeping its schema-library adapters private.
107
-
108
- Worker model statistics use `signedVolume` in mm³. `generateMs` measures the engine run;
109
- `timings.totalMs` measures the host workflow and includes stages outside the engine.
110
- `byteCount` counts finalized world-space position and index buffer bytes, counting shared buffers
111
- once; it does not measure the local buffers transferred by a Worker.
112
- Timing stages are optional; hosts report the phases they actually measure. The parameter-processing
113
- stage is `paramsMs` and finalization is `finalizeMs`.
114
-
115
- For Worker hosts, `/modeling` supplies `ModelDeliveryEncoder` and `toWorldMeshes`; `/runtime`
116
- supplies `PartDeliveryDecoder`. Transfers carry local buffers under `geometry`, with placement
117
- beside them. Decode resource references before application use and convert to world meshes before
118
- export. Receiving hosts own the buffers and keep them immutable and attached.
111
+ Hosts can validate before loading assets, but execution still checks the supplied values.
112
+ Modeling hosts use `parseGeneratorModel(value, definition)` from `/modeling` to validate a loaded
113
+ module and infer its executable `GeneratorModel<typeof definition>` type. Pass the default export
114
+ itself for local entries that also export their definition; packaged namespaces contain only the
115
+ default export. Use `parseGeneratorModule` from `/runtime` when you don't need the Modeling adapter.
116
+ Invalid module envelopes throw `TypeError`; package validation reports MetaMesh issues and errors.
117
+
118
+ For Worker hosts, `/modeling` supplies `ModelDeliveryEncoder`; `/runtime` supplies `PartDeliveryDecoder`.
119
+ Transfers carry local buffers under `geometry`, with placement beside them. Decode resource
120
+ references before application use or export. Receiving hosts own the buffers and keep them immutable
121
+ and attached.
122
+
123
+ Model statistics use `signedVolume` in mm³. `generateMs` measures the engine run;
124
+ `timings.totalMs` covers the host workflow, including stages outside the engine. Hosts report only
125
+ the timing stages they measure, using `paramsMs` for parameter processing and `finalizeMs` for
126
+ finalization. `byteCount` counts finalized world-space position and index buffer bytes, counting
127
+ shared buffers once; it doesn't measure the local buffers transferred by a Worker.
119
128
 
120
129
  ## API entry points
121
130
 
131
+ Each public type and function has one import path. Import `FontSelection` and `isFontSelection`
132
+ from `/fonts`, and `GeneratorPreset` from the package root.
133
+
122
134
  | Import | Responsibility |
123
135
  | ------------------------------------ | ------------------------------------------------------------------- |
124
136
  | `@metamesh/generator-sdk` | Definitions, presets, inferred types, and module authoring. |
@@ -3,11 +3,20 @@ import type { GeneratorDefinition, ParameterDefinition } from "./parameters/defi
3
3
  type DefinitionParameters<P extends readonly ParameterDefinition[]> = readonly ParameterDefinition[] | {
4
4
  readonly [Index in keyof P]: ParameterDefinition;
5
5
  };
6
- /** Validates metadata while preserving its identity and literal control types. Invalid definitions throw. */
6
+ /**
7
+ * Validates Generator metadata while preserving literal control types; invalid definitions throw.
8
+ *
9
+ * @param definition - Serializable controls and metadata; returned unchanged after validation.
10
+ */
7
11
  export declare function defineGenerator<const D extends GeneratorDefinition>(definition: D & Omit<GeneratorDefinition, "parameters"> & {
8
12
  readonly parameters: DefinitionParameters<NoInfer<D["parameters"]>>;
9
13
  }): D;
10
- /** Validates complete, canonical preset values and metadata while preserving the supplied array and literal types. */
14
+ /**
15
+ * Validates preset metadata and complete canonical values while preserving literal types.
16
+ *
17
+ * @param definition - Definition whose complete parameter map each preset must supply.
18
+ * @param presets - Preset values and metadata; returned without copying.
19
+ */
11
20
  export declare function definePresets<const D extends GeneratorDefinition, const Presets extends readonly GeneratorPreset<NoInfer<D>>[]>(definition: D, presets: Presets & readonly GeneratorPreset<NoInfer<D>>[]): Presets;
12
21
  export {};
13
22
  //# sourceMappingURL=authoring.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../src/authoring.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAK5F,KAAK,oBAAoB,CAAC,CAAC,SAAS,SAAS,mBAAmB,EAAE,IAChE,SAAS,mBAAmB,EAAE,GAAG;IAAE,QAAQ,EAAE,KAAK,IAAI,MAAM,CAAC,GAAG,mBAAmB;CAAE,CAAC;AAExF,6GAA6G;AAC7G,wBAAgB,eAAe,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EACjE,UAAU,EAAE,CAAC,GACX,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,GAAG;IACxC,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CACrE,GACF,CAAC,CAGH;AAED,sHAAsH;AACtH,wBAAgB,aAAa,CAC3B,KAAK,CAAC,CAAC,SAAS,mBAAmB,EACnC,KAAK,CAAC,OAAO,SAAS,SAAS,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAC5D,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAGnF"}
1
+ {"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../src/authoring.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAK5F,KAAK,oBAAoB,CAAC,CAAC,SAAS,SAAS,mBAAmB,EAAE,IAChE,SAAS,mBAAmB,EAAE,GAAG;IAAE,QAAQ,EAAE,KAAK,IAAI,MAAM,CAAC,GAAG,mBAAmB;CAAE,CAAC;AAExF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EACjE,UAAU,EAAE,CAAC,GACX,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,GAAG;IACxC,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CACrE,GACF,CAAC,CAGH;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,CAAC,CAAC,SAAS,mBAAmB,EACnC,KAAK,CAAC,OAAO,SAAS,SAAS,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAC5D,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAGnF"}
package/dist/authoring.js CHANGED
@@ -1,11 +1,20 @@
1
1
  import { validateGeneratorPresets } from "./generator-package/validate-manifest.js";
2
2
  import { parseGeneratorDefinition } from "./validation/parse-definition.js";
3
- /** Validates metadata while preserving its identity and literal control types. Invalid definitions throw. */
3
+ /**
4
+ * Validates Generator metadata while preserving literal control types; invalid definitions throw.
5
+ *
6
+ * @param definition - Serializable controls and metadata; returned unchanged after validation.
7
+ */
4
8
  export function defineGenerator(definition) {
5
9
  parseGeneratorDefinition(definition);
6
10
  return definition;
7
11
  }
8
- /** Validates complete, canonical preset values and metadata while preserving the supplied array and literal types. */
12
+ /**
13
+ * Validates preset metadata and complete canonical values while preserving literal types.
14
+ *
15
+ * @param definition - Definition whose complete parameter map each preset must supply.
16
+ * @param presets - Preset values and metadata; returned without copying.
17
+ */
9
18
  export function definePresets(definition, presets) {
10
19
  validateGeneratorPresets(definition, presets);
11
20
  return presets;
@@ -1 +1 @@
1
- {"version":3,"file":"authoring.js","sourceRoot":"","sources":["../src/authoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAGpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAO5E,6GAA6G;AAC7G,MAAM,UAAU,eAAe,CAC7B,UAGG;IAEH,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACrC,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,sHAAsH;AACtH,MAAM,UAAU,aAAa,CAG3B,UAAa,EAAE,OAAyD;IACxE,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC9C,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"authoring.js","sourceRoot":"","sources":["../src/authoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAGpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAO5E;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,UAGG;IAEH,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACrC,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAG3B,UAAa,EAAE,OAAyD;IACxE,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC9C,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -10,10 +10,10 @@ If you need a working model first, follow [Build your first code Project](https:
10
10
  ```ts
11
11
  const { width, depth, height, holeDiameter, addHole } = params;
12
12
  const body = box({ size: [width, depth, height] });
13
- if (!addHole) return [part("body", body)];
13
+ if (!addHole) return part("body", body);
14
14
  // Two extra millimetres clear the centered body's top and bottom faces.
15
15
  const bore = cylinder({ height: height + 2, diameter: holeDiameter, sizing: "face" });
16
- return [part("body", body.subtract(bore))];
16
+ return part("body", body.subtract(bore));
17
17
  ```
18
18
 
19
19
  A plate is a useful starting example: its controls describe the finished size and an optional hole, while the source handles construction.
@@ -103,9 +103,9 @@ Use `@metamesh/generator-sdk` to define its controls and Generator module, and
103
103
  `@metamesh/modeling` for generation. Studio's virtual `@metamesh/project` import is specific to
104
104
  Studio and can't be copied into a local Node module.
105
105
 
106
- Follow [local authoring](https://metamesh.studio/docs/develop/agent-authoring#generator-entries) to check and run the
106
+ Follow [local authoring](https://metamesh.studio/docs/develop/cli#generator-entries) to check and run the
107
107
  module with the CLI, inspect dimensions and named parts, and render the captured result. Add
108
- [Testkit checks](https://metamesh.studio/docs/develop/agent-authoring#test-models) when you need repeatable assertions for
108
+ [Testkit checks](https://metamesh.studio/docs/develop/cli#test-models) when you need repeatable assertions for
109
109
  defaults, presets, supported bounds, or validation recovery. Keep those tests in your project's
110
110
  test runner; the CLI owns compilation and capture tools.
111
111
 
@@ -1,14 +1,15 @@
1
1
  # `@metamesh/generator-sdk`
2
2
 
3
- Define typed controls, presets, and portable contracts for MetaMesh Generators. Use one definition
4
- for the editing interface, saved parameter values, and model execution.
3
+ Turn a parametric model into a reusable MetaMesh Generator. Define its controls and presets once,
4
+ then use that definition to infer parameter types, validate saved values, and connect the model
5
+ to an editing interface.
5
6
 
6
7
  > **Preview:** `0.x` minor releases may break compatibility. Patches remain compatible within the
7
8
  > same minor line.
8
9
 
9
10
  ## Installation
10
11
 
11
- For the modeling example below, install matching SDK and Modeling releases:
12
+ Install matching SDK and Modeling releases to build the Generator below:
12
13
 
13
14
  ```bash
14
15
  pnpm add @metamesh/generator-sdk @metamesh/modeling
@@ -18,13 +19,15 @@ The package publishes ES modules only. Use Node.js 24 or newer. TypeScript consu
18
19
  TypeScript 6.0 or newer, `strict` checking, and `NodeNext` or `Bundler` module resolution.
19
20
  Browser hosts need an ES2023-compatible runtime; the SDK's data contracts require no WebAssembly.
20
21
 
21
- The SDK can also be used alone for definitions, parameter handling, and package validation.
22
- Only its optional `/modeling` adapter imports the Modeling runtime.
22
+ You can also use the SDK on its own for definitions, parameter handling, and package validation.
23
+ The optional `/modeling` adapter connects it to Modeling; your application supplies the interface
24
+ and execution host.
23
25
 
24
26
  ## Define controls
25
27
 
26
- A Generator combines serializable metadata with a synchronous model program. This module defines
27
- a sleeve, infers its parameter types, and checks the relationship between its diameters:
28
+ A Generator combines a definition with a synchronous model program. This example makes a sleeve
29
+ with two diameter controls. Parameter types come from the definition, and an assertion checks
30
+ that the bore fits inside the outer wall:
28
31
 
29
32
  ```ts
30
33
  import { defineGenerator } from "@metamesh/generator-sdk";
@@ -57,21 +60,16 @@ export default defineGeneratorModel(definition, ({ params, assert, part }) => {
57
60
  });
58
61
  ```
59
62
 
60
- The adapter binds the definition to the model and produces a Generator module. Use
61
- `defineGeneratorModule({ definition, program })` to bind an existing program. A Generator runtime
62
- is itself a Modeling program: engines and direct model tests execute `runtime`.
63
- Format 5 carries the callback and identity in one object; nested
64
- format-4 runtimes are unsupported. Hosts normalize parameters, prepare assets,
65
- and execute the model; they own the forms, viewing, persistence, and export.
66
- Add named, complete starting values with `definePresets(definition, presets)`.
67
-
68
- `defineGenerator` validates structural and semantic metadata immediately; `definePresets` validates
69
- preset metadata and complete canonical parameter values. Invalid input throws
70
- `GeneratorPackageValidationError` at declaration. Both helpers retain the supplied object or array
71
- and its inferred literal types. Inline parameter, editor, choice, and preset objects receive
72
- TypeScript excess-property checks. Structural typing can hide extra fields in variables or generic
73
- factories; runtime validation checks those fields too. These helpers validate metadata and values,
74
- not model geometry or cross-parameter assertions.
63
+ `defineGeneratorModel` binds the definition to the model and infers its parameters and services.
64
+ If you already have a program, use `defineGeneratorModule({ definition, program })`. The resulting
65
+ runtime is a Modeling program that an engine or model test can execute directly.
66
+ Add named starting configurations with `definePresets(definition, presets)`; each preset supplies
67
+ a complete parameter map.
68
+
69
+ Definitions and presets contain serializable data, without callbacks. Hosts normalize parameters,
70
+ prepare assets, and execute the model. They also own forms, viewing, persistence, and export.
71
+ Generator modules use format 5, which carries the callback and identity in one object;
72
+ nested format-4 runtimes are unsupported.
75
73
 
76
74
  ## Generator capabilities
77
75
 
@@ -82,43 +80,57 @@ not model geometry or cross-parameter assertions.
82
80
  | Parameters and presets | Inferred TypeScript types, defaults, recovering normalization, strict codecs, and complete serializable presets. |
83
81
  | Host integration | Validated package manifests, module execution, Worker messages, and incremental mesh delivery. |
84
82
 
85
- Definitions and presets contain data, not callbacks. Conditional visibility changes the editing
86
- interface; hidden values remain saved and still require validation. Cross-parameter constraints
87
- belong in the model's assertions.
83
+ Conditional visibility changes which controls appear. Hidden values remain saved and still
84
+ require validation. Put constraints between parameters in the model's assertions.
85
+
86
+ ## Validate definitions and values
87
+
88
+ `defineGenerator` checks the definition as soon as you declare it. `definePresets` checks preset
89
+ metadata and complete canonical values. Invalid declarations throw
90
+ `GeneratorPackageValidationError`. These helpers retain the supplied object or array and its
91
+ inferred literal types; they don't execute geometry or model assertions.
92
+
93
+ Inline parameter, editor, choice, and preset objects receive TypeScript excess-property checks.
94
+ Runtime validation also catches extra fields that structural typing can hide in variables or
95
+ generic factories.
88
96
 
89
97
  Use `normalizeParameters` to recover saved values: it drops unknown keys, restores defaults, and
90
- clamps numbers. At strict boundaries, `createParamCodec(definition)` rejects incomplete, unknown, invalid, or
91
- noncanonical values. The [parameter guide](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/develop/parameters-and-validation.mdx)
98
+ clamps numbers. Use `createParamCodec(definition)` when inputs must already be complete and
99
+ canonical; it rejects missing or unknown fields and invalid values. The
100
+ [parameter guide](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/develop/parameters-and-validation.mdx)
92
101
  covers controls, conditions, and validation.
93
102
 
94
- Use the codec's `parse()` to throw on invalid input, or `safeParse()` for a discriminated result.
95
- Failure produces issues without substitute parameters. Codec issues use the shared `ParameterIssue`
96
- shape: `parameterId` names the control, and an optional `path` is relative to that control's value.
97
- Hosts can pass the issues directly to `aggregateParameterIssues`.
103
+ Use the codec's `parse()` to throw on invalid input, or `safeParse()` for a result you can check
104
+ without catching an exception. A failed parse reports issues without substitute parameters. Each `ParameterIssue` names
105
+ a control with `parameterId`; an optional `path` addresses a field within that control's value.
106
+ Hosts can pass these issues directly to `aggregateParameterIssues`.
107
+
108
+ ## Execute and deliver a model
98
109
 
99
110
  `executeGenerator` always validates its single `parameters` map against the current definition.
100
- Hosts may validate before loading assets, but execution does not accept a prior parse result as a
101
- validation bypass. Modeling hosts use `parseGeneratorModel(value, definition)` from `/modeling`
102
- to validate an unknown module and infer its executable `GeneratorModel<typeof definition>` type.
103
- Pass the default export itself for local entries that also export their definition; packaged
104
- namespaces contain only the default export. The runtime-neutral `parseGeneratorModule` remains
105
- available from `/runtime`. Invalid envelopes throw `TypeError`. Package validation exposes MetaMesh
106
- issues and errors, keeping its schema-library adapters private.
107
-
108
- Worker model statistics use `signedVolume` in mm³. `generateMs` measures the engine run;
109
- `timings.totalMs` measures the host workflow and includes stages outside the engine.
110
- `byteCount` counts finalized world-space position and index buffer bytes, counting shared buffers
111
- once; it does not measure the local buffers transferred by a Worker.
112
- Timing stages are optional; hosts report the phases they actually measure. The parameter-processing
113
- stage is `paramsMs` and finalization is `finalizeMs`.
114
-
115
- For Worker hosts, `/modeling` supplies `ModelDeliveryEncoder` and `toWorldMeshes`; `/runtime`
116
- supplies `PartDeliveryDecoder`. Transfers carry local buffers under `geometry`, with placement
117
- beside them. Decode resource references before application use and convert to world meshes before
118
- export. Receiving hosts own the buffers and keep them immutable and attached.
111
+ Hosts can validate before loading assets, but execution still checks the supplied values.
112
+ Modeling hosts use `parseGeneratorModel(value, definition)` from `/modeling` to validate a loaded
113
+ module and infer its executable `GeneratorModel<typeof definition>` type. Pass the default export
114
+ itself for local entries that also export their definition; packaged namespaces contain only the
115
+ default export. Use `parseGeneratorModule` from `/runtime` when you don't need the Modeling adapter.
116
+ Invalid module envelopes throw `TypeError`; package validation reports MetaMesh issues and errors.
117
+
118
+ For Worker hosts, `/modeling` supplies `ModelDeliveryEncoder`; `/runtime` supplies `PartDeliveryDecoder`.
119
+ Transfers carry local buffers under `geometry`, with placement beside them. Decode resource
120
+ references before application use or export. Receiving hosts own the buffers and keep them immutable
121
+ and attached.
122
+
123
+ Model statistics use `signedVolume` in mm³. `generateMs` measures the engine run;
124
+ `timings.totalMs` covers the host workflow, including stages outside the engine. Hosts report only
125
+ the timing stages they measure, using `paramsMs` for parameter processing and `finalizeMs` for
126
+ finalization. `byteCount` counts finalized world-space position and index buffer bytes, counting
127
+ shared buffers once; it doesn't measure the local buffers transferred by a Worker.
119
128
 
120
129
  ## API entry points
121
130
 
131
+ Each public type and function has one import path. Import `FontSelection` and `isFontSelection`
132
+ from `/fonts`, and `GeneratorPreset` from the package root.
133
+
122
134
  | Import | Responsibility |
123
135
  | ------------------------------------ | ------------------------------------------------------------------- |
124
136
  | `@metamesh/generator-sdk` | Definitions, presets, inferred types, and module authoring. |
@@ -87,7 +87,7 @@ and `items.ui.step`.
87
87
  A Font value contains the selected face and weight. Pass the whole value, rather than a family-name
88
88
  string, in `services.text.layout(text, { font, fontSize })` inside generation, then pass its layout to
89
89
  `textSection(layout)`. Studio loads declared fonts before generation. See the
90
- [text recipe](https://metamesh.studio/docs/develop/geometry-recipes#text-from-a-font-parameter) for the setup and offline
90
+ [text recipe](https://metamesh.studio/docs/develop/svg-and-text#text-from-a-font-parameter) for the setup and offline
91
91
  limits.
92
92
 
93
93
  ## Show controls side by side
@@ -269,7 +269,7 @@ with a `parameterId` and positive `factor`, such as `{ "parameterId": "width", "
269
269
  Bindings describe the coordinate envelope; they never rescale the saved value. Without them,
270
270
  the editor displays percentages.
271
271
 
272
- Inside generation or a computed value, pass `params.crossSection` to
272
+ Inside generation or a memo helper, pass `params.crossSection` to
273
273
  [`sampleContour()`](https://metamesh.studio/docs/reference/geometry/sampleContour) with physical `widthScale`,
274
274
  `heightScale`, and a millimetre resolution policy. It returns an immutable counterclockwise
275
275
  XY `Contour` without a duplicated seam, rejecting invalid sampled topology and exhausted budgets.
@@ -382,10 +382,10 @@ than your model's recommended minimum. A zero wall stops generation; a 0.5 mm wa
382
382
  with a warning. Choose that minimum for the model and manufacturing process. A failed edit leaves
383
383
  the last valid preview and its export available. Warnings allow a current model to generate and export.
384
384
 
385
- Checks follow JavaScript order: reading a computed value evaluates it when needed, and measuring
385
+ Checks follow JavaScript order: `memo` calls run their helper on a cache miss, and measuring
386
386
  geometry evaluates its input first. Draft validation checks declarations and reached assertions
387
- without finalizing parts; it doesn't prove full geometric validity. Use optional `computed`
388
- values to reuse expensive layouts or shared calculations across unrelated edits. There is no
387
+ without finalizing parts; it doesn't prove full geometric validity. Use optional `memo`
388
+ calls to reuse expensive layouts or shared calculations across unrelated edits. There is no
389
389
  separate preparation callback.
390
390
 
391
391
  ## Test the definition as a contract
@@ -410,11 +410,10 @@ values with `model.ts`; check the workspace for source or cross-field errors bef
410
410
 
411
411
 
412
412
 
413
- **Keep executable rules in model.ts**
413
+ **Controls describe; TypeScript decides**
414
414
 
415
- JSON mode defines serializable controls and visibility. Derived calculations, geometry checks, and
416
- cross-field messages belong in `generate`; do not invent a second executable rules language inside
417
- the Project definition.
415
+ The definition declares inputs and visibility. Put derived values, geometry checks, and rules
416
+ between parameters in `generate`. Use `assert` or `warn` to identify the control to fix.
418
417
 
419
418
 
420
419