@metamesh/generator-sdk 0.17.0 → 0.19.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.
- package/CHANGELOG.md +197 -0
- package/README.md +101 -65
- package/dist/authoring.d.ts +12 -5
- package/dist/authoring.d.ts.map +1 -1
- package/dist/authoring.js +7 -3
- package/dist/authoring.js.map +1 -1
- package/dist/docs/guides/authoring.md +8 -8
- package/dist/docs/guides/package.md +101 -65
- package/dist/docs/guides/parameters.md +32 -32
- package/dist/docs/manifest.json +159 -257
- package/dist/docs/reference/fonts/FontSelection.md +1 -1
- package/dist/docs/reference/fonts/isFontSelection.md +1 -1
- package/dist/docs/reference/index/ArrayParameterDefinition.md +1 -1
- package/dist/docs/reference/index/BaseParameterDefinition.md +1 -1
- package/dist/docs/reference/index/BooleanParameterDefinition.md +1 -1
- package/dist/docs/reference/index/ChoiceOption.md +1 -1
- package/dist/docs/reference/index/ChoiceParameterDefinition.md +1 -1
- package/dist/docs/reference/index/ChoiceSetParameterDefinition.md +1 -1
- package/dist/docs/reference/index/ColorParameterDefinition.md +1 -1
- package/dist/docs/reference/index/ConditionExpression.md +1 -1
- package/dist/docs/reference/index/ContourAnchor.md +1 -1
- package/dist/docs/reference/index/ContourParameterDefinition.md +1 -1
- package/dist/docs/reference/index/ContourParameterUi.md +1 -1
- package/dist/docs/reference/index/ContourPoint.md +1 -1
- package/dist/docs/reference/index/ContourSegment.md +1 -1
- package/dist/docs/reference/index/ContourValue.md +1 -1
- package/dist/docs/reference/index/FontParameterDefinition.md +1 -1
- package/dist/docs/reference/index/FontSelection.md +1 -1
- package/dist/docs/reference/index/GeneratorDefinition.md +1 -1
- package/dist/docs/reference/index/GeneratorIssue.md +1 -1
- package/dist/docs/reference/index/GeneratorModule.md +5 -6
- package/dist/docs/reference/index/GeneratorModuleOptions.md +2 -2
- package/dist/docs/reference/index/GeneratorParamId.md +1 -1
- package/dist/docs/reference/index/GeneratorParams.md +1 -1
- package/dist/docs/reference/index/GeneratorPreset.md +1 -1
- package/dist/docs/reference/index/GeneratorProgram.md +1 -1
- package/dist/docs/reference/index/GeneratorServices.md +1 -1
- package/dist/docs/reference/index/GeneratorTextArcBaseline.md +1 -1
- package/dist/docs/reference/index/GeneratorTextLayout.md +1 -1
- package/dist/docs/reference/index/GeneratorTextMetrics.md +1 -1
- package/dist/docs/reference/index/GeneratorTextOptions.md +1 -1
- package/dist/docs/reference/index/MAX_CONTOUR_SEGMENTS.md +1 -1
- package/dist/docs/reference/index/MAX_SIDE_PROFILE_SEGMENTS.md +1 -1
- package/dist/docs/reference/index/NumberArrayItemDefinition.md +1 -1
- package/dist/docs/reference/index/NumberArrayParameterDefinition.md +1 -1
- package/dist/docs/reference/index/NumberParameterDefinition.md +1 -1
- package/dist/docs/reference/index/NumberParameterUi.md +1 -1
- package/dist/docs/reference/index/ParameterDefinition.md +1 -1
- package/dist/docs/reference/index/ParameterDefinitionDocument.md +1 -1
- package/dist/docs/reference/index/ParameterGroup.md +1 -1
- package/dist/docs/reference/index/ParameterIssue.md +1 -1
- package/dist/docs/reference/index/ParameterIssueCode.md +1 -1
- package/dist/docs/reference/index/ParameterIssueSeverity.md +1 -1
- package/dist/docs/reference/index/ParameterScaleReference.md +1 -1
- package/dist/docs/reference/index/ParameterUi.md +1 -1
- package/dist/docs/reference/index/ParameterValidationResult.md +1 -1
- package/dist/docs/reference/index/ParameterValue.md +1 -1
- package/dist/docs/reference/index/ParameterValues.md +1 -1
- package/dist/docs/reference/index/RowParameterUi.md +1 -1
- package/dist/docs/reference/index/ScalarParameterValue.md +1 -1
- package/dist/docs/reference/index/SideProfileAnchor.md +1 -1
- package/dist/docs/reference/index/SideProfileParameterDefinition.md +1 -1
- package/dist/docs/reference/index/SideProfileParameterUi.md +1 -1
- package/dist/docs/reference/index/SideProfilePoint.md +1 -1
- package/dist/docs/reference/index/SideProfileSegment.md +1 -1
- package/dist/docs/reference/index/SideProfileValue.md +1 -1
- package/dist/docs/reference/index/SourceVisibility.md +1 -1
- package/dist/docs/reference/index/StringArrayItemDefinition.md +1 -1
- package/dist/docs/reference/index/StringArrayParameterDefinition.md +1 -1
- package/dist/docs/reference/index/SvgParameterDefinition.md +1 -1
- package/dist/docs/reference/index/TextParameterDefinition.md +1 -1
- package/dist/docs/reference/index/UNPREPARED_GENERATOR_SERVICES.md +1 -1
- package/dist/docs/reference/index/cloneContourValue.md +1 -1
- package/dist/docs/reference/index/cloneSideProfileValue.md +1 -1
- package/dist/docs/reference/index/contourValuesEqual.md +1 -1
- package/dist/docs/reference/index/defineGenerator.md +6 -4
- package/dist/docs/reference/index/defineGeneratorModule.md +2 -2
- package/dist/docs/reference/index/definePresets.md +4 -4
- package/dist/docs/reference/index/evaluateCondition.md +1 -1
- package/dist/docs/reference/index/isContourValue.md +1 -1
- package/dist/docs/reference/index/isFontSelection.md +1 -1
- package/dist/docs/reference/index/isSideProfileValue.md +1 -1
- package/dist/docs/reference/index/sideProfileValuesEqual.md +1 -1
- package/dist/docs/reference/modeling/GeneratorModel.md +10 -0
- package/dist/docs/reference/modeling/ModelDeliveryEncoder.md +22 -0
- package/dist/docs/reference/modeling/defineGeneratorModel.md +2 -2
- package/dist/docs/reference/modeling/parseGeneratorModel.md +15 -0
- package/dist/docs/reference/packages/GENERATOR_PACKAGE_FORMAT_VERSION.md +2 -2
- package/dist/docs/reference/packages/GeneratorAccess.md +1 -1
- package/dist/docs/reference/packages/GeneratorDefinitionIssue.md +1 -1
- package/dist/docs/reference/packages/GeneratorDefinitionParseResult.md +1 -1
- package/dist/docs/reference/packages/GeneratorDescriptor.md +1 -1
- package/dist/docs/reference/packages/GeneratorPackageManifest.md +1 -1
- package/dist/docs/reference/packages/GeneratorPackageSource.md +1 -1
- package/dist/docs/reference/packages/GeneratorPackageValidationError.md +1 -1
- package/dist/docs/reference/packages/GeneratorPreset.md +1 -1
- package/dist/docs/reference/packages/GeneratorRuntimeReference.md +1 -1
- package/dist/docs/reference/packages/InstalledGenerator.md +1 -1
- package/dist/docs/reference/packages/MAX_ARRAY_ITEMS.md +1 -1
- package/dist/docs/reference/packages/MAX_CONDITION_BRANCHES.md +1 -1
- package/dist/docs/reference/packages/MAX_CONDITION_DEPTH.md +1 -1
- package/dist/docs/reference/packages/MAX_DESCRIPTOR_LIST_ITEMS.md +1 -1
- package/dist/docs/reference/packages/MAX_GENERATOR_ID_LENGTH.md +2 -2
- package/dist/docs/reference/packages/MAX_GENERATOR_PACKAGE_BYTES.md +1 -1
- package/dist/docs/reference/packages/MAX_GENERATOR_PRESETS.md +1 -1
- package/dist/docs/reference/packages/MAX_METADATA_TEXT_LENGTH.md +2 -2
- package/dist/docs/reference/packages/MAX_PARAMETERS.md +1 -1
- package/dist/docs/reference/packages/MAX_PARAMETER_GROUPS.md +1 -1
- package/dist/docs/reference/packages/MAX_PARAMETER_OPTIONS.md +1 -1
- package/dist/docs/reference/packages/MAX_TEXT_PARAMETER_LENGTH.md +2 -2
- package/dist/docs/reference/packages/METAMESH_RUNTIME_VERSION.md +2 -2
- package/dist/docs/reference/packages/compareSemanticVersions.md +1 -1
- package/dist/docs/reference/packages/isRuntimeCompatible.md +1 -1
- package/dist/docs/reference/packages/parseGeneratorDefinition.md +1 -1
- package/dist/docs/reference/packages/parseGeneratorDescriptor.md +1 -1
- package/dist/docs/reference/packages/parseGeneratorPackageManifest.md +1 -1
- package/dist/docs/reference/packages/parseParameterDefinitionDocument.md +1 -1
- package/dist/docs/reference/packages/safeParseGeneratorDefinition.md +1 -1
- package/dist/docs/reference/packages/safeParseParameterDefinitionDocument.md +1 -1
- package/dist/docs/reference/packages/validateGeneratorPresets.md +1 -1
- package/dist/docs/reference/parameters/EMPTY_SVG_PARAMETER_DEFAULT.md +1 -1
- package/dist/docs/reference/parameters/MAX_PARAMETER_ISSUES.md +1 -1
- package/dist/docs/reference/parameters/MAX_PARAMETER_ISSUE_MESSAGE_LENGTH.md +1 -1
- package/dist/docs/reference/parameters/MAX_PROJECT_SVG_PARAMETER_BYTES.md +1 -1
- package/dist/docs/reference/parameters/MAX_SVG_PARAMETER_BYTES.md +1 -1
- package/dist/docs/reference/parameters/ParamCodec.md +1 -1
- package/dist/docs/reference/parameters/ParamDecodeCode.md +1 -1
- package/dist/docs/reference/parameters/ParamDecodeError.md +1 -1
- package/dist/docs/reference/parameters/ParamDecodeIssue.md +3 -3
- package/dist/docs/reference/parameters/ParamParseResult.md +1 -1
- package/dist/docs/reference/parameters/aggregateParameterIssues.md +1 -1
- package/dist/docs/reference/parameters/createParamCodec.md +1 -1
- package/dist/docs/reference/parameters/getDefaultParameters.md +1 -1
- package/dist/docs/reference/parameters/normalizeParameters.md +1 -1
- package/dist/docs/reference/parameters/parameterValueEquals.md +1 -1
- package/dist/docs/reference/parameters/parseParameterIssues.md +1 -1
- package/dist/docs/reference/parameters/svgParameterBytes.md +1 -1
- package/dist/docs/reference/runtime/ExecuteGeneratorOptions.md +2 -4
- package/dist/docs/reference/runtime/GenerateRequest.md +1 -1
- package/dist/docs/reference/runtime/GenerationError.md +1 -1
- package/dist/docs/reference/runtime/GenerationInvalid.md +1 -1
- package/dist/docs/reference/runtime/GenerationSuccess.md +2 -2
- package/dist/docs/reference/runtime/GeneratorExecutionGenerated.md +1 -1
- package/dist/docs/reference/runtime/GeneratorExecutionInvalid.md +2 -3
- package/dist/docs/reference/runtime/GeneratorExecutionResult.md +2 -2
- package/dist/docs/reference/runtime/MeshResourceData.md +19 -0
- package/dist/docs/reference/runtime/MeshTopologyMode.md +1 -1
- package/dist/docs/reference/runtime/ModelBounds.md +1 -1
- package/dist/docs/reference/runtime/ModelData.md +17 -0
- package/dist/docs/reference/runtime/ModelDelivery.md +12 -0
- package/dist/docs/reference/runtime/ModelPartData.md +35 -0
- package/dist/docs/reference/runtime/ModelStats.md +6 -4
- package/dist/docs/reference/runtime/ModelTimings.md +10 -9
- package/dist/docs/reference/runtime/ParsedGeneratorModule.md +1 -1
- package/dist/docs/reference/runtime/PartDelivery.md +15 -0
- package/dist/docs/reference/runtime/{GeneratedPartsDecoder.md → PartDeliveryDecoder.md} +5 -5
- package/dist/docs/reference/runtime/{GeneratedPartsLimits.md → PartDeliveryLimits.md} +3 -3
- package/dist/docs/reference/runtime/RuntimeError.md +1 -1
- package/dist/docs/reference/runtime/ValidateRequest.md +1 -1
- package/dist/docs/reference/runtime/ValidationError.md +1 -1
- package/dist/docs/reference/runtime/ValidationSuccess.md +1 -1
- package/dist/docs/reference/runtime/WorkerRequest.md +2 -2
- package/dist/docs/reference/runtime/WorkerResponse.md +2 -2
- package/dist/docs/reference/runtime/canonicalizeParameters.md +10 -0
- package/dist/docs/reference/runtime/executeGenerator.md +3 -3
- package/dist/docs/reference/runtime/generationIssues.md +1 -1
- package/dist/docs/reference/runtime/parseGenerationSentAt.md +1 -1
- package/dist/docs/reference/runtime/parseGeneratorModule.md +3 -3
- package/dist/docs/reference/runtime/{parseGeneratedParts.md → parseModelParts.md} +3 -3
- package/dist/generator-module.d.ts +11 -8
- package/dist/generator-module.d.ts.map +1 -1
- package/dist/generator-module.js +3 -2
- package/dist/generator-module.js.map +1 -1
- package/dist/generator-package/constants.d.ts +3 -11
- package/dist/generator-package/constants.d.ts.map +1 -1
- package/dist/generator-package/constants.js +4 -12
- package/dist/generator-package/constants.js.map +1 -1
- package/dist/generator-package/contracts.d.ts +15 -0
- package/dist/generator-package/contracts.d.ts.map +1 -0
- package/dist/generator-package/contracts.js.map +1 -0
- package/dist/generator-package/index.d.ts +10 -30
- package/dist/generator-package/index.d.ts.map +1 -1
- package/dist/generator-package/index.js +7 -85
- package/dist/generator-package/index.js.map +1 -1
- package/dist/generator-package/parse-package.d.ts +5 -0
- package/dist/generator-package/parse-package.d.ts.map +1 -0
- package/dist/generator-package/parse-package.js +38 -0
- package/dist/generator-package/parse-package.js.map +1 -0
- package/dist/generator-package/schemas/descriptor.schema.d.ts +2 -2
- package/dist/generator-package/schemas/descriptor.schema.d.ts.map +1 -1
- package/dist/generator-package/schemas/descriptor.schema.js +2 -2
- package/dist/generator-package/schemas/descriptor.schema.js.map +1 -1
- package/dist/generator-package/schemas/manifest.schema.d.ts +16 -16
- package/dist/generator-package/schemas/manifest.schema.d.ts.map +1 -1
- package/dist/generator-package/schemas/manifest.schema.js +4 -4
- package/dist/generator-package/schemas/manifest.schema.js.map +1 -1
- package/dist/generator-package/validate-manifest.d.ts +2 -2
- package/dist/generator-package/validate-manifest.d.ts.map +1 -1
- package/dist/generator-package/validate-manifest.js +15 -20
- package/dist/generator-package/validate-manifest.js.map +1 -1
- package/dist/generator-package/versions.js +2 -2
- package/dist/generator-package/versions.js.map +1 -1
- package/dist/generator-package/versions.spec.js +6 -5
- package/dist/generator-package/versions.spec.js.map +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/metadata-limits.d.ts +5 -0
- package/dist/metadata-limits.d.ts.map +1 -0
- package/dist/metadata-limits.js +5 -0
- package/dist/metadata-limits.js.map +1 -0
- package/dist/modeling-delivery.d.ts +17 -0
- package/dist/modeling-delivery.d.ts.map +1 -0
- package/dist/modeling-delivery.js +44 -0
- package/dist/modeling-delivery.js.map +1 -0
- package/dist/modeling.d.ts +13 -2
- package/dist/modeling.d.ts.map +1 -1
- package/dist/modeling.js +12 -1
- package/dist/modeling.js.map +1 -1
- package/dist/parameters/conditions.d.ts.map +1 -0
- package/dist/parameters/conditions.js.map +1 -0
- package/dist/parameters/contours.d.ts.map +1 -0
- package/dist/parameters/contours.js.map +1 -0
- package/dist/parameters/contracts.d.ts +69 -0
- package/dist/parameters/contracts.d.ts.map +1 -0
- package/dist/parameters/contracts.js +2 -0
- package/dist/{contracts.js.map → parameters/contracts.js.map} +1 -1
- package/dist/parameters/curve-data.d.ts.map +1 -0
- package/dist/parameters/curve-data.js.map +1 -0
- package/dist/{parameter-contracts.d.ts → parameters/definitions.d.ts} +2 -2
- package/dist/parameters/definitions.d.ts.map +1 -0
- package/dist/parameters/definitions.js +2 -0
- package/dist/parameters/definitions.js.map +1 -0
- package/dist/parameters/issues.d.ts +2 -1
- package/dist/parameters/issues.d.ts.map +1 -1
- package/dist/parameters/issues.js +4 -3
- package/dist/parameters/issues.js.map +1 -1
- package/dist/parameters/limits.d.ts +9 -0
- package/dist/parameters/limits.d.ts.map +1 -0
- package/dist/parameters/limits.js +9 -0
- package/dist/parameters/limits.js.map +1 -0
- package/dist/parameters/recovery.d.ts +2 -1
- package/dist/parameters/recovery.d.ts.map +1 -1
- package/dist/parameters/recovery.js +4 -3
- package/dist/parameters/recovery.js.map +1 -1
- package/dist/parameters/side-profiles.d.ts.map +1 -0
- package/dist/parameters/side-profiles.js.map +1 -0
- package/dist/parameters/strict.d.ts +4 -3
- package/dist/parameters/strict.d.ts.map +1 -1
- package/dist/parameters/strict.js +11 -7
- package/dist/parameters/strict.js.map +1 -1
- package/dist/parameters/values.d.ts +1 -1
- package/dist/parameters/values.d.ts.map +1 -1
- package/dist/parameters/values.js +2 -2
- package/dist/parameters/values.js.map +1 -1
- package/dist/parameters.d.ts +0 -2
- package/dist/parameters.d.ts.map +1 -1
- package/dist/parameters.js +0 -1
- package/dist/parameters.js.map +1 -1
- package/dist/runtime/execute-generator.d.ts +6 -9
- package/dist/runtime/execute-generator.d.ts.map +1 -1
- package/dist/runtime/execute-generator.js +11 -11
- package/dist/runtime/execute-generator.js.map +1 -1
- package/dist/runtime/model-contracts.d.ts +103 -0
- package/dist/runtime/model-contracts.d.ts.map +1 -0
- package/dist/runtime/model-contracts.js +2 -0
- package/dist/runtime/model-contracts.js.map +1 -0
- package/dist/runtime/parameter-identities.d.ts +4 -0
- package/dist/runtime/parameter-identities.d.ts.map +1 -0
- package/dist/runtime/parameter-identities.js +11 -0
- package/dist/runtime/parameter-identities.js.map +1 -0
- package/dist/runtime/parse-generator-module.d.ts +2 -3
- package/dist/runtime/parse-generator-module.d.ts.map +1 -1
- package/dist/runtime/parse-generator-module.js +7 -19
- package/dist/runtime/parse-generator-module.js.map +1 -1
- package/dist/runtime/{generated-parts.d.ts → part-delivery.d.ts} +11 -7
- package/dist/runtime/part-delivery.d.ts.map +1 -0
- package/dist/runtime/{generated-parts.js → part-delivery.js} +69 -44
- package/dist/runtime/part-delivery.js.map +1 -0
- package/dist/runtime/worker-contracts.d.ts +5 -29
- package/dist/runtime/worker-contracts.d.ts.map +1 -1
- package/dist/runtime/worker-contracts.js.map +1 -1
- package/dist/runtime.d.ts +6 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +3 -2
- package/dist/runtime.js.map +1 -1
- package/dist/{generator-package → validation}/errors.d.ts +1 -1
- package/dist/validation/errors.d.ts.map +1 -0
- package/dist/validation/errors.js.map +1 -0
- package/dist/validation/parse-definition.d.ts +9 -0
- package/dist/validation/parse-definition.d.ts.map +1 -0
- package/dist/validation/parse-definition.js +49 -0
- package/dist/validation/parse-definition.js.map +1 -0
- package/dist/validation/portable-data.d.ts.map +1 -0
- package/dist/validation/portable-data.js.map +1 -0
- package/dist/{generator-package → validation}/schemas/common.schema.d.ts +1 -1
- package/dist/validation/schemas/common.schema.d.ts.map +1 -0
- package/dist/{generator-package → validation}/schemas/common.schema.js +3 -2
- package/dist/validation/schemas/common.schema.js.map +1 -0
- package/dist/{generator-package → validation}/schemas/condition.schema.d.ts +2 -2
- package/dist/validation/schemas/condition.schema.d.ts.map +1 -0
- package/dist/{generator-package → validation}/schemas/condition.schema.js +2 -2
- package/dist/validation/schemas/condition.schema.js.map +1 -0
- package/dist/{generator-package → validation}/schemas/definition.schema.d.ts +23 -23
- package/dist/validation/schemas/definition.schema.d.ts.map +1 -0
- package/dist/{generator-package → validation}/schemas/definition.schema.js +2 -2
- package/dist/validation/schemas/definition.schema.js.map +1 -0
- package/dist/{generator-package → validation}/schemas/parameter-document-json-schema.d.ts +1 -1
- package/dist/validation/schemas/parameter-document-json-schema.d.ts.map +1 -0
- package/dist/{generator-package → validation}/schemas/parameter-document-json-schema.js +1 -1
- package/dist/validation/schemas/parameter-document-json-schema.js.map +1 -0
- package/dist/{generator-package → validation}/schemas/parameter.schema.d.ts +12 -12
- package/dist/validation/schemas/parameter.schema.d.ts.map +1 -0
- package/dist/{generator-package → validation}/schemas/parameter.schema.js +4 -4
- package/dist/validation/schemas/parameter.schema.js.map +1 -0
- package/dist/validation/schemas/preset.schema.d.ts +5 -0
- package/dist/validation/schemas/preset.schema.d.ts.map +1 -0
- package/dist/{generator-package → validation}/schemas/preset.schema.js +4 -4
- package/dist/validation/schemas/preset.schema.js.map +1 -0
- package/dist/{generator-package → validation}/validate-definition.d.ts +1 -1
- package/dist/validation/validate-definition.d.ts.map +1 -0
- package/dist/{generator-package → validation}/validate-definition.js +2 -2
- package/dist/validation/validate-definition.js.map +1 -0
- package/dist/validation/version-format.d.ts.map +1 -0
- package/dist/validation/version-format.js.map +1 -0
- package/package.json +6 -3
- package/dist/conditions.d.ts.map +0 -1
- package/dist/conditions.js.map +0 -1
- package/dist/contours.d.ts.map +0 -1
- package/dist/contours.js.map +0 -1
- package/dist/contracts.d.ts +0 -139
- package/dist/contracts.d.ts.map +0 -1
- package/dist/curve-data.d.ts.map +0 -1
- package/dist/curve-data.js.map +0 -1
- package/dist/docs/reference/packages/definitionIssuesFromZod.md +0 -10
- package/dist/docs/reference/packages/validationErrorFromIssues.md +0 -9
- package/dist/docs/reference/packages/validationErrorFromZod.md +0 -9
- package/dist/docs/reference/parameters/PreparedParameters.md +0 -12
- package/dist/docs/reference/parameters/canonicalizeParameters.md +0 -10
- package/dist/docs/reference/parameters/prepareParameters.md +0 -13
- package/dist/docs/reference/parameters/validateParameters.md +0 -10
- package/dist/docs/reference/runtime/Export3mfRequest.md +0 -18
- package/dist/docs/reference/runtime/ExportError.md +0 -13
- package/dist/docs/reference/runtime/ExportSuccess.md +0 -13
- package/dist/docs/reference/runtime/ExportedFile.md +0 -13
- package/dist/docs/reference/runtime/GeneratedModel.md +0 -17
- package/dist/docs/reference/runtime/GeneratedModelDelivery.md +0 -12
- package/dist/docs/reference/runtime/GeneratedPart.md +0 -20
- package/dist/docs/reference/runtime/GeneratedPartDelivery.md +0 -13
- package/dist/docs/reference/runtime/isGeneratorModule.md +0 -9
- package/dist/generator-package/errors.d.ts.map +0 -1
- package/dist/generator-package/errors.js.map +0 -1
- package/dist/generator-package/portable-data.d.ts.map +0 -1
- package/dist/generator-package/portable-data.js.map +0 -1
- package/dist/generator-package/schemas/common.schema.d.ts.map +0 -1
- package/dist/generator-package/schemas/common.schema.js.map +0 -1
- package/dist/generator-package/schemas/condition.schema.d.ts.map +0 -1
- package/dist/generator-package/schemas/condition.schema.js.map +0 -1
- package/dist/generator-package/schemas/definition.schema.d.ts.map +0 -1
- package/dist/generator-package/schemas/definition.schema.js.map +0 -1
- package/dist/generator-package/schemas/parameter-document-json-schema.d.ts.map +0 -1
- package/dist/generator-package/schemas/parameter-document-json-schema.js.map +0 -1
- package/dist/generator-package/schemas/parameter.schema.d.ts.map +0 -1
- package/dist/generator-package/schemas/parameter.schema.js.map +0 -1
- package/dist/generator-package/schemas/preset.schema.d.ts +0 -5
- package/dist/generator-package/schemas/preset.schema.d.ts.map +0 -1
- package/dist/generator-package/schemas/preset.schema.js.map +0 -1
- package/dist/generator-package/validate-definition.d.ts.map +0 -1
- package/dist/generator-package/validate-definition.js.map +0 -1
- package/dist/generator-package/version-format.d.ts.map +0 -1
- package/dist/generator-package/version-format.js.map +0 -1
- package/dist/parameter-contracts.d.ts.map +0 -1
- package/dist/parameter-contracts.js +0 -2
- package/dist/parameter-contracts.js.map +0 -1
- package/dist/parameters/preparation.d.ts +0 -15
- package/dist/parameters/preparation.d.ts.map +0 -1
- package/dist/parameters/preparation.js +0 -47
- package/dist/parameters/preparation.js.map +0 -1
- package/dist/runtime/generated-parts.d.ts.map +0 -1
- package/dist/runtime/generated-parts.js.map +0 -1
- package/dist/side-profiles.d.ts.map +0 -1
- package/dist/side-profiles.js.map +0 -1
- /package/dist/{contracts.js → generator-package/contracts.js} +0 -0
- /package/dist/{conditions.d.ts → parameters/conditions.d.ts} +0 -0
- /package/dist/{conditions.js → parameters/conditions.js} +0 -0
- /package/dist/{contours.d.ts → parameters/contours.d.ts} +0 -0
- /package/dist/{contours.js → parameters/contours.js} +0 -0
- /package/dist/{curve-data.d.ts → parameters/curve-data.d.ts} +0 -0
- /package/dist/{curve-data.js → parameters/curve-data.js} +0 -0
- /package/dist/{side-profiles.d.ts → parameters/side-profiles.d.ts} +0 -0
- /package/dist/{side-profiles.js → parameters/side-profiles.js} +0 -0
- /package/dist/{generator-package → validation}/errors.js +0 -0
- /package/dist/{generator-package → validation}/portable-data.d.ts +0 -0
- /package/dist/{generator-package → validation}/portable-data.js +0 -0
- /package/dist/{generator-package → validation}/version-format.d.ts +0 -0
- /package/dist/{generator-package → validation}/version-format.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,202 @@
|
|
|
1
1
|
# @metamesh/generator-sdk
|
|
2
2
|
|
|
3
|
+
## 0.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c9de510: Extend straight extrusion end finishing to concave outlines, holes, and disconnected regions.
|
|
8
|
+
Add independent-solid `join` with a feature datum and a smooth (default) or straight width/height
|
|
9
|
+
transition against validated planar, angled, and curved sampled support patches. Both profiles use
|
|
10
|
+
the same support, collar, and whole-volume containment proofs.
|
|
11
|
+
|
|
12
|
+
Breaking: compiled Generators require Modeling runtime major 12. Rebuild packages for the new
|
|
13
|
+
host contract; old compiled runtimes are rejected. Joining preserves the supplied operands and
|
|
14
|
+
does not promise a circular fillet radius or perform automatic placement.
|
|
15
|
+
|
|
16
|
+
Replace named lazy `computed` readers with eager `memo(fn, ...args)` values. Stable pure helpers
|
|
17
|
+
reuse immutable arguments and tracked current params/context reads, with bounded recent histories
|
|
18
|
+
and native geometry retention. Update Studio diagnostics to warn about fresh function identities.
|
|
19
|
+
All authored and compiled callers must use the new API; there is no compatibility surface.
|
|
20
|
+
|
|
21
|
+
- de3d234: Add runtime-neutral STL, 3MF, and GLB export under `@metamesh/modeling/export`, with isolated
|
|
22
|
+
format entry points and backpressure-aware streaming writers. All formats consume captured local
|
|
23
|
+
geometry, placement, and appearance, with independent limits, cancellation, and structured
|
|
24
|
+
information-loss diagnostics. Standard 3MF color groups carry appearance, while base materials
|
|
25
|
+
and multiproperties retain explicit material identities independently of RGB values. These
|
|
26
|
+
properties do not assign slicer filaments or physical device trays. Add `mesh.render()` for
|
|
27
|
+
shared crease-aware display buffers that preserve exact triangle coordinates.
|
|
28
|
+
|
|
29
|
+
Breaking: remove `export3mf` and export types from `/engine`, remove SDK export request protocols
|
|
30
|
+
and `toWorldMeshes`, and return owned `Uint8Array` bytes with format metadata from the shared
|
|
31
|
+
exporters. Studio uses one export worker for every format. CLI captures use format version 3;
|
|
32
|
+
replace `run --export-3mf` with `metamesh export RUN_DIRECTORY --format 3mf --output model.3mf`.
|
|
33
|
+
Captured-run export also supports STL and GLB without rerunning source. No legacy export paths
|
|
34
|
+
or capture readers are retained.
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [c9de510]
|
|
39
|
+
- Updated dependencies [de3d234]
|
|
40
|
+
- @metamesh/modeling@0.19.0
|
|
41
|
+
|
|
42
|
+
## 0.18.0
|
|
43
|
+
|
|
44
|
+
### Minor Changes
|
|
45
|
+
|
|
46
|
+
- 2eea694: Consolidate model authoring, execution, and testing around fluent shapes and durable immutable
|
|
47
|
+
results. Upgrade all four packages together; these Preview API changes have no compatibility
|
|
48
|
+
aliases. Rebuild compiled Generators for module format 5 and Modeling runtime major 11. Older
|
|
49
|
+
module formats and incompatible runtime versions are rejected before execution.
|
|
50
|
+
|
|
51
|
+
### Modeling imports and operations
|
|
52
|
+
|
|
53
|
+
| Previous API | 0.18 API |
|
|
54
|
+
| ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
55
|
+
| `body.subtract([cutter])` for a single operand | `body.subtract(cutter)`; fluent `union`, `intersect`, and `subtract` accept one shape or a readonly array |
|
|
56
|
+
| `compose(shapes)` | `union(shapes)` |
|
|
57
|
+
| Free shape inspection, emptiness, component, and anchor queries | `shape.inspect()`, `shape.isEmpty()`, `shape.components()`, and `shape.anchor(name)` |
|
|
58
|
+
| Free Solid distance/segment queries and splitting functions | `solid.distance(other)`, `solid.castSegment(...)`, `solid.split(cutter)`, and `solid.splitByPlane(plane)` |
|
|
59
|
+
| `solid.toTriangleMesh()` | `solid.toMesh()` |
|
|
60
|
+
| Named `mesh` import from `/geometry`, or standalone triangle-mesh functions | `import * as mesh from "@metamesh/modeling/geometry/mesh"` |
|
|
61
|
+
| Standalone `immutableMesh(...)` | `mesh.immutable(...)` |
|
|
62
|
+
| `helicalThreadRidgeMesh`, `helicalThreadSolidMesh`, and `preflightHelicalThreadSolidMesh` | `mesh.threadRidge`, `mesh.threadSolid`, and `mesh.preflightThreadSolid` |
|
|
63
|
+
| `HelicalThreadRidgeMeshOptions`, `HelicalThreadSolidMeshOptions`, and `HelicalThreadSolidMeshPreflight` | `ThreadRidgeOptions`, `ThreadSolidOptions`, and `ThreadSolidPreflight`, exported from the mesh module |
|
|
64
|
+
| Mesh `connectedComponentCount` | `shellCount`; native inspection `componentCount` still counts material components |
|
|
65
|
+
| Inspection extrema on the inspection result | Immutable `inspection.bounds.min` and `inspection.bounds.max` |
|
|
66
|
+
| `starContour(outerRadius, points, innerRadius, limits)` | `starContour({ outerRadius, innerRadius, points, limits })` |
|
|
67
|
+
|
|
68
|
+
Free `union(shapes)` and `intersect(shapes)` remain for collections of peers and reject empty
|
|
69
|
+
collections. Fluent Boolean methods with an empty array return the receiver.
|
|
70
|
+
|
|
71
|
+
Use `section.extrude(options)` in fluent modeling, `extrude(profile, options)` for generic
|
|
72
|
+
`Section | CorrespondingProfile` inputs, and `mesh.extrude(contour, options)` for pure triangle
|
|
73
|
+
buffers. The same fluent/generic distinction applies to revolution and sweeping. Pure extrusion
|
|
74
|
+
uses `ExtrudeMeshOptions` and rejects `ends`; use Section extrusion for native end treatments.
|
|
75
|
+
Construction, transforms, and splitting remain deferred recipes; observations and `toMesh()`
|
|
76
|
+
require active model execution.
|
|
77
|
+
|
|
78
|
+
Point-loop and arbitrary Section lofts default to direct correspondence when the method is
|
|
79
|
+
omitted; known primitive landmarks remain preserved. Dimension inputs accept fluent vectors.
|
|
80
|
+
Tube sizing accepts complete inner/outer radius or diameter pairs. Both star factories require
|
|
81
|
+
an explicit inner radius and support degree rotation; use `innerRadius: outerRadius / 2` to retain
|
|
82
|
+
the contour helper's former default.
|
|
83
|
+
|
|
84
|
+
Rod and internal-cutter `bevelBottom`, `bevelTop`, and `bevelSize` become `bevel`. The shared
|
|
85
|
+
`Bevel` contract accepts a nonnegative size, `"auto"`, or a readonly `[bottom, top]` pair; zero
|
|
86
|
+
disables an end and omission preserves factory defaults. Complete-thread mesh builders use the
|
|
87
|
+
same contract, with thread termination under `ends`. Nuts replace bevel selection, `chamferSize`,
|
|
88
|
+
and `flushBuildPlateBottom` with independent `innerBevel` and `outerBevel`. For a flat outside
|
|
89
|
+
bottom that retains its inner opening bevel, use `outerBevel: [0, "auto"]`. Nut preflight exposes
|
|
90
|
+
resolved inner/outer pairs and checks face walls pairwise; each end's reservation and automatic
|
|
91
|
+
sizing are resolved independently, including internal-cutter axial extension.
|
|
92
|
+
|
|
93
|
+
Primitive contours and their points are immutable and can be explicit `computed` dependencies.
|
|
94
|
+
Copy the outer array and any points before editing. Geometry errors are available from the
|
|
95
|
+
Modeling root; operation option/result types are exported beside their owning operations.
|
|
96
|
+
Topology analysis with `includeTopology: true`, finalized parts, and local geometry resources
|
|
97
|
+
include required `shellCount` and `edgeCount`. Bounds construction options describe inputs only;
|
|
98
|
+
existing fluent bounds remain accepted.
|
|
99
|
+
|
|
100
|
+
### Part placement and result ownership
|
|
101
|
+
|
|
102
|
+
Replace `part(id, { geometry, position, rotation })` with
|
|
103
|
+
`part(id, { geometry, transform })`. The optional transform accepts a fluent `transform3()` value,
|
|
104
|
+
a row-major 16-number matrix, or a computed reader; omission means identity. Pattern and
|
|
105
|
+
attachment matrices pass directly to `part()`. Only rigid placement is supported: scale, shear,
|
|
106
|
+
reflection, perspective, and non-finite values are rejected. Geometry-only and geometry-or-options
|
|
107
|
+
union inputs remain accepted without casts.
|
|
108
|
+
|
|
109
|
+
Use `PartDeclaration` for authored parts. Replace `ModelSnapshot` / `FinalizedModel` with
|
|
110
|
+
`ModelResult`, and `SnapshotPart` / `FinalizedPart` with `ModelPart`. `engine.run()`, `session.run()`,
|
|
111
|
+
and Testkit's `runModel()` return durable immutable results. Dispose sessions and runners to release their
|
|
112
|
+
caches; completed results remain valid and need no disposal. `model.part(id)` returns a required
|
|
113
|
+
semantic part or throws with available IDs; `model.parts` preserves output order.
|
|
114
|
+
|
|
115
|
+
Finalized buffers expose stable, iterable `ImmutableBuffer` values. Use `.copy()` for mutable
|
|
116
|
+
storage. A `ModelPart`'s top-level positions and indices are already in world space; apply its
|
|
117
|
+
immutable `transform` only to the reusable local buffers under `geometry`. Worker deliveries also
|
|
118
|
+
nest local resources under `geometry`. Host integrations use `ModelDeliveryEncoder`,
|
|
119
|
+
`PartDeliveryDecoder`, and `toWorldMeshes` for owned transfer and manufacturing output.
|
|
120
|
+
Replace `engine.export3mf(...)` with standalone `export3mf(parts, options)` from `/engine`, which
|
|
121
|
+
accepts completed meshes with explicit resource limits, independently of engine initialization.
|
|
122
|
+
|
|
123
|
+
Statistics rename `volumeMm3` → `signedVolume`, `finalizationMs` → `finalizeMs`, and
|
|
124
|
+
`generationMs` → `generateMs`; `buildMs` measures declarations.
|
|
125
|
+
`ModelResult.stats.byteCount` means bytes occupied by finalized world-space position and index buffers,
|
|
126
|
+
counting shared buffers once. Worker statistics preserve engine `generateMs`; host elapsed time
|
|
127
|
+
is `timings.totalMs`, with `paramsMs` for parameter work. Other host timing stages are optional:
|
|
128
|
+
an omitted stage is unmeasured.
|
|
129
|
+
|
|
130
|
+
Model parameter roots must be object maps. Captured parameters and computed results expose
|
|
131
|
+
deeply readonly `ImmutableValue<T>` views; supported mutable caller input is still accepted and
|
|
132
|
+
recaptured on every revision, including mutable children inside frozen objects. Deeply immutable
|
|
133
|
+
data retains identity reuse. Assertions and warnings accept bounded immutable nested `path`
|
|
134
|
+
metadata. Replace `validateModel` with `checkModel` and session/runner `.validate()` with `.check()`.
|
|
135
|
+
These check declarations and reached assertions without finalizing geometry; unexpected execution
|
|
136
|
+
failures still throw.
|
|
137
|
+
|
|
138
|
+
### Generator SDK and Testkit
|
|
139
|
+
|
|
140
|
+
| Previous API | 0.18 API |
|
|
141
|
+
| -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
142
|
+
| Nested compiled Generator module | Flat format-5 model program; bind an existing program with `defineGeneratorModule({ definition, program })` |
|
|
143
|
+
| `isGeneratorModule(value)` | `parseGeneratorModule(value, definition)` |
|
|
144
|
+
| `executeGenerator({ ..., parsedParameters })` | `executeGenerator({ ..., parameters })`; current-definition validation always runs |
|
|
145
|
+
| Callback-scoped `withModel`, `ModelTestOptions`, or `runner.withModel` | `await runModel(programOrCallback, ...)` for one-off results; explicit sessions or Generator runners for repeated edits |
|
|
146
|
+
| Generator test `runner.execute(...)` | `runner.run(...)`, returning `GeneratorTestResult` |
|
|
147
|
+
| `expectSerializableDefinition` | `assertValidDefinition` |
|
|
148
|
+
| `expectValidDefaults`, `expectValidPresets`, and `expectValidParts` | `assertValidDefaults`, `assertValidPresets`, and `assertValidParts` |
|
|
149
|
+
| `expectMeshMeasurements` | `assertMeshMeasurements` |
|
|
150
|
+
| `canonicalizeParameters(definition, parameters)` from `/parameters` | `canonicalizeParameters(parameters)` from `/runtime` |
|
|
151
|
+
| `GeneratedPartsDecoder`, `parseGeneratedParts`, and `GeneratedPartsLimits` | `PartDeliveryDecoder`, `parseModelParts`, and `PartDeliveryLimits` |
|
|
152
|
+
| `GeneratedPart` and `GeneratedModel` | `ModelPartData` and `ModelData` |
|
|
153
|
+
| `GeneratedPartDelivery` and `GeneratedModelDelivery` | `PartDelivery` and `ModelDelivery` |
|
|
154
|
+
|
|
155
|
+
Testkit `runModel` accepts existing `ModelProgram` values and synchronous inline callbacks;
|
|
156
|
+
typed callbacks use `runModel<Parameters, Services>`. Its definition-bound Generator overload
|
|
157
|
+
validates inputs and prepares services. The SDK Modeling adapter adds definition-inferred
|
|
158
|
+
`GeneratorModel` and `parseGeneratorModel`. Ordinary model tests preserve definition-inferred
|
|
159
|
+
input types. Reusable Generator runners accept physical generation policy plus `cache` and
|
|
160
|
+
`verifyCache` for edit sequences; dispose the runner after use.
|
|
161
|
+
|
|
162
|
+
Generator execution and ordinary tests strictly require complete canonical parameter maps.
|
|
163
|
+
Use the parameter codec for strict input and `normalizeParameters` for forgiving recovery;
|
|
164
|
+
replace `prepareParameters`, `validateParameters`, and `PreparedParameters` with
|
|
165
|
+
`createParamCodec(definition).parse(...)` or `.safeParse(...)`. Schema adapters remain private.
|
|
166
|
+
Codec failures provide structured issues without a substitute parameter map. For deliberate
|
|
167
|
+
malformed-input assertion probes, replace `runner.validate(parameters, { normalize: false })`
|
|
168
|
+
with `runner.check(parameters, { validateInput: false })`.
|
|
169
|
+
Defaults are selected only by omission or `undefined` where supported; a `null` parameter map is
|
|
170
|
+
rejected. Parameterless model calls can omit the empty map. Definition and preset helpers catch
|
|
171
|
+
nested key typos and validate immediately while retaining literal inference.
|
|
172
|
+
|
|
173
|
+
`assertValidParts` checks the supplied world-space buffers, closed topology, and exact agreement
|
|
174
|
+
with local geometry under `transform`; it no longer hides corrupted output by reconstructing it.
|
|
175
|
+
Always await `assertValidParts(parts, engine)` (or omit the engine): failures reject, and supplying
|
|
176
|
+
an engine changes resource reuse only.
|
|
177
|
+
`assertValidDefinition` also checks the canonical JSON round trip. New `assertEqualBuffer` and
|
|
178
|
+
`assertEqualMesh` compare exact ordered contents without copying; equivalent shapes with different
|
|
179
|
+
triangulations can differ. `ContentMismatchError` identifies the first differing element or
|
|
180
|
+
length, while malformed input and reader failures retain their errors. Optional `contentMatchers`
|
|
181
|
+
support `expect.extend`, including negation, without a test-framework dependency.
|
|
182
|
+
|
|
183
|
+
### CLI and package requirements
|
|
184
|
+
|
|
185
|
+
Rename the type-only CLI command `metamesh check` to `metamesh typecheck`; no alias is retained.
|
|
186
|
+
Node authoring APIs and Modeling/Testkit declaration-check methods retain their names. Generator
|
|
187
|
+
runs use `overrides` / `--overrides`, merged with defaults before strict parsing; standalone models
|
|
188
|
+
use `params` / `--params`. Supplying the other entry kind's input option is rejected.
|
|
189
|
+
|
|
190
|
+
Captured runs use format 2 with transform-only placement. The bundled capture renderer resolves
|
|
191
|
+
from the installed CLI package so published installations can render captures.
|
|
192
|
+
Public packages require Node.js 24 or newer, ESM imports, and TypeScript 6.0 or newer with strict
|
|
193
|
+
checking for TypeScript consumers.
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- Updated dependencies [2eea694]
|
|
198
|
+
- @metamesh/modeling@0.18.0
|
|
199
|
+
|
|
3
200
|
## 0.17.0
|
|
4
201
|
|
|
5
202
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
# `@metamesh/generator-sdk`
|
|
2
2
|
|
|
3
|
-
Turn a parametric model into a MetaMesh Generator. Define controls once,
|
|
4
|
-
|
|
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
|
|
|
12
|
+
Install matching SDK and Modeling releases to build the Generator below:
|
|
13
|
+
|
|
11
14
|
```bash
|
|
12
|
-
pnpm add @metamesh/generator-sdk
|
|
15
|
+
pnpm add @metamesh/generator-sdk @metamesh/modeling
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
The
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
The package publishes ES modules only. Use Node.js 24 or newer. TypeScript consumers need
|
|
19
|
+
TypeScript 6.0 or newer, `strict` checking, and `NodeNext` or `Bundler` module resolution.
|
|
20
|
+
Browser hosts need an ES2023-compatible runtime; the SDK's data contracts require no WebAssembly.
|
|
21
|
+
|
|
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.
|
|
18
25
|
|
|
19
26
|
## Define controls
|
|
20
27
|
|
|
21
|
-
A
|
|
22
|
-
|
|
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:
|
|
23
31
|
|
|
24
32
|
```ts
|
|
25
33
|
import { defineGenerator } from "@metamesh/generator-sdk";
|
|
34
|
+
import { defineGeneratorModel } from "@metamesh/generator-sdk/modeling";
|
|
35
|
+
import { tube } from "@metamesh/modeling";
|
|
26
36
|
|
|
27
37
|
export const definition = defineGenerator({
|
|
28
38
|
id: "sleeve",
|
|
@@ -34,29 +44,11 @@ export const definition = defineGenerator({
|
|
|
34
44
|
{ id: "boreDiameter", label: "Bore diameter", type: "number", default: 10, min: 1 },
|
|
35
45
|
],
|
|
36
46
|
});
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Definitions are serializable. Optional `ui` metadata describes grouping, visibility, hints, and
|
|
40
|
-
editing increments. Number inputs and sliders share `type: "number"`; sliders add
|
|
41
|
-
`ui.control: "slider"`, bounds, and `ui.step`. See the
|
|
42
|
-
[parameter guide](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/develop/parameters-and-validation.mdx)
|
|
43
|
-
for the full set of controls.
|
|
44
|
-
|
|
45
|
-
## Generate a model
|
|
46
|
-
|
|
47
|
-
Add a synchronous generation program to the same module. The Modeling adapter infers controls,
|
|
48
|
-
prepared services, and diagnostic parameter IDs from the definition:
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
import { defineGeneratorModel } from "@metamesh/generator-sdk/modeling";
|
|
52
|
-
import { tube } from "@metamesh/modeling";
|
|
53
47
|
|
|
54
48
|
export default defineGeneratorModel(definition, ({ params, assert, part }) => {
|
|
55
|
-
assert(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{ parameterId: "boreDiameter" }
|
|
59
|
-
);
|
|
49
|
+
assert(params.boreDiameter < params.outerDiameter, "The bore must fit inside the sleeve.", {
|
|
50
|
+
parameterId: "boreDiameter",
|
|
51
|
+
});
|
|
60
52
|
return part(
|
|
61
53
|
"body",
|
|
62
54
|
tube({
|
|
@@ -68,55 +60,99 @@ export default defineGeneratorModel(definition, ({ params, assert, part }) => {
|
|
|
68
60
|
});
|
|
69
61
|
```
|
|
70
62
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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.
|
|
73
|
+
|
|
74
|
+
## Generator capabilities
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
| Area | Capabilities |
|
|
77
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
78
|
+
| Parameter values | Numbers, booleans, choices and choice sets, text, colors, arrays, fonts, SVG, side profiles, and cross-sections. |
|
|
79
|
+
| Editing metadata | Labels, units, groups, descriptions, inline hints, sliders, paired controls, and conditional visibility. |
|
|
80
|
+
| Parameters and presets | Inferred TypeScript types, defaults, recovering normalization, strict codecs, and complete serializable presets. |
|
|
81
|
+
| Host integration | Validated package manifests, module execution, Worker messages, and incremental mesh delivery. |
|
|
78
82
|
|
|
79
|
-
|
|
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.
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
restores missing or invalid values from defaults, and clamps numbers. At a trust boundary, use
|
|
83
|
-
`createParamCodec(definition)` to reject incomplete, unknown, invalid, or noncanonical values.
|
|
84
|
-
Both return fresh frozen parameter maps.
|
|
86
|
+
## Validate definitions and values
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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.
|
|
96
|
+
|
|
97
|
+
Use `normalizeParameters` to recover saved values: it drops unknown keys, restores defaults, and
|
|
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)
|
|
101
|
+
covers controls, conditions, and validation.
|
|
102
|
+
|
|
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
|
|
109
|
+
|
|
110
|
+
`executeGenerator` always validates its single `parameters` map against the current definition.
|
|
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.
|
|
89
128
|
|
|
90
129
|
## API entry points
|
|
91
130
|
|
|
92
|
-
| Import |
|
|
93
|
-
| ------------------------------------ |
|
|
94
|
-
| `@metamesh/generator-sdk` | Definitions, presets, and module authoring
|
|
95
|
-
| `@metamesh/generator-sdk/
|
|
96
|
-
| `@metamesh/generator-sdk/
|
|
97
|
-
| `@metamesh/generator-sdk/
|
|
98
|
-
| `@metamesh/generator-sdk/
|
|
99
|
-
| `@metamesh/generator-sdk/
|
|
131
|
+
| Import | Responsibility |
|
|
132
|
+
| ------------------------------------ | ------------------------------------------------------------------- |
|
|
133
|
+
| `@metamesh/generator-sdk` | Definitions, presets, inferred types, and module authoring. |
|
|
134
|
+
| `@metamesh/generator-sdk/modeling` | Definition-inferred Modeling programs. |
|
|
135
|
+
| `@metamesh/generator-sdk/parameters` | Defaults, saved values, normalization, and strict codecs. |
|
|
136
|
+
| `@metamesh/generator-sdk/runtime` | Execution, generated geometry, and Worker protocols. |
|
|
137
|
+
| `@metamesh/generator-sdk/packages` | Package, catalog, installation, and definition-document validation. |
|
|
138
|
+
| `@metamesh/generator-sdk/fonts` | Immutable font selection values. |
|
|
100
139
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
admitted buffers immutable and attached; call `clear()` when replacing the delivery source.
|
|
140
|
+
`@metamesh/generator-sdk/parameters.schema.json` supports offline definition editing. The SDK
|
|
141
|
+
validates references, defaults, and cross-field rules in addition to the structural schema.
|
|
104
142
|
|
|
105
143
|
## Documentation
|
|
106
144
|
|
|
107
|
-
Resolve `@metamesh/generator-sdk/docs/manifest.json`
|
|
108
|
-
|
|
109
|
-
With [`@metamesh/cli`](https://github.com/JasonKoolman/metamesh/blob/main/packages/cli/README.md)
|
|
110
|
-
installed, `pnpm exec metamesh docs search "parameters"` searches the local index;
|
|
111
|
-
`pnpm exec metamesh docs show sdk/guide/generator-modules` reads this package's authoring guide.
|
|
145
|
+
Resolve `@metamesh/generator-sdk/docs/manifest.json` for exact-version Markdown guides and annotated
|
|
146
|
+
API references. With [CLI](https://github.com/JasonKoolman/metamesh/blob/main/packages/cli/README.md) installed:
|
|
112
147
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
148
|
+
```bash
|
|
149
|
+
pnpm exec metamesh docs search "parameters"
|
|
150
|
+
pnpm exec metamesh docs show sdk/guide/generator-modules
|
|
151
|
+
```
|
|
116
152
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
153
|
+
See [local authoring](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/create/author-locally.mdx)
|
|
154
|
+
for the complete workflow and [Contributing](https://github.com/JasonKoolman/metamesh/blob/main/CONTRIBUTING.md)
|
|
155
|
+
for package development.
|
|
120
156
|
|
|
121
157
|
## License
|
|
122
158
|
|
package/dist/authoring.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { GeneratorPreset } from "./parameters/contracts.js";
|
|
2
|
+
import type { GeneratorDefinition, ParameterDefinition } from "./parameters/definitions.js";
|
|
3
|
+
type DefinitionParameters<P extends readonly ParameterDefinition[]> = readonly ParameterDefinition[] | {
|
|
4
|
+
readonly [Index in keyof P]: ParameterDefinition;
|
|
5
|
+
};
|
|
6
|
+
/** Validates metadata while preserving its identity and literal control types. Invalid definitions throw. */
|
|
7
|
+
export declare function defineGenerator<const D extends GeneratorDefinition>(definition: D & Omit<GeneratorDefinition, "parameters"> & {
|
|
8
|
+
readonly parameters: DefinitionParameters<NoInfer<D["parameters"]>>;
|
|
9
|
+
}): D;
|
|
10
|
+
/** Validates complete, canonical preset values and metadata while preserving the supplied array and literal types. */
|
|
11
|
+
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
|
+
export {};
|
|
6
13
|
//# sourceMappingURL=authoring.d.ts.map
|
package/dist/authoring.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../src/authoring.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/authoring.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { validateGeneratorPresets } from "./generator-package/validate-manifest.js";
|
|
2
|
+
import { parseGeneratorDefinition } from "./validation/parse-definition.js";
|
|
3
|
+
/** Validates metadata while preserving its identity and literal control types. Invalid definitions throw. */
|
|
2
4
|
export function defineGenerator(definition) {
|
|
5
|
+
parseGeneratorDefinition(definition);
|
|
3
6
|
return definition;
|
|
4
7
|
}
|
|
5
|
-
/**
|
|
6
|
-
export function definePresets(
|
|
8
|
+
/** Validates complete, canonical preset values and metadata while preserving the supplied array and literal types. */
|
|
9
|
+
export function definePresets(definition, presets) {
|
|
10
|
+
validateGeneratorPresets(definition, presets);
|
|
7
11
|
return presets;
|
|
8
12
|
}
|
|
9
13
|
//# sourceMappingURL=authoring.js.map
|
package/dist/authoring.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.js","sourceRoot":"","sources":["../src/authoring.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -13,7 +13,7 @@ const { width, depth, height, holeDiameter, addHole } = params;
|
|
|
13
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(
|
|
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.
|
|
@@ -26,8 +26,8 @@ Describe what someone should be able to change: the overall size, a fit, an opti
|
|
|
26
26
|
which parts to produce. Expose those decisions as controls. Keep implementation details in the
|
|
27
27
|
source unless changing them serves a clear purpose.
|
|
28
28
|
|
|
29
|
-
For a plate with an optional hole, Width and Hole diameter
|
|
30
|
-
segment count usually
|
|
29
|
+
For a plate with an optional hole, Width and Hole diameter describe changes someone will want to
|
|
30
|
+
make. The cylinder's segment count usually doesn't need equal prominence.
|
|
31
31
|
|
|
32
32
|
Open **Parameter actions → Edit controls**, or **MetaMesh menu → Current project → Edit controls**.
|
|
33
33
|
Group related controls into sections, put the most common decisions first, and choose
|
|
@@ -88,9 +88,9 @@ For the plate above, test these decisions separately:
|
|
|
88
88
|
|
|
89
89
|
## Keep related parts understandable
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
identify them during inspection and export as dimensions change. The [
|
|
93
|
-
|
|
91
|
+
Give related outputs stable, descriptive part IDs, such as a lid and container, so someone can
|
|
92
|
+
identify them during inspection and export as dimensions change. The [parts guide](https://metamesh.studio/docs/develop/code-project-contract#parts-and-placement)
|
|
93
|
+
shows how to return them from your code.
|
|
94
94
|
|
|
95
95
|
Inspect each output and check the exported model in its intended downstream tool. A valid solid
|
|
96
96
|
alone does not establish a suitable fit or printable wall thickness. Follow the
|
|
@@ -99,9 +99,9 @@ alone does not establish a suitable fit or printable wall thickness. Follow the
|
|
|
99
99
|
## Use the same design in a local module
|
|
100
100
|
|
|
101
101
|
These control-design principles also apply to a Generator authored in a local TypeScript project.
|
|
102
|
-
Use `@metamesh/generator-sdk`
|
|
102
|
+
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
|
-
Studio and
|
|
104
|
+
Studio and can't be copied into a local Node module.
|
|
105
105
|
|
|
106
106
|
Follow [local authoring](https://metamesh.studio/docs/develop/agent-authoring#generator-entries) to check and run the
|
|
107
107
|
module with the CLI, inspect dimensions and named parts, and render the captured result. Add
|