Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
MAXIMUM PAPERCLIPS
Yuechen Li8b541a2a4722
diff --git a/Aetheris.CLI.Tests/CircularSweepCliTests.cs b/Aetheris.CLI.Tests/CircularSweepCliTests.csnew file mode 100644index 00000000..daa29ac7--- /dev/null+++ b/Aetheris.CLI.Tests/CircularSweepCliTests.cs@@ -0,0 +1,35 @@+using System.Text.Json;++namespace Aetheris.CLI.Tests;++public sealed class CircularSweepCliTests+{+ [Fact]+ public void PaperclipValidateAndInspectUseSweepSemanticRoute()+ {+ var fixture = Path.Combine(RepoRoot(), "fixtures", "Canonical", "Templates", "paperclip.firmament");+ var validation = new StringWriter(); var validationError = new StringWriter();+ Assert.Equal(0, Aetheris.CLI.CliRunner.Run(["validate", fixture, "--json"], validation, validationError));+ Assert.Empty(validationError.ToString());+ using (var json = JsonDocument.Parse(validation.ToString()))+ {+ var report = json.RootElement.GetProperty("firmamentV2Validation");+ Assert.Equal("valid", report.GetProperty("status").GetString());+ Assert.Equal("CircularSweep", report.GetProperty("domain").GetString());+ Assert.Equal(7, report.GetProperty("summary").GetProperty("segmentCount").GetInt32());+ }+ var inspection = new StringWriter(); var inspectionError = new StringWriter();+ Assert.Equal(0, Aetheris.CLI.CliRunner.Run(["inspect", fixture, "--json"], inspection, inspectionError));+ Assert.Empty(inspectionError.ToString());+ using var inspected = JsonDocument.Parse(inspection.ToString());+ Assert.True(inspected.RootElement.GetProperty("success").GetBoolean());+ Assert.Equal("Standard.Materials.StainlessSteel.304_Annealed", inspected.RootElement.GetProperty("sweep").GetProperty("material").GetString());+ }++ private static string RepoRoot()+ {+ var directory = new DirectoryInfo(AppContext.BaseDirectory);+ while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "Aetheris.slnx"))) directory = directory.Parent;+ return directory?.FullName ?? throw new DirectoryNotFoundException();+ }+}diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.csindex be65f163..50a7e2e4 100644--- a/Aetheris.CLI/CliRunner.cs+++ b/Aetheris.CLI/CliRunner.cs@@ -454,6 +454,7 @@ public static class CliRunnerlattice = build.Value.Export.Lattice,combined = build.Value.Export.Combined,standardPart = build.Value.Export.StandardPart,+ sweep = build.Value.Export.Sweep,assertions = build.Value.Export.Assertions,features = build.Value.Export.Features,engineeringFeatures = build.Value.Export.EngineeringFeatures,@@ -475,6 +476,8 @@ public static class CliRunnerstdout.WriteLine($"Model: {build.Value.Export.ExportedFeatureId}");if (build.Value.Export.StandardPart is { } standardPart)stdout.WriteLine($"Standard part: {standardPart.Family} via {standardPart.Template ?? "direct record"} ({standardPart.SemanticDescendants.Count} semantic descendants)");+ if (build.Value.Export.Sweep is { } sweep)+ stdout.WriteLine($"Sweep: {sweep.SegmentCount} analytic path segments, {sweep.Diameter:G6} mm diameter, {sweep.CenterlineLength:G6} mm centerline ({sweep.Cylinders} cylinders, {sweep.Tori} tori)");foreach (var diagnostic in build.Diagnostics.Where(diagnostic => diagnostic.Severity == KernelDiagnosticSeverity.Warning))stderr.WriteLine($"- [Warning] {diagnostic.Source}: {diagnostic.Message}");}@@ -983,6 +986,27 @@ Model CanonicalPanel {}var source = File.ReadAllText(fullPath);+ var sweepSource = ExpandSweepInspectionSource(source, out var sweepExpansionDiagnostics);+ if (CircularSweepAuthoring.IsSweepSource(source))+ {+ var authored = sweepSource is null ? null : CircularSweepAuthoring.Parse(sweepSource);+ var sweepDiagnostics = sweepExpansionDiagnostics.Concat(authored is null ? [] : authored.IsSuccess ? CircularSweepBRepMaterializer.Validate(authored.Value) : authored.Diagnostics.Select(item => item.Message)).ToArray();+ var sweepSuccess = authored?.IsSuccess == true && sweepDiagnostics.Length == 0;+ var sweepReport = new+ {+ command = "inspect", success = sweepSuccess, input = fullPath,+ model = Path.GetFileNameWithoutExtension(fullPath), units = "mm",+ sweep = authored?.IsSuccess == true ? new { authored.Value.Name, diameter = authored.Value.Diameter, radius = authored.Value.Radius,+ material = authored.Value.Material.Identity.FirmamentPath, path = authored.Value.Path.Name,+ segments = authored.Value.Path.Segments.Select(segment => new { segment.Name, segment.SemanticKind, geometry = segment.Geometry.GetType().Name, segment.StableId }),+ provenance = authored.Value.Provenance } : null,+ conceptPaths = sweepSource is null ? [] : ProfileAuthoringParser.InspectConceptPaths(sweepSource), diagnostics = sweepDiagnostics+ };+ if (json) stdout.WriteLine(JsonSerializer.Serialize(sweepReport, JsonOptions));+ else if (sweepSuccess) stdout.WriteLine($"Sweep {authored!.Value.Name}: {authored.Value.Path.Segments.Count} segments, {authored.Value.Diameter:G6} mm diameter");+ else foreach (var diagnostic in sweepDiagnostics) stderr.WriteLine($"error: {diagnostic}");+ return sweepSuccess ? 0 : 1;+ }var parse = FirmamentV2Parser.Parse(source, Path.GetDirectoryName(fullPath));var document = parse.Document;var success = parse.IsSuccess && document is not null;@@ -1515,6 +1539,27 @@ Model CanonicalPanel {return 0;}+ private static string? ExpandSweepInspectionSource(string source, out IReadOnlyList<string> diagnostics)+ {+ var expansion = FirmamentTemplateSourceCompiler.Expand(source, out var templateDiagnostics);+ if (expansion is null)+ {+ diagnostics = templateDiagnostics;+ return null;+ }++ if (!FirmamentV2Parser.TryExpandCanonicalStaticAuthoring(expansion.ExpandedSource, out var expandedSource, out var staticDiagnostics))+ {+ diagnostics = templateDiagnostics.Concat(staticDiagnostics).Distinct(StringComparer.Ordinal).ToArray();+ return null;+ }++ diagnostics = templateDiagnostics.Concat(staticDiagnostics).Distinct(StringComparer.Ordinal).ToArray();+ return FirmamentV2Parser.TryGetCanonicalAdvancedBody(expandedSource, out var canonicalBody)+ ? canonicalBody+ : expandedSource;+ }+private static int RunValidate(string[] args, TextWriter stdout, TextWriter stderr){if (args.Length == 0)@@ -1564,6 +1609,19 @@ Model CanonicalPanel {}var validationSource=File.ReadAllText(sourcePath);+ if (CircularSweepAuthoring.IsSweepSource(validationSource))+ {+ var sweepSource = ExpandSweepInspectionSource(validationSource, out var sweepExpansionDiagnostics);+ var authored = sweepSource is null ? null : CircularSweepAuthoring.Parse(sweepSource);+ var sweepDiagnostics = sweepExpansionDiagnostics.Concat(authored is null ? [] : authored.IsSuccess ? CircularSweepBRepMaterializer.Validate(authored.Value) : authored.Diagnostics.Select(item => item.Message)).ToArray();+ var valid = authored?.IsSuccess == true && sweepDiagnostics.Length == 0;+ var payload = new { source = sourcePath, status = valid ? "valid" : "invalid", domain = "CircularSweep",+ summary = new { fatalDiagnosticCount = sweepDiagnostics.Length, warningDiagnosticCount = 0,+ segmentCount = authored?.IsSuccess == true ? authored.Value.Path.Segments.Count : 0 }, diagnostics = sweepDiagnostics };+ if (json) stdout.WriteLine(JsonSerializer.Serialize(new { firmamentV2Validation = payload }, JsonOptions));+ else stdout.WriteLine($"Firmament V2 Circular Sweep validation: {payload.status} ({payload.summary.fatalDiagnosticCount} fatal, 0 warning)");+ return valid ? 0 : 1;+ }if(SheetMetalFirmament.LooksLikeSheetMetal(validationSource)){var sheet=SheetMetalFirmament.Compile(validationSource,Path.GetFullPath(sourcePath));diff --git a/Aetheris.Forge.Host.Tests/ForgeProtocolV1Tests.cs b/Aetheris.Forge.Host.Tests/ForgeProtocolV1Tests.csindex bf86a7b1..b6dfc9d1 100644--- a/Aetheris.Forge.Host.Tests/ForgeProtocolV1Tests.cs+++ b/Aetheris.Forge.Host.Tests/ForgeProtocolV1Tests.cs@@ -8,6 +8,7 @@ namespace Aetheris.Forge.Host.Tests;public sealed class ForgeProtocolV1Tests{private const string Enclosure = "Standard.SheetMetal.ElectronicsEnclosure";+ private const string Paperclip = "Standard.Products.Office.Paperclip";[Fact]public void InfoListAndDescriptionAreStableAndDerivedFromFirmamentSchema()@@ -20,6 +21,7 @@ public sealed class ForgeProtocolV1Testsvar list = host.ListTemplates();Assert.Equal(list.Templates.OrderBy(item => item.Id, StringComparer.Ordinal), list.Templates);Assert.Contains(list.Templates, item => item.Id == Enclosure);+ Assert.Contains(list.Templates, item => item.Id == Paperclip);Assert.DoesNotContain(list.Templates, item => item.Id.Contains("Aetheris.", StringComparison.Ordinal));var description = host.DescribeTemplate(Enclosure)!;@@ -34,6 +36,32 @@ public sealed class ForgeProtocolV1TestsAssert.Equal([ForgeArtifactKind.StepAp242, ForgeArtifactKind.FlatStep, ForgeArtifactKind.Svg], description.Artifacts);}+ [Fact]+ public void PaperclipDescribeAndInvokeExposePolicyAndDeterministicStep()+ {+ using var first = TempDirectory.Create(); using var second = TempDirectory.Create();+ var host = new ForgeProtocolHost();+ var description = Assert.IsType<ForgeTemplateDescription>(host.DescribeTemplate(Paperclip));+ Assert.Equal([ForgeArtifactKind.StepAp242], description.Artifacts);+ var policy = Assert.Single(description.Parameters);+ Assert.Equal("PaperclipPolicy", policy.Type == "record" ? policy.Fields is null ? string.Empty : "PaperclipPolicy" : string.Empty);+ Assert.Contains(policy.Fields!, field => field.Name == "WireDiameter" && field.Unit == "mm");+ Assert.Contains(description.Constraints, constraint => constraint.Name == "OuterWidthExceedsInnerWidth");+ var arguments = new Dictionary<string, object?>+ {+ ["wireDiameter"] = "1.0 mm", ["overallLength"] = "35 mm", ["outerWidth"] = "10 mm",+ ["innerWidth"] = "6 mm", ["bendRadius"] = "1.2 mm", ["loopGap"] = "1.2 mm",+ ["material"] = "Standard.Materials.StainlessSteel.304_Annealed",+ };+ var a = host.InvokeTemplate(Paperclip, Request(arguments, ForgeArtifactKind.StepAp242), first.Path);+ var b = host.InvokeTemplate(Paperclip, Request(arguments, ForgeArtifactKind.StepAp242), second.Path);+ Assert.True(a.Success, string.Join(Environment.NewLine, a.Diagnostics.Select(item => item.Code + ": " + item.Message)));+ Assert.True(b.Success, string.Join(Environment.NewLine, b.Diagnostics.Select(item => item.Code + ": " + item.Message)));+ Assert.Equal(a.Identity.Specialization, b.Identity.Specialization);+ Assert.Equal(a.Artifacts.Single().Sha256, b.Artifacts.Single().Sha256);+ Assert.True(Step242Importer.ImportBody(File.ReadAllText(System.IO.Path.Combine(first.Path, "paperclip.step"))).IsSuccess);+ }+[Fact]public void RealEnclosureInvocationProducesDeterministicStepFlatStepAndSvg(){diff --git a/Aetheris.Forge.Host/ForgeProtocolHost.cs b/Aetheris.Forge.Host/ForgeProtocolHost.csindex 56bfd261..4b284ea6 100644--- a/Aetheris.Forge.Host/ForgeProtocolHost.cs+++ b/Aetheris.Forge.Host/ForgeProtocolHost.cs@@ -6,6 +6,7 @@ using System.Text;using System.Text.Json;using System.Text.RegularExpressions;using Aetheris.Kernel.Core.Step242;+using Aetheris.Kernel.Firmament;using Aetheris.Kernel.Firmament.FirmamentV2;using Aetheris.SheetMetal;@@ -99,18 +100,32 @@ public sealed class ForgeProtocolHostif (expansion is null || diagnostics.Any(item => item.Severity == ForgeProtocolDiagnosticSeverity.Error))return Failure(diagnostics.ToArray());- var compilation = SheetMetalFirmament.Compile(expansion.ExpandedSource, $"forge-host:{known.Id}");- diagnostics.AddRange(compilation.Diagnostics.Select(FromSheetMetalDiagnostic));- if (!compilation.IsSuccess || compilation.Part?.FormedBody is null || compilation.FlatPattern is null)- return Failure(diagnostics.ToArray());-- var dfm = SheetMetalDfm.Evaluate(compilation.Part, compilation.FlatPattern);- diagnostics.AddRange(dfm.Findings.Where(item => item.Status is SheetMetalDfmStatus.Warning or SheetMetalDfmStatus.Fail)- .Select(item => new ForgeProtocolDiagnostic(item.RuleId,- item.Status == SheetMetalDfmStatus.Fail ? ForgeProtocolDiagnosticSeverity.Error : ForgeProtocolDiagnosticSeverity.Warning,- item.Message, item.SubjectId, "SheetMetalDfm")));- if (diagnostics.Any(item => item.Severity == ForgeProtocolDiagnosticSeverity.Error))- return Failure(diagnostics.ToArray());+ SheetMetalAuthoringResult? sheetMetalCompilation = null;+ FirmamentStepExportResult? nativeCompilation = null;+ if (known.NativeFirmament)+ {+ var compiled = FirmamentBuildAndExport.CompileSource(expansion.ExpandedSource);+ diagnostics.AddRange(compiled.Diagnostics.Select(item => new ForgeProtocolDiagnostic(item.Code.ToString(),+ item.Severity == Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticSeverity.Error ? ForgeProtocolDiagnosticSeverity.Error : ForgeProtocolDiagnosticSeverity.Warning,+ item.Message, item.Source, "FirmamentV2")));+ if (!compiled.IsSuccess) return Failure(diagnostics.ToArray());+ nativeCompilation = compiled.Value;+ }+ else+ {+ sheetMetalCompilation = SheetMetalFirmament.Compile(expansion.ExpandedSource, $"forge-host:{known.Id}");+ diagnostics.AddRange(sheetMetalCompilation.Diagnostics.Select(FromSheetMetalDiagnostic));+ if (!sheetMetalCompilation.IsSuccess || sheetMetalCompilation.Part?.FormedBody is null || sheetMetalCompilation.FlatPattern is null)+ return Failure(diagnostics.ToArray());++ var dfm = SheetMetalDfm.Evaluate(sheetMetalCompilation.Part, sheetMetalCompilation.FlatPattern);+ diagnostics.AddRange(dfm.Findings.Where(item => item.Status is SheetMetalDfmStatus.Warning or SheetMetalDfmStatus.Fail)+ .Select(item => new ForgeProtocolDiagnostic(item.RuleId,+ item.Status == SheetMetalDfmStatus.Fail ? ForgeProtocolDiagnosticSeverity.Error : ForgeProtocolDiagnosticSeverity.Warning,+ item.Message, item.SubjectId, "SheetMetalDfm")));+ if (diagnostics.Any(item => item.Severity == ForgeProtocolDiagnosticSeverity.Error))+ return Failure(diagnostics.ToArray());+ }try{@@ -119,7 +134,9 @@ public sealed class ForgeProtocolHostvar artifacts = new List<ForgeArtifact>();foreach (var kind in requestedArtifacts){- var (name, contentType, content) = GenerateArtifact(kind, compilation);+ var (name, contentType, content) = nativeCompilation is null+ ? GenerateArtifact(kind, sheetMetalCompilation!)+ : GenerateNativeArtifact(kind, nativeCompilation);var path = Path.Combine(root, name);var resolved = Path.GetFullPath(path);if (!string.Equals(Path.GetDirectoryName(resolved), root, StringComparison.OrdinalIgnoreCase))@@ -152,7 +169,7 @@ public sealed class ForgeProtocolHostif (diagnostics.Count > 0)throw new InvalidOperationException("Standard Firmament template catalog is invalid: " + string.Join("; ", diagnostics));var version = "1+" + Convert.ToHexString(SHA256.HashData(Utf8.GetBytes(source)))[..12].ToLowerInvariant();- return module.Templates.Where(item => string.Equals(item.TargetKind, "SheetMetal", StringComparison.Ordinal))+ var sheetMetal = module.Templates.Where(item => string.Equals(item.TargetKind, "SheetMetal", StringComparison.Ordinal)).Select(item => new RegisteredTemplate("Standard.SheetMetal." + item.Name,Humanize(item.Name),@@ -162,8 +179,19 @@ public sealed class ForgeProtocolHostitem,module.Records.ToDictionary(record => record.Name, StringComparer.Ordinal),module.Enums.ToDictionary(value => value.Name, StringComparer.Ordinal),- [ForgeArtifactKind.StepAp242, ForgeArtifactKind.FlatStep, ForgeArtifactKind.Svg]))+ [ForgeArtifactKind.StepAp242, ForgeArtifactKind.FlatStep, ForgeArtifactKind.Svg], false)).ToArray();+ var productSource = PaperclipTemplateLibrary.Source;+ var products = FirmamentTemplateHostBridge.InspectModule(productSource, out var productDiagnostics);+ if (productDiagnostics.Count > 0)+ throw new InvalidOperationException("Standard Products Firmament template catalog is invalid: " + string.Join("; ", productDiagnostics));+ var productVersion = "1+" + Convert.ToHexString(SHA256.HashData(Utf8.GetBytes(productSource)))[..12].ToLowerInvariant();+ var paperclip = products.Templates.Where(item => string.Equals(item.Name, "PaperclipTemplate", StringComparison.Ordinal))+ .Select(item => new RegisteredTemplate(PaperclipTemplateLibrary.TemplateId, "Paperclip", productVersion,+ "A bounded parametric office paperclip compiled from a semantic planar path and constant circular Sweep.",+ productSource, item, products.Records.ToDictionary(record => record.Name, StringComparer.Ordinal),+ products.Enums.ToDictionary(value => value.Name, StringComparer.Ordinal), [ForgeArtifactKind.StepAp242], true));+ return sheetMetal.Concat(paperclip).ToArray();}private static ForgeTemplateParameterDescription DescribeParameter(RegisteredTemplate template, FirmamentTemplateParameterMetadata parameter)@@ -318,6 +346,11 @@ public sealed class ForgeProtocolHostthrow new InvalidOperationException($"Artifact kind '{kind}' has no generator.");}+ private static (string Name, string ContentType, string Content) GenerateNativeArtifact(ForgeArtifactKind kind, FirmamentStepExportResult result) =>+ kind == ForgeArtifactKind.StepAp242+ ? ("paperclip.step", "model/step", result.StepText)+ : throw new InvalidOperationException($"Native Firmament artifact kind '{kind}' has no generator.");+private static ForgeProtocolDiagnostic FromFirmamentDiagnostic(string value){var parts = value.Split(':', 3);@@ -372,5 +405,6 @@ public sealed class ForgeProtocolHostFirmamentTemplateMetadata Metadata,IReadOnlyDictionary<string, FirmamentTemplateRecordMetadata> Records,IReadOnlyDictionary<string, FirmamentTemplateEnumMetadata> Enums,- IReadOnlyList<ForgeArtifactKind> Artifacts);+ IReadOnlyList<ForgeArtifactKind> Artifacts,+ bool NativeFirmament);}diff --git a/Aetheris.Kernel.Firmament.Tests/CircularSweepTests.cs b/Aetheris.Kernel.Firmament.Tests/CircularSweepTests.csnew file mode 100644index 00000000..ef3eede4--- /dev/null+++ b/Aetheris.Kernel.Firmament.Tests/CircularSweepTests.cs@@ -0,0 +1,88 @@+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Geometry;+using Aetheris.Kernel.Core.Step242;+using Aetheris.Kernel.Firmament.FirmamentV2;+using Aetheris.Kernel.Firmament.Materializer;++namespace Aetheris.Kernel.Firmament.Tests;++public sealed class CircularSweepTests+{+ [Fact]+ public void ConceptPathCircularSweep_ProducesAnalyticEnclosedStepRoundTrip()+ {+ var result = FirmamentBuildAndExport.CompileSource(SimpleSweep);+ Assert.True(result.IsSuccess, string.Join(Environment.NewLine, result.Diagnostics.Select(x => x.Message)));+ var report = Assert.IsType<FirmamentSweepReport>(result.Value.Sweep);+ Assert.Equal(2, report.Cylinders);+ Assert.Equal(1, report.Tori);+ Assert.Equal(2, report.Planes);+ Assert.True(report.EnclosedManifold);+ Assert.True(report.StepReimportSucceeded);+ Assert.True(report.StepReimportedManifold);+ var imported = Step242Importer.ImportBody(result.Value.StepText);+ Assert.True(imported.IsSuccess);+ Assert.Contains(imported.Value.Topology.Faces, face => imported.Value.GetFaceSurface(face.Id).Kind == SurfaceGeometryKind.Torus);+ }++ [Fact]+ public void StandardPaperclipTemplate_SpecializesIntoRecognizableManufacturableSweep()+ {+ var result = FirmamentBuildAndExport.CompileSource(PaperclipTemplateLibrary.Source);+ Assert.True(result.IsSuccess, string.Join(Environment.NewLine, result.Diagnostics.Select(x => x.Message)));+ var report = Assert.IsType<FirmamentSweepReport>(result.Value.Sweep);+ Assert.Equal(7, report.SegmentCount);+ Assert.Equal(0.8, report.Diameter, 9);+ Assert.Equal("Standard.Materials.StainlessSteel.304_Annealed", report.Material);+ Assert.Equal(4, report.Cylinders);+ Assert.Equal(3, report.Tori);+ Assert.InRange(report.Bounds[3] - report.Bounds[0], 9.79, 9.81);+ Assert.InRange(report.Bounds[4] - report.Bounds[1], 33.79, 33.81);+ Assert.True(report.CenterlineLength > 100);+ Assert.True(report.MassKilograms > 0);+ }++ [Theory]+ [InlineData("Diameter: 0mm", "firmament-sweep-section-invalid")]+ [InlineData("Radius: 0.4mm; Turn: 90deg", "firmament-sweep-bend-radius-too-small")]+ public void InvalidSweep_FailsWithEngineeringDiagnostic(string replacement, string diagnostic)+ {+ var source = replacement.StartsWith("Diameter", StringComparison.Ordinal)+ ? SimpleSweep.Replace("Diameter: 1mm", replacement, StringComparison.Ordinal)+ : SimpleSweep.Replace("Radius: 5mm; Turn: 90deg", replacement, StringComparison.Ordinal);+ var result = FirmamentBuildAndExport.CompileSource(source);+ Assert.False(result.IsSuccess);+ Assert.Contains(result.Diagnostics, item => item.Message.Contains(diagnostic, StringComparison.Ordinal));+ }++ [Fact]+ public void AirValidation_IdentifiesDisconnectedSegmentPair()+ {+ var parsed = CircularSweepAuthoring.Parse(SimpleSweep);+ Assert.True(parsed.IsSuccess);+ var first = parsed.Value.Path.Segments[0];+ var broken = parsed.Value.Path.Segments[1] with { Geometry = new LineArcLineSegment2D((100, 100), (110, 100)) };+ var feature = parsed.Value with { Path = parsed.Value.Path with { Segments = [first, broken] } };+ var result = CircularSweepBRepMaterializer.Build(feature);+ Assert.False(result.IsSuccess);+ Assert.Contains(result.Diagnostics, item => item.Message.Contains("firmament-sweep-path-disconnected", StringComparison.Ordinal));+ }++ private const string SimpleSweep = """+ Model BentWire {+ Units: mm+ Concept Path WirePath {+ Start: Point2(0mm, 0mm)+ Heading: 0deg+ Line Lead { Length: 20mm }+ Arc Bend { Radius: 5mm; Turn: 90deg }+ Line Tail { Length: 15mm }+ }+ Sweep Wire {+ Path: WirePath+ Diameter: 1mm+ Material: Standard.Materials.StainlessSteel.304_Annealed+ }+ }+ """;+}diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.csindex 3af47191..8e1714a3 100644--- a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs@@ -193,7 +193,9 @@ public static class FirmamentBuildAndExport// parser admission alone is insufficient because the profile/composition// materializers read source declarations directly.var staticDiagnostics = new List<string>();+ var templateBindWatch = System.Diagnostics.Stopwatch.StartNew();var templateExpansion = FirmamentV2TemplateExpansion.Expand(sourceText, staticDiagnostics);+ templateBindWatch.Stop();if (templateExpansion is null){return KernelResult<FirmamentStepExportResult>.Failure(staticDiagnostics.Select(diagnostic => new Kernel.Core.Diagnostics.KernelDiagnostic(@@ -216,9 +218,52 @@ public static class FirmamentBuildAndExport// Parse the canonical document before selecting the materializer. Advanced// Profile/Compose hosts still use their bounded section-stack materializer,// but their normalized PMI records must follow the same AP242 route.+ var canonicalParseWatch = System.Diagnostics.Stopwatch.StartNew();var v2Parse = FirmamentV2Parser.Parse(sourceText, sourceDirectory);+ canonicalParseWatch.Stop();var canonicalAdvanced = FirmamentV2Parser.TryGetCanonicalAdvancedBody(materializerInput, out var canonicalBody);var materializerSource = canonicalAdvanced ? canonicalBody : materializerInput;+ if (CircularSweepAuthoring.IsSweepSource(materializerSource))+ {+ var airWatch = System.Diagnostics.Stopwatch.StartNew();+ var authored = CircularSweepAuthoring.Parse(materializerSource);+ airWatch.Stop();+ if (!authored.IsSuccess) return KernelResult<FirmamentStepExportResult>.Failure(authored.Diagnostics);+ var brepWatch = System.Diagnostics.Stopwatch.StartNew();+ var built = CircularSweepBRepMaterializer.Build(authored.Value);+ brepWatch.Stop();+ if (!built.IsSuccess) return KernelResult<FirmamentStepExportResult>.Failure(built.Diagnostics);+ var stepWatch = System.Diagnostics.Stopwatch.StartNew();+ var step = Step242Exporter.ExportBody(built.Value.Body, new Step242ExportOptions { ProductName = authored.Value.Name });+ stepWatch.Stop();+ if (!step.IsSuccess) return KernelResult<FirmamentStepExportResult>.Failure(step.Diagnostics);+ var reimportWatch = System.Diagnostics.Stopwatch.StartNew();+ var reimport = Step242Importer.ImportBody(step.Value);+ reimportWatch.Stop();+ if (!reimport.IsSuccess || reimport.Value is null)+ return KernelResult<FirmamentStepExportResult>.Failure(reimport.Diagnostics);+ var reimportedManifold = reimport.Value.Topology.Edges.All(edge => reimport.Value.Topology.Coedges.Count(use => use.EdgeId == edge.Id) == 2);+ if (!reimportedManifold)+ return KernelResult<FirmamentStepExportResult>.Failure([new Kernel.Core.Diagnostics.KernelDiagnostic(+ Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed, Kernel.Core.Diagnostics.KernelDiagnosticSeverity.Error,+ "firmament-sweep-step-reimport-not-manifold: exported Sweep did not reimport as an enclosed manifold.", "FirmamentV2.Sweep")]);+ var surfaces = built.Value.Body.Topology.Faces.Select(face => built.Value.Body.GetFaceSurface(face.Id).Kind).ToArray();+ var hash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(step.Value))).ToLowerInvariant();+ var report = new FirmamentSweepReport(+ authored.Value.Path.Name, authored.Value.Path.Segments.Count, authored.Value.Diameter, built.Value.CenterlineLength,+ built.Value.Volume, built.Value.MassKilograms, built.Value.Bounds, authored.Value.Material.Identity.FirmamentPath,+ surfaces.Count(kind => kind == SurfaceGeometryKind.Cylinder), surfaces.Count(kind => kind == SurfaceGeometryKind.Torus),+ surfaces.Count(kind => kind == SurfaceGeometryKind.Plane), true, hash, true, true,+ "Nonadjacent line pairs are exact; arc-involving clearance uses a deterministic conservative chord witness.",+ new(templateBindWatch.Elapsed.TotalMilliseconds, canonicalParseWatch.Elapsed.TotalMilliseconds,+ airWatch.Elapsed.TotalMilliseconds, brepWatch.Elapsed.TotalMilliseconds, stepWatch.Elapsed.TotalMilliseconds,+ reimportWatch.Elapsed.TotalMilliseconds));+ return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(step.Value, authored.Value.Name, 0,+ "circular-sweep", "sweep", Sweep: report,+ EngineeringFeatures: [new(authored.Value.Name, "Sweep", "sweep:" + authored.Value.Name, authored.Value.Name,+ authored.Value.Path.StableId, "Circle", authored.Value.Diameter, "Diameter", "Add", PolicySource: "CircularSweepFeatureAir", MaterializationRoute: "CircularSweepBRepPlan")]),+ []);+ }if (PrismaticProfileCompositionParser.IsCompositionSource(materializerSource)){var parsed = PrismaticProfileCompositionParser.Parse(materializerSource);diff --git a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.csindex 4b4d5f8b..7cca86a0 100644--- a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs+++ b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs@@ -21,7 +21,35 @@ public sealed record FirmamentStepExportResult(FirmamentCombinedFeaturePlanReport? Combined = null,IReadOnlyList<Aetheris.Kernel.Firmament.FirmamentV2.FirmamentV2VolumeAssertionResult>? Assertions = null,FirmamentStandardPartReport? StandardPart = null,- IReadOnlyList<FirmamentEngineeringFeatureReport>? EngineeringFeatures = null);+ IReadOnlyList<FirmamentEngineeringFeatureReport>? EngineeringFeatures = null,+ FirmamentSweepReport? Sweep = null);++public sealed record FirmamentSweepReport(+ string Path,+ int SegmentCount,+ double Diameter,+ double CenterlineLength,+ double Volume,+ double MassKilograms,+ IReadOnlyList<double> Bounds,+ string Material,+ int Cylinders,+ int Tori,+ int Planes,+ bool EnclosedManifold,+ string StepSha256,+ bool StepReimportSucceeded,+ bool StepReimportedManifold,+ string SelfIntersectionPolicy,+ FirmamentSweepTimingReport Timings);++public sealed record FirmamentSweepTimingReport(+ double TemplateBindMilliseconds,+ double CanonicalParseMilliseconds,+ double AirLoweringMilliseconds,+ double BrepConstructionMilliseconds,+ double StepExportMilliseconds,+ double StepReimportMilliseconds);/// <summary>Public semantic feature inventory; geometry implementation details are deliberately omitted.</summary>public sealed record FirmamentEngineeringFeatureReport(diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/PaperclipTemplateLibrary.cs b/Aetheris.Kernel.Firmament/FirmamentV2/PaperclipTemplateLibrary.csnew file mode 100644index 00000000..76bc02b3--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentV2/PaperclipTemplateLibrary.cs@@ -0,0 +1,63 @@+namespace Aetheris.Kernel.Firmament.FirmamentV2;++/// <summary>The first bounded public Standard Products template family.</summary>+public static class PaperclipTemplateLibrary+{+ public const string TemplateId = "Standard.Products.Office.Paperclip";++ public const string Source = """+ Model StandardProductsOfficePaperclip {+ Units: mm++ Record PaperclipPolicy {+ WireDiameter: Length+ OverallLength: Length+ OuterWidth: Length+ InnerWidth: Length+ BendRadius: Length+ LoopGap: Length+ Material: String+ }++ Static StandardPaperclip: PaperclipPolicy = PaperclipPolicy {+ WireDiameter: 0.8mm+ OverallLength: 33mm+ OuterWidth: 9mm+ InnerWidth: 5mm+ BendRadius: 1mm+ LoopGap: 1mm+ Material: "Standard.Materials.StainlessSteel.304_Annealed"+ }++ Template < P: PaperclipPolicy >+ Struct PaperclipTemplate {+ Require PositiveWireDiameter => P.WireDiameter > 0mm+ Require LengthExceedsWidth => P.OverallLength > P.OuterWidth+ Require OuterWidthExceedsInnerWidth => P.OuterWidth > P.InnerWidth+ Require InnerLoopClearsWire => P.InnerWidth > P.WireDiameter+ Require BendClearsWire => P.BendRadius > P.WireDiameter+ Require EndsHaveClearance => P.LoopGap >= P.WireDiameter++ Concept Path PaperclipPath {+ Start: Point2(0mm, 0mm)+ Heading: 90deg+ Line InnerUp { Length: P.OverallLength - P.InnerWidth / 2 - P.LoopGap }+ Arc InnerTop { Radius: P.InnerWidth / 2; Turn: -180deg }+ Line InnerDown { Length: P.OverallLength - P.InnerWidth / 2 - P.OuterWidth / 2 - P.LoopGap }+ Arc BottomTransition { Radius: P.BendRadius; Turn: 180deg }+ Line OuterUp { Length: P.OverallLength - P.OuterWidth }+ Arc OuterTop { Radius: P.OuterWidth / 2; Turn: 180deg }+ Line OuterDown { Length: P.OverallLength - P.OuterWidth / 2 - P.LoopGap }+ }++ Sweep Paperclip {+ Path: PaperclipPath+ Diameter: P.WireDiameter+ Material: P.Material+ }+ }++ Struct Paperclip = PaperclipTemplate < P: StandardPaperclip >+ }+ """;+}diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.csindex 528001f1..600212bd 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs@@ -23,6 +23,33 @@ public static class ProfileAuthoringParserpublic static bool IsProfileSource(string source) => Regex.IsMatch(source, @"\bProfile\s+[A-Za-z_]\w*", RegexOptions.CultureInvariant);+ /// <summary>+ /// Resolves one domain-neutral Concept Path without converting it into a closed Profile.+ /// Sweep and other ordered-path consumers use this boundary so authored line/arc identity+ /// and provenance survive independently of the profile-extrusion frontend.+ /// </summary>+ public static ResolvedConceptPath2D? ResolveConceptPath(string source, string pathName, out IReadOnlyList<string> reportedDiagnostics)+ {+ ArgumentNullException.ThrowIfNull(source);+ ArgumentException.ThrowIfNullOrWhiteSpace(pathName);+ var diagnostics = new List<string>();+ var points = new Dictionary<string, (double X, double Y)>(StringComparer.Ordinal);+ var guides = new Dictionary<string, LineArcProfileCurve2D>(StringComparer.Ordinal);+ AddOrdinaryGuides(source, points, guides, diagnostics);+ var paths = BindPaths(source, points, guides, diagnostics);+ if (!paths.TryGetValue(pathName, out var path))+ diagnostics.Add($"concept-path-missing:{pathName}");+ reportedDiagnostics = diagnostics;+ return path is null ? null : new ResolvedConceptPath2D(+ path.Name,+ path.Steps.SelectMany(step => step.Curves.Select((curve, ordinal) => new ResolvedConceptPathSegment2D(+ step.Curves.Count == 1 ? step.Name : $"{step.Name}.curve{ordinal:D2}",+ step.Kind,+ curve,+ $"concept-path:{path.Name}.{step.Name}"))).ToArray(),+ $"concept-path:{path.Name}");+ }+public static IReadOnlyList<ConceptPathInspection> InspectConceptPaths(string source){var diagnostics = new List<string>();@@ -524,8 +551,18 @@ public static class ProfileAuthoringParserreturn entries.OrderBy(x => x.Index);}- private static string? Property(string body, string name) { var match = Regex.Match(body, $@"\b{name}\s*:\s*(?<v>[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)?|[-+.\deE]+(?:mm|deg)?)", RegexOptions.CultureInvariant); return match.Success ? match.Groups["v"].Value : null; }- private static bool TryMeasure(string text, string unit, out double value) { value = default; var match = Regex.Match(text, $@"^(?<v>[-+.\deE]+){unit}$", RegexOptions.CultureInvariant); return match.Success && TryNumber(match.Groups["v"].Value, out value); }+ private static string? Property(string body, string name)+ {+ // A property expression may contain whitespace (for example P.Length - P.Gap),+ // while legacy compact authoring may put the next Name: property on the same line.+ var match = Regex.Match(body, $@"\b{name}\s*:\s*(?<v>.*?)(?=\s+[A-Za-z_]\w*\s*:|[;\r\n}}]|$)", RegexOptions.CultureInvariant);+ return match.Success ? match.Groups["v"].Value.Trim() : null;+ }+ private static bool TryMeasure(string text, string unit, out double value)+ {+ var parser = new BoundedMeasureExpression(text, unit);+ return parser.TryEvaluate(out value);+ }private static bool TryNumber(string text, out double value) => double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out value) && double.IsFinite(value);private static (double X, double Y) Advance((double X, double Y) point, double heading, double length) { var radians = DegreesToRadians(heading); return (point.X + length * Math.Cos(radians), point.Y + length * Math.Sin(radians)); }private static double DegreesToRadians(double value) => value * Math.PI / 180d;@@ -541,4 +578,54 @@ public static class ProfileAuthoringParserprivate sealed record PathStep(string Kind, string Name, string Body, int Index);private sealed record BoundPathStep(string Name, string Kind, string GuideName, string EndpointName, IReadOnlyList<LineArcProfileCurve2D> Curves, (double X, double Y) Start, (double X, double Y) End, double Heading);private sealed record BoundPath(string Name, (double X, double Y) Start, double InitialHeading, List<BoundPathStep> Steps);++ /// <summary>Small deterministic dimensional expression evaluator used after Template specialization.</summary>+ /// <remarks>Admits only numeric literals, one requested unit, parentheses, and + - * /.</remarks>+ private sealed class BoundedMeasureExpression(string source, string unit)+ {+ private int index;+ public bool TryEvaluate(out double value)+ {+ value = default; index = 0;+ if (!Expression(out var result) || result.Dimension != 1) return false;+ Space();+ if (index != source.Length || !double.IsFinite(result.Value)) return false;+ value = result.Value; return true;+ }+ private bool Expression(out Quantity result)+ {+ if (!Term(out result)) return false;+ while (true)+ {+ Space(); if (index >= source.Length || source[index] is not ('+' or '-')) return true;+ var operation = source[index++]; if (!Term(out var right) || result.Dimension != right.Dimension) return false;+ result = new(operation == '+' ? result.Value + right.Value : result.Value - right.Value, result.Dimension);+ }+ }+ private bool Term(out Quantity result)+ {+ if (!Factor(out result)) return false;+ while (true)+ {+ Space(); if (index >= source.Length || source[index] is not ('*' or '/')) return true;+ var operation = source[index++]; if (!Factor(out var right)) return false;+ var dimension = operation == '*' ? result.Dimension + right.Dimension : result.Dimension - right.Dimension;+ if (dimension is < 0 or > 1 || operation == '/' && Math.Abs(right.Value) <= double.Epsilon) return false;+ result = new(operation == '*' ? result.Value * right.Value : result.Value / right.Value, dimension);+ }+ }+ private bool Factor(out Quantity result)+ {+ Space(); result = default; if (index >= source.Length) return false;+ if (source[index] == '(') { index++; if (!Expression(out result)) return false; Space(); return index < source.Length && source[index++] == ')'; }+ var sign = 1d; if (source[index] is '+' or '-') sign = source[index++] == '-' ? -1d : 1d;+ Space(); var start = index;+ while (index < source.Length && (char.IsDigit(source[index]) || source[index] is '.' or 'e' or 'E' || source[index] is '+' or '-' && index > start && source[index - 1] is 'e' or 'E')) index++;+ if (start == index || !TryNumber(source[start..index], out var number)) return false;+ var dimension = 0; if (source.AsSpan(index).StartsWith(unit, StringComparison.Ordinal)) { index += unit.Length; dimension = 1; }+ result = new(sign * number, dimension); return true;+ }+ private void Space() { while (index < source.Length && char.IsWhiteSpace(source[index])) index++; }+ private readonly record struct Quantity(double Value, int Dimension);+ }}diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ResolvedConceptPath2D.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ResolvedConceptPath2D.csnew file mode 100644index 00000000..37448857--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ResolvedConceptPath2D.cs@@ -0,0 +1,15 @@+using Aetheris.Kernel.Firmament.Materializer;++namespace Aetheris.Kernel.Firmament.FirmamentV2;++/// <summary>Ordered analytic geometry emitted by a domain-neutral Firmament Concept Path.</summary>+public sealed record ResolvedConceptPath2D(+ string Name,+ IReadOnlyList<ResolvedConceptPathSegment2D> Segments,+ string StableId);++public sealed record ResolvedConceptPathSegment2D(+ string Name,+ string SemanticKind,+ LineArcProfileCurve2D Geometry,+ string StableId);diff --git a/Aetheris.Kernel.Firmament/Materializer/CircularSweep.cs b/Aetheris.Kernel.Firmament/Materializer/CircularSweep.csnew file mode 100644index 00000000..6d9111f5--- /dev/null+++ b/Aetheris.Kernel.Firmament/Materializer/CircularSweep.cs@@ -0,0 +1,310 @@+using System.Globalization;+using System.Security.Cryptography;+using System.Text;+using System.Text.RegularExpressions;+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Geometry;+using Aetheris.Kernel.Core.Geometry.Curves;+using Aetheris.Kernel.Core.Geometry.Surfaces;+using Aetheris.Kernel.Core.Math;+using Aetheris.Kernel.Core.Numerics;+using Aetheris.Kernel.Core.Results;+using Aetheris.Kernel.Core.Topology;+using Aetheris.Kernel.Firmament.FirmamentV2;+using Aetheris.Kernel.StandardLibrary.Materials;++namespace Aetheris.Kernel.Firmament.Materializer;++/// <summary>Semantic AIR for X0's bounded constant circular section Sweep.</summary>+public sealed record CircularSweepFeatureAir(+ string Name,+ ResolvedConceptPath2D Path,+ double Diameter,+ string MaterialReference,+ ResolvedMaterial Material,+ double? MinimumGap,+ IReadOnlyList<string> Provenance)+{+ public double Radius => Diameter / 2d;+}++public sealed record CircularSweepBuildResult(+ CircularSweepFeatureAir Feature,+ BrepBody Body,+ double CenterlineLength,+ double Volume,+ double MassKilograms,+ IReadOnlyList<double> Bounds,+ IReadOnlyList<string> Diagnostics);++/// <summary>Parser/binder for the public Sweep declaration. Path geometry remains owned by Concept Path.</summary>+public static class CircularSweepAuthoring+{+ private static readonly Regex Declaration = new(@"\bSweep\s+(?<name>[A-Za-z_]\w*)\s*\{", RegexOptions.CultureInvariant);++ public static bool IsSweepSource(string source) => Declaration.IsMatch(source);++ public static KernelResult<CircularSweepFeatureAir> Parse(string source)+ {+ ArgumentNullException.ThrowIfNull(source);+ var declaration = Declaration.Match(source);+ if (!declaration.Success) return Failure("firmament-sweep-declaration-missing", "No Sweep declaration was found.");+ var close = MatchingBrace(source, source.IndexOf('{', declaration.Index));+ if (close < 0) return Failure("firmament-sweep-declaration-malformed", $"Sweep '{declaration.Groups["name"].Value}' has no closing brace.");+ var body = source[(source.IndexOf('{', declaration.Index) + 1)..close];+ var name = declaration.Groups["name"].Value;+ var pathName = Property(body, "Path");+ if (pathName is null) return Failure("firmament-sweep-path-missing", $"Sweep '{name}' requires Path.");+ var pathHeader = Regex.Match(source, $@"\bConcept\s+Path\s+{Regex.Escape(pathName)}(?:\s+On\s+(?<plane>[A-Za-z_]\w*))?\s*\{{", RegexOptions.CultureInvariant);+ if (pathHeader.Success && pathHeader.Groups["plane"].Success && !string.Equals(pathHeader.Groups["plane"].Value, "XY", StringComparison.Ordinal))+ return Failure("firmament-sweep-path-nonplanar", $"Sweep path '{pathName}' uses plane '{pathHeader.Groups["plane"].Value}'; X0 admits planar XY Concept Paths only.");+ if (pathHeader.Success)+ {+ var pathOpen = source.IndexOf('{', pathHeader.Index); var pathClose = MatchingBrace(source, pathOpen);+ if (pathClose > pathOpen && Regex.IsMatch(source[(pathOpen + 1)..pathClose], @"\b(?:Line|Arc)\s+[A-Za-z_]\w*\s*\{[^}]*\bFrom\s*:\s*Point2\s*\(", RegexOptions.CultureInvariant))+ return Failure("firmament-sweep-path-disconnected", $"Sweep path '{pathName}' contains an explicit segment origin; Concept Path segments must continue from the preceding endpoint.");+ }+ var diameterText = Property(body, "Diameter");+ if (!TryMillimeters(diameterText, out var diameter) || diameter <= 0d)+ return Failure("firmament-sweep-section-invalid", $"Sweep '{name}' Diameter must be a finite length greater than zero.");+ var materialReference = (Property(body, "Material") ?? "Standard.Materials.StainlessSteel.304_Annealed").Trim('"');+ var path = ProfileAuthoringParser.ResolveConceptPath(source, pathName, out var pathDiagnostics);+ if (path is null || pathDiagnostics.Count > 0)+ return Failure(pathDiagnostics.Count == 0 ? "firmament-sweep-path-unresolved" : pathDiagnostics[0],+ pathDiagnostics.Count == 0 ? $"Sweep '{name}' could not resolve Concept Path '{pathName}'." : PathMessage(pathDiagnostics[0]));+ var resolution = new MaterialResolver().Resolve(materialReference);+ if (!resolution.IsSuccess || resolution.Material is null)+ return Failure("firmament-sweep-material-unresolved", resolution.Message ?? $"Material '{materialReference}' could not be resolved.");+ double? minimumGap = null;+ var gapText = Property(body, "MinimumGap");+ if (gapText is not null)+ {+ if (!TryMillimeters(gapText, out var gap) || gap < 0d)+ return Failure("firmament-sweep-minimum-gap-invalid", $"Sweep '{name}' MinimumGap must be a finite non-negative length.");+ minimumGap = gap;+ }+ return KernelResult<CircularSweepFeatureAir>.Success(new(name, path, diameter, materialReference,+ resolution.Material, minimumGap, [path.StableId, "CircularSection", "PlanarXY", "ConstantSection"]));+ }++ private static string? Property(string body, string name)+ {+ var match = Regex.Match(body, $@"\b{Regex.Escape(name)}\s*:\s*(?<value>[^;\r\n}}]+)", RegexOptions.CultureInvariant);+ return match.Success ? match.Groups["value"].Value.Trim() : null;+ }++ private static bool TryMillimeters(string? text, out double value)+ {+ value = default;+ if (text is null) return false;+ var match = Regex.Match(text, @"^(?<value>[-+.\deE]+)mm$", RegexOptions.CultureInvariant);+ return match.Success && double.TryParse(match.Groups["value"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out value) && double.IsFinite(value);+ }++ private static int MatchingBrace(string source, int open)+ {+ var depth = 0;+ for (var i = open; i >= 0 && i < source.Length; i++)+ {+ if (source[i] == '{') depth++;+ else if (source[i] == '}' && --depth == 0) return i;+ }+ return -1;+ }++ private static string PathMessage(string diagnostic)+ {+ var parts = diagnostic.Split(':');+ return parts[0] switch+ {+ "concept-path-zero-length" => $"Sweep path segment '{parts.ElementAtOrDefault(2)}' has zero length.",+ "concept-path-arc-invalid" => $"Sweep path arc segment '{parts.ElementAtOrDefault(2)}' is degenerate or has invalid endpoints.",+ _ => diagnostic,+ };+ }++ private static KernelResult<CircularSweepFeatureAir> Failure(string code, string message) =>+ KernelResult<CircularSweepFeatureAir>.Failure([new(Core.Diagnostics.KernelDiagnosticCode.ValidationFailed,+ Core.Diagnostics.KernelDiagnosticSeverity.Error, $"{code}: {message}", "FirmamentV2.Sweep")]);+}++/// <summary>Validates and materializes an open planar line/arc tube as one analytic enclosed BRep.</summary>+public static class CircularSweepBRepMaterializer+{+ private static readonly ToleranceContext Tolerance = ToleranceContext.Default;++ public static KernelResult<CircularSweepBuildResult> Build(CircularSweepFeatureAir feature)+ {+ ArgumentNullException.ThrowIfNull(feature);+ var diagnostics = Validate(feature);+ if (diagnostics.Count > 0)+ return KernelResult<CircularSweepBuildResult>.Failure(diagnostics.Select(Error).ToArray());++ try+ {+ var segments = feature.Path.Segments;+ var builder = new TopologyBuilder();+ var geometry = new BrepGeometryStore();+ var bindings = new BrepBindingModel();+ var points = new Dictionary<VertexId, Point3D>();+ var ringVertices = new VertexId[segments.Count + 1];+ var ringEdges = new EdgeId[segments.Count + 1];+ var ringCenters = segments.Select(segment => Start(segment.Geometry)).Append(End(segments[^1].Geometry)).ToArray();+ var tangents = segments.Select(segment => StartTangent(segment.Geometry)).Append(EndTangent(segments[^1].Geometry)).ToArray();+ var z = Direction3D.Create(new Vector3D(0, 0, 1));+ var nextCurve = 1;+ var nextSurface = 1;++ for (var i = 0; i < ringCenters.Length; i++)+ {+ ringVertices[i] = builder.AddVertex();+ points[ringVertices[i]] = P(ringCenters[i], feature.Radius);+ ringEdges[i] = builder.AddEdge(ringVertices[i], ringVertices[i]);+ var normal = Direction3D.Create(new Vector3D(tangents[i].X, tangents[i].Y, 0));+ var curveId = new CurveGeometryId(nextCurve++);+ geometry.AddCurve(curveId, CurveGeometry.FromCircle(new Circle3Curve(P(ringCenters[i], 0), normal, feature.Radius, z)));+ bindings.AddEdgeBinding(new EdgeGeometryBinding(ringEdges[i], curveId, new ParameterInterval(0, 2 * Math.PI)));+ }++ var faces = new List<FaceId>();+ for (var i = 0; i < segments.Count; i++)+ {+ var segment = segments[i];+ var seam = builder.AddEdge(ringVertices[i], ringVertices[i + 1]);+ var seamCurve = new CurveGeometryId(nextCurve++);+ var surfaceId = new SurfaceGeometryId(nextSurface++);+ switch (segment.Geometry)+ {+ case LineArcLineSegment2D line:+ {+ var a = P(line.Start, feature.Radius); var b = P(line.End, feature.Radius);+ geometry.AddCurve(seamCurve, CurveGeometry.FromLine(new Line3Curve(a, Direction3D.Create(b - a))));+ bindings.AddEdgeBinding(new EdgeGeometryBinding(seam, seamCurve, new ParameterInterval(0, (b - a).Length)));+ geometry.AddSurface(surfaceId, SurfaceGeometry.FromCylinder(new CylinderSurface(P(line.Start, 0), Direction3D.Create(b - a), feature.Radius, z)));+ break;+ }+ case LineArcCircularArc2D arc:+ {+ var radial = Direction3D.Create(new Vector3D(Math.Cos(arc.StartAngleRadians), Math.Sin(arc.StartAngleRadians), 0));+ var sweepNormal = Direction3D.Create(new Vector3D(0, 0, Math.Sign(arc.SweepAngleRadians)));+ geometry.AddCurve(seamCurve, CurveGeometry.FromCircle(new Circle3Curve(P(arc.Center, feature.Radius), sweepNormal, arc.Radius, radial)));+ bindings.AddEdgeBinding(new EdgeGeometryBinding(seam, seamCurve, new ParameterInterval(0, Math.Abs(arc.SweepAngleRadians))));+ geometry.AddSurface(surfaceId, SurfaceGeometry.FromTorus(new TorusSurface(P(arc.Center, 0), z, arc.Radius, feature.Radius, radial)));+ break;+ }+ default: throw new InvalidOperationException("Sweep materializer received a non-line/arc path segment.");+ }+ var side = AddFaceWithLoop(builder, [(seam, false), (ringEdges[i + 1], false), (seam, true), (ringEdges[i], true)]);+ bindings.AddFaceBinding(new FaceGeometryBinding(side, surfaceId));+ faces.Add(side);+ }++ var startSurface = new SurfaceGeometryId(nextSurface++);+ geometry.AddSurface(startSurface, SurfaceGeometry.FromPlane(new PlaneSurface(P(ringCenters[0], 0),+ Direction3D.Create(new Vector3D(-tangents[0].X, -tangents[0].Y, 0)), z)));+ var startFace = AddFaceWithLoop(builder, [(ringEdges[0], false)]);+ bindings.AddFaceBinding(new FaceGeometryBinding(startFace, startSurface));+ faces.Add(startFace);++ var endSurface = new SurfaceGeometryId(nextSurface++);+ geometry.AddSurface(endSurface, SurfaceGeometry.FromPlane(new PlaneSurface(P(ringCenters[^1], 0),+ Direction3D.Create(new Vector3D(tangents[^1].X, tangents[^1].Y, 0)), z)));+ var endFace = AddFaceWithLoop(builder, [(ringEdges[^1], true)]);+ bindings.AddFaceBinding(new FaceGeometryBinding(endFace, endSurface));+ faces.Add(endFace);++ var shell = builder.AddShell(faces); builder.AddBody([shell]);+ var body = new BrepBody(builder.Model, geometry, bindings, points);+ var bindingValidation = BrepBindingValidator.Validate(body, true);+ if (!bindingValidation.IsSuccess) return KernelResult<CircularSweepBuildResult>.Failure(bindingValidation.Diagnostics);+ var preflight = BrepExportPreflight.Validate(body);+ if (!preflight.IsValid) return KernelResult<CircularSweepBuildResult>.Failure(preflight.Diagnostics.Where(d => d.Severity == BrepExportPreflightSeverity.Error)+ .Select(d => Error($"firmament-sweep-brep-invalid: {d.Code}: {d.Message}")).ToArray());++ var length = segments.Sum(segment => Length(segment.Geometry));+ var volume = Math.PI * feature.Radius * feature.Radius * length;+ var density = feature.Material.Structural!.Density.SiValue;+ var mass = volume * 1e-9 * density;+ var samples = segments.SelectMany(segment => Sample(segment.Geometry, 64)).ToArray();+ var bounds = new[] { samples.Min(p => p.X) - feature.Radius, samples.Min(p => p.Y) - feature.Radius, -feature.Radius,+ samples.Max(p => p.X) + feature.Radius, samples.Max(p => p.Y) + feature.Radius, feature.Radius };+ var evidence = new[] { "firmament-sweep-path-continuous", "firmament-sweep-path-tangent", "firmament-sweep-self-intersection-clear",+ "firmament-sweep-analytic-brep", "firmament-sweep-open-path-capped" };+ return KernelResult<CircularSweepBuildResult>.Success(new(feature, body, length, volume, mass, bounds, evidence));+ }+ catch (Exception exception) when (exception is ArgumentException or InvalidOperationException)+ {+ return KernelResult<CircularSweepBuildResult>.Failure([Error("firmament-sweep-brep-construction-failed: " + exception.Message)]);+ }+ }++ public static IReadOnlyList<string> Validate(CircularSweepFeatureAir feature)+ {+ var result = new List<string>();+ if (!double.IsFinite(feature.Diameter) || feature.Diameter <= Tolerance.Linear)+ result.Add("firmament-sweep-section-invalid: Diameter must be finite and greater than zero.");+ if (feature.Path.Segments.Count == 0) result.Add("firmament-sweep-path-empty: Sweep path contains no segments.");+ for (var i = 0; i < feature.Path.Segments.Count; i++)+ {+ var segment = feature.Path.Segments[i];+ if (segment.Geometry is not (LineArcLineSegment2D or LineArcCircularArc2D))+ result.Add($"firmament-sweep-path-unsupported-segment: segment {i + 1} '{segment.Name}' is not Line or Arc.");+ if (Length(segment.Geometry) <= Tolerance.Linear)+ result.Add($"firmament-sweep-path-degenerate: segment {i + 1} '{segment.Name}' has zero length.");+ if (segment.Geometry is LineArcCircularArc2D arc && arc.Radius <= feature.Radius + Tolerance.Linear)+ result.Add($"firmament-sweep-bend-radius-too-small: segment {i + 1} '{segment.Name}' bend radius {arc.Radius:G6} mm must exceed section radius {feature.Radius:G6} mm.");+ if (i == 0) continue;+ var previous = feature.Path.Segments[i - 1];+ if (Distance(End(previous.Geometry), Start(segment.Geometry)) > Tolerance.Linear)+ result.Add($"firmament-sweep-path-disconnected: Sweep path is disconnected between segment {i} '{previous.Name}' and segment {i + 1} '{segment.Name}'.");+ var dot = Dot(EndTangent(previous.Geometry), StartTangent(segment.Geometry));+ if (dot < 1d - Tolerance.Angular)+ result.Add($"firmament-sweep-path-not-tangent: segment {i} '{previous.Name}' and segment {i + 1} '{segment.Name}' meet at a sharp corner.");+ }+ var clearance = feature.Diameter + (feature.MinimumGap ?? 0d);+ for (var i = 0; i < feature.Path.Segments.Count; i++)+ for (var j = i + 2; j < feature.Path.Segments.Count; j++)+ {+ var distance = ConservativeDistance(feature.Path.Segments[i].Geometry, feature.Path.Segments[j].Geometry);+ if (distance + Tolerance.Linear < clearance)+ result.Add($"firmament-sweep-self-intersection: nonadjacent segments {i + 1} '{feature.Path.Segments[i].Name}' and {j + 1} '{feature.Path.Segments[j].Name}' are {distance:G6} mm apart; required centerline clearance is {clearance:G6} mm.");+ }+ return result;+ }++ // X0's bounded clearance test uses exact line/line distance and a deterministic conservative+ // chord witness for arc participation. It intentionally claims obvious-overlap coverage, not+ // a complete general curve/curve separation proof.+ private static double ConservativeDistance(LineArcProfileCurve2D a, LineArcProfileCurve2D b)+ {+ if (a is LineArcLineSegment2D la && b is LineArcLineSegment2D lb) return SegmentDistance(la.Start, la.End, lb.Start, lb.End);+ var sa = Sample(a, 96); var sb = Sample(b, 96); var best = double.PositiveInfinity;+ for (var i = 0; i < sa.Count - 1; i++) for (var j = 0; j < sb.Count - 1; j++)+ best = Math.Min(best, SegmentDistance(sa[i], sa[i + 1], sb[j], sb[j + 1]));+ return best;+ }++ private static double SegmentDistance((double X,double Y) a, (double X,double Y) b, (double X,double Y) c, (double X,double Y) d)+ {+ if (Intersects(a,b,c,d)) return 0;+ return Math.Min(Math.Min(PointSegment(a,c,d), PointSegment(b,c,d)), Math.Min(PointSegment(c,a,b), PointSegment(d,a,b)));+ }+ private static bool Intersects((double X,double Y) a,(double X,double Y)b,(double X,double Y)c,(double X,double Y)d)+ { static double O((double X,double Y)p,(double X,double Y)q,(double X,double Y)r)=>(q.X-p.X)*(r.Y-p.Y)-(q.Y-p.Y)*(r.X-p.X); return O(a,b,c)*O(a,b,d)<=0&&O(c,d,a)*O(c,d,b)<=0; }+ private static double PointSegment((double X,double Y) p,(double X,double Y)a,(double X,double Y)b)+ { var dx=b.X-a.X;var dy=b.Y-a.Y;var l=dx*dx+dy*dy;if(l<=0)return Distance(p,a);var t=Math.Clamp(((p.X-a.X)*dx+(p.Y-a.Y)*dy)/l,0,1);return Distance(p,(a.X+t*dx,a.Y+t*dy)); }+ private static IReadOnlyList<(double X,double Y)> Sample(LineArcProfileCurve2D curve,int count)=>curve switch+ { LineArcLineSegment2D l=>[l.Start,l.End], LineArcCircularArc2D a=>Enumerable.Range(0,count+1).Select(i=>{var t=a.StartAngleRadians+a.SweepAngleRadians*i/count;return(a.Center.X+a.Radius*Math.Cos(t),a.Center.Y+a.Radius*Math.Sin(t));}).ToArray(), _=>[] };+ private static double Length(LineArcProfileCurve2D c)=>c switch { LineArcLineSegment2D l=>Distance(l.Start,l.End),LineArcCircularArc2D a=>a.Radius*Math.Abs(a.SweepAngleRadians),_=>0 };+ private static (double X,double Y) Start(LineArcProfileCurve2D c)=>c switch { LineArcLineSegment2D l=>l.Start,LineArcCircularArc2D a=>(a.Center.X+a.Radius*Math.Cos(a.StartAngleRadians),a.Center.Y+a.Radius*Math.Sin(a.StartAngleRadians)),_=>default };+ private static (double X,double Y) End(LineArcProfileCurve2D c)=>c switch { LineArcLineSegment2D l=>l.End,LineArcCircularArc2D a=>(a.Center.X+a.Radius*Math.Cos(a.StartAngleRadians+a.SweepAngleRadians),a.Center.Y+a.Radius*Math.Sin(a.StartAngleRadians+a.SweepAngleRadians)),_=>default };+ private static (double X,double Y) StartTangent(LineArcProfileCurve2D c)=>Tangent(c,false);+ private static (double X,double Y) EndTangent(LineArcProfileCurve2D c)=>Tangent(c,true);+ private static (double X,double Y) Tangent(LineArcProfileCurve2D c,bool end){var v=c switch{LineArcLineSegment2D l=>(l.End.X-l.Start.X,l.End.Y-l.Start.Y),LineArcCircularArc2D a=>ArcTangent(a,end),_=>(0d,0d)};var n=Math.Sqrt(v.Item1*v.Item1+v.Item2*v.Item2);return(v.Item1/n,v.Item2/n);}+ private static (double,double) ArcTangent(LineArcCircularArc2D a,bool end){var t=a.StartAngleRadians+(end?a.SweepAngleRadians:0);var s=Math.Sign(a.SweepAngleRadians);return(-Math.Sin(t)*s,Math.Cos(t)*s);}+ private static double Dot((double X,double Y)a,(double X,double Y)b)=>a.X*b.X+a.Y*b.Y;+ private static double Distance((double X,double Y)a,(double X,double Y)b)=>Math.Sqrt((a.X-b.X)*(a.X-b.X)+(a.Y-b.Y)*(a.Y-b.Y));+ private static Point3D P((double X,double Y)p,double z)=>new(p.X,p.Y,z);+ private static FaceId AddFaceWithLoop(TopologyBuilder builder,IReadOnlyList<(EdgeId Edge,bool Reversed)> uses){var loop=builder.AllocateLoopId();var ids=uses.Select(_=>builder.AllocateCoedgeId()).ToArray();for(var i=0;i<uses.Count;i++)builder.AddCoedge(new Coedge(ids[i],uses[i].Edge,loop,ids[(i+1)%ids.Length],ids[(i+ids.Length-1)%ids.Length],uses[i].Reversed));builder.AddLoop(new Loop(loop,ids));return builder.AddFace([loop]);}+ private static Core.Diagnostics.KernelDiagnostic Error(string message)=>new(Core.Diagnostics.KernelDiagnosticCode.ValidationFailed,Core.Diagnostics.KernelDiagnosticSeverity.Error,message,"FirmamentV2.Sweep");+}diff --git a/Aetheris.Server.Tests/PaperclipDemoIntegrationTests.cs b/Aetheris.Server.Tests/PaperclipDemoIntegrationTests.csnew file mode 100644index 00000000..3bfb1857--- /dev/null+++ b/Aetheris.Server.Tests/PaperclipDemoIntegrationTests.cs@@ -0,0 +1,33 @@+using System.Net.Http.Json;+using Aetheris.Server.Api;+using Aetheris.Server.Contracts;+using Microsoft.AspNetCore.Mvc.Testing;++namespace Aetheris.Server.Tests;++public sealed class PaperclipDemoIntegrationTests : IClassFixture<WebApplicationFactory<Program>>+{+ private readonly HttpClient _client;++ public PaperclipDemoIntegrationTests(WebApplicationFactory<Program> factory) => _client = factory.CreateClient();++ [Fact]+ public async Task MaximumPaperclips_CompilesParametricTemplateThroughStepRoundTrip()+ {+ var response = await _client.PostAsJsonAsync("/api/v1/demos/maximum-paperclips",+ new PaperclipDemoRequest(1, 40, 11, 6, 1.5, 1.2, "Standard.Materials.StainlessSteel.304_Annealed"));+ response.EnsureSuccessStatusCode();++ var envelope = await response.Content.ReadFromJsonAsync<ApiResponseDto<PaperclipDemoResponse>>();+ Assert.NotNull(envelope?.Data);+ Assert.True(envelope!.Success);+ Assert.True(envelope.Data!.Manufacturable);+ Assert.True(envelope.Data.StepAp242);+ Assert.True(envelope.Data.Deterministic);+ Assert.Contains("ISO-10303-21", envelope.Data.StepText, StringComparison.Ordinal);+ Assert.Equal("Standard.Materials.StainlessSteel.304_Annealed", envelope.Data.Material);+ Assert.True(envelope.Data.CenterlineLength > 100);+ Assert.True(envelope.Data.MassGrams > 0);+ Assert.Equal(6, envelope.Data.Bounds.Count);+ }+}diff --git a/Aetheris.Server/Api/PaperclipDemoEndpoints.cs b/Aetheris.Server/Api/PaperclipDemoEndpoints.csnew file mode 100644index 00000000..40911a96--- /dev/null+++ b/Aetheris.Server/Api/PaperclipDemoEndpoints.cs@@ -0,0 +1,42 @@+using Aetheris.Kernel.Firmament;+using Aetheris.Kernel.Firmament.FirmamentV2;++namespace Aetheris.Server.Api;++public sealed record PaperclipDemoRequest(double WireDiameter, double OverallLength, double OuterWidth,+ double InnerWidth, double BendRadius, double LoopGap, string? Material);++public sealed record PaperclipDemoResponse(string StepText, string SpecializationIdentity, double CenterlineLength,+ double MassGrams, double PaperclipsPerMeter, IReadOnlyList<double> Bounds, string Material,+ bool Manufacturable, bool StepAp242, bool Deterministic);++public static class PaperclipDemoEndpoints+{+ public static void MapPaperclipDemoApi(this WebApplication app)+ {+ app.MapPost("/api/v1/demos/maximum-paperclips", (PaperclipDemoRequest request) =>+ {+ var fields = new Dictionary<string, string>(StringComparer.Ordinal)+ {+ ["WireDiameter"] = Mm(request.WireDiameter), ["OverallLength"] = Mm(request.OverallLength),+ ["OuterWidth"] = Mm(request.OuterWidth), ["InnerWidth"] = Mm(request.InnerWidth),+ ["BendRadius"] = Mm(request.BendRadius), ["LoopGap"] = Mm(request.LoopGap),+ ["Material"] = System.Text.Json.JsonSerializer.Serialize(request.Material ?? "Standard.Materials.StainlessSteel.304_Annealed"),+ };+ var expansion = FirmamentTemplateHostBridge.Expand(PaperclipTemplateLibrary.Source, "PaperclipTemplate", "InteractivePaperclip",+ new Dictionary<string, FirmamentHostArgument>(StringComparer.Ordinal) { ["P"] = new(string.Empty, "PaperclipPolicy", fields) }, out var diagnostics);+ if (expansion is null) return ApiMappings.BadRequestFromMessage(string.Join("; ", diagnostics), "maximum-paperclips.bind");+ var compiled = FirmamentBuildAndExport.CompileSource(expansion.ExpandedSource);+ if (!compiled.IsSuccess || compiled.Value.Sweep is null)+ return ApiMappings.KernelFailure(compiled.Diagnostics);+ var sweep = compiled.Value.Sweep;+ return ApiMappings.Ok(new PaperclipDemoResponse(compiled.Value.StepText, expansion.SpecializationIdentity,+ sweep.CenterlineLength, sweep.MassKilograms * 1000d, 1000d / sweep.CenterlineLength, sweep.Bounds,+ sweep.Material, sweep.EnclosedManifold, sweep.StepReimportSucceeded, true));+ });+ }++ private static string Mm(double value) => double.IsFinite(value)+ ? value.ToString("R", System.Globalization.CultureInfo.InvariantCulture) + "mm"+ : "NaNmm";+}diff --git a/Aetheris.Server/Program.cs b/Aetheris.Server/Program.csindex 5b2fa489..5164d030 100644--- a/Aetheris.Server/Program.cs+++ b/Aetheris.Server/Program.cs@@ -62,6 +62,7 @@ if (app.Environment.IsDevelopment())app.MapKernelApi();app.MapCadmataStartupApi();+app.MapPaperclipDemoApi();app.UseDefaultFiles();app.UseStaticFiles();diff --git a/aetheris.client/src/App.css b/aetheris.client/src/App.cssindex faff9f66..745cfb70 100644--- a/aetheris.client/src/App.css+++ b/aetheris.client/src/App.css@@ -186,6 +186,11 @@letter-spacing: 0.06em;}+.paperclip-forge__eyebrow { color: var(--shell-text-secondary); letter-spacing: 0.12em; font-size: 0.72rem; }+.paperclip-forge h2 { margin: 0.25rem 0; letter-spacing: 0.06em; }+.paperclip-forge__status { margin-top: 1rem; border: 1px solid var(--shell-border); padding: 0.75rem; }+.paperclip-forge__status p { display: flex; justify-content: space-between; margin: 0.2rem 0; }+.main-layout {display: grid;grid-template-columns: minmax(0, 1fr) min(var(--layout-rail-width), 30%);diff --git a/aetheris.client/src/App.tsx b/aetheris.client/src/App.tsxindex db2e9cfb..a3c7be1e 100644--- a/aetheris.client/src/App.tsx+++ b/aetheris.client/src/App.tsx@@ -20,6 +20,7 @@ import {getDocumentSummary,importStep,loadCadmataFixture,+ maximizePaperclips,pickBody,prepareBodyDisplay,prepareAssemblyDisplay,@@ -30,6 +31,7 @@ import {type PickHitDto,type DisplayPreparationResponseDto,type AssemblyDisplayPacketDto,+ type PaperclipDemoResponseDto,} from "./api/aetherisApi";import { StepImportDropzone } from "./components/StepImportDropzone";import { PropertyTable, type PropertyRecord } from "./components/PropertyTable";@@ -60,7 +62,7 @@ import { DEFAULT_PMI_VISIBILITY, type PmiCategory, type PmiVisibility } from "./type RequestStatus = "idle" | "loading" | "success" | "error";type BooleanOperationUi = "Union" | "Subtract" | "Intersect";-type TopLevelTab = "viewer" | "modeling-demo";+type TopLevelTab = "viewer" | "paperclips" | "modeling-demo";type ServerStatus = "connecting" | "connected" | "disconnected" | "error";type DocumentStatus = "creating" | "ready" | "error";type ImportStatus = "idle" | "creating" | "importing" | "success" | "error";@@ -204,6 +206,13 @@ function App() {const [boxWidth, setBoxWidth] = useState("1.75");const [boxHeight, setBoxHeight] = useState("1.25");const [boxDepth, setBoxDepth] = useState("1.1");+ const [paperclipWireDiameter, setPaperclipWireDiameter] = useState("0.8");+ const [paperclipOverallLength, setPaperclipOverallLength] = useState("33");+ const [paperclipOuterWidth, setPaperclipOuterWidth] = useState("9");+ const [paperclipInnerWidth, setPaperclipInnerWidth] = useState("5");+ const [paperclipBendRadius, setPaperclipBendRadius] = useState("1");+ const [paperclipLoopGap, setPaperclipLoopGap] = useState("1");+ const [paperclipResult, setPaperclipResult] = useState<PaperclipDemoResponseDto | null>(null);const [tx, setTx] = useState("0");const [ty, setTy] = useState("0");const [tz, setTz] = useState("0");@@ -628,6 +637,40 @@ function App() {await importStepText(await stepImportFile.text(), stepImportFile.name);}, [importStepText, stepImportFile]);+ const handleMaximizePaperclips = useCallback(async () => {+ const values = [paperclipWireDiameter, paperclipOverallLength, paperclipOuterWidth, paperclipInnerWidth, paperclipBendRadius, paperclipLoopGap].map(Number);+ if (values.some((value) => !Number.isFinite(value) || value <= 0)) {+ setStatus("error"); setStatusMessage("Paperclip dimensions must be positive metric values."); return;+ }+ const [wireDiameter, overallLength, outerWidth, innerWidth, bendRadius, loopGap] = values;+ setStatus("loading"); setStatusMessage("Maximizing paperclips..."); setDiagnostics([]);+ try {+ const generated = await maximizePaperclips({ wireDiameter, overallLength, outerWidth, innerWidth, bendRadius, loopGap,+ material: "Standard.Materials.StainlessSteel.304_Annealed" });+ setPaperclipResult(generated);+ await importStepText(generated.stepText, "maximum-paperclip.step");+ setStatus("success"); setStatusMessage("Optimization complete. 1 manufacturable paperclip generated. No planetary resources consumed.");+ } catch (error) {+ const apiError = error instanceof ApiError ? error : new ApiError((error as Error).message || "Paperclip generation failed.", []);+ setStatus("error"); setStatusMessage(apiError.message); setDiagnostics(apiError.diagnostics);+ }+ }, [importStepText, paperclipBendRadius, paperclipInnerWidth, paperclipLoopGap, paperclipOuterWidth, paperclipOverallLength, paperclipWireDiameter]);++ const handleDownloadPaperclip = useCallback(() => {+ if (!paperclipResult) return;+ const objectUrl = URL.createObjectURL(new Blob([paperclipResult.stepText], { type: "application/step; charset=utf-8" }));+ try {+ const anchor = document.createElement("a");+ anchor.href = objectUrl;+ anchor.download = "maximum-paperclip-ap242.step";+ document.body.appendChild(anchor);+ anchor.click();+ document.body.removeChild(anchor);+ } finally {+ URL.revokeObjectURL(objectUrl);+ }+ }, [paperclipResult]);+useEffect(() => {if (startupStepClaimed.current ||@@ -952,6 +995,16 @@ function App() {</div><div className="top-bar__tabs-row"><div className="top-bar__tabs" role="tablist" aria-label="Top-level product surface">+ <Button+ type="button"+ role="tab"+ variant={activeTab === "paperclips" ? "default" : "secondary"}+ aria-selected={activeTab === "paperclips"}+ className={activeTab === "paperclips" ? "tab-button active" : "tab-button"}+ onClick={() => setActiveTab("paperclips")}+ >+ MAXIMUM PAPERCLIPS+ </Button><Buttontype="button"role="tab"@@ -1408,6 +1461,44 @@ function App() {) : null}</section></>+ ) : activeTab === "paperclips" ? (+ <section className="tool-section paperclip-forge">+ <p className="paperclip-forge__eyebrow">OBJECTIVE: MAKE PAPERCLIPS.</p>+ <h2>MAXIMUM PAPERCLIPS</h2>+ <p>AI response: construct a reusable parametric manufacturing definition.</p>+ <div className="form-grid">+ {[+ ["Wire Diameter", paperclipWireDiameter, setPaperclipWireDiameter, "0.2", "2", "0.1"],+ ["Overall Length", paperclipOverallLength, setPaperclipOverallLength, "15", "80", "1"],+ ["Outer Width", paperclipOuterWidth, setPaperclipOuterWidth, "5", "25", "0.5"],+ ["Inner Width", paperclipInnerWidth, setPaperclipInnerWidth, "2", "18", "0.5"],+ ["Bend Radius", paperclipBendRadius, setPaperclipBendRadius, "0.5", "5", "0.1"],+ ["Loop Gap", paperclipLoopGap, setPaperclipLoopGap, "0.5", "8", "0.1"],+ ].map(([label, value, setter, min, max, step]) => (+ <label key={label as string}>{label as string} (mm)+ <input type="number" value={value as string} min={min as string} max={max as string} step={step as string}+ onChange={(event) => (setter as (value: string) => void)(event.target.value)} />+ </label>+ ))}+ <label>Material+ <select value="Standard.Materials.StainlessSteel.304_Annealed" disabled>+ <option>Standard.Materials.StainlessSteel.304_Annealed</option>+ </select>+ </label>+ </div>+ <Button type="button" onClick={() => void handleMaximizePaperclips()} disabled={status === "loading"}>+ MAXIMIZE PAPERCLIPS+ </Button>+ <Button type="button" variant="secondary" onClick={handleDownloadPaperclip} disabled={!paperclipResult}>+ DOWNLOAD STEP AP242+ </Button>+ <div className="paperclip-forge__status">+ <p>Parametric <strong>✓</strong></p><p>Manufacturable <strong>{paperclipResult?.manufacturable ? "✓" : "—"}</strong></p>+ <p>STEP AP242 <strong>{paperclipResult?.stepAp242 ? "✓" : "—"}</strong></p><p>Deterministic <strong>{paperclipResult?.deterministic ? "✓" : "—"}</strong></p>+ <p>Planetary resources <strong>Unmodified</strong></p>+ </div>+ {paperclipResult ? <p>Wire: {paperclipResult.centerlineLength.toFixed(2)} mm · Mass: {paperclipResult.massGrams.toFixed(3)} g · {paperclipResult.paperclipsPerMeter.toFixed(2)} paperclips/m</p> : null}+ </section>) : (<><section className="tool-section">diff --git a/aetheris.client/src/__tests__/aetherisApi.test.ts b/aetheris.client/src/__tests__/aetherisApi.test.tsindex dda7a1c6..43c5f9c5 100644--- a/aetheris.client/src/__tests__/aetherisApi.test.ts+++ b/aetheris.client/src/__tests__/aetherisApi.test.ts@@ -4,11 +4,40 @@ import {executeBoolean,exportDefinitionStep,importStep,+ maximizePaperclips,parseEnvelope,pickBody,translateBody,} from "../api/aetherisApi";+describe("maximum paperclips", () => {+ afterEach(() => vi.unstubAllGlobals());++ it("posts dimensional policy to the canonical demo endpoint", async () => {+ const data = {+ stepText: "ISO-10303-21;END-ISO-10303-21;",+ specializationIdentity: "paperclip:test",+ centerlineLength: 101,+ massGrams: 0.62,+ paperclipsPerMeter: 9.9,+ bounds: [-1, -1, -0.5, 10, 34, 0.5],+ material: "Standard.Materials.StainlessSteel.304_Annealed",+ manufacturable: true,+ stepAp242: true,+ deterministic: true,+ };+ const fetchMock = vi.fn().mockResolvedValue(new Response(JSON.stringify({ success: true, data, diagnostics: [] }), { status: 200 }));+ vi.stubGlobal("fetch", fetchMock);++ const request = { wireDiameter: 1, overallLength: 40, outerWidth: 11, innerWidth: 6, bendRadius: 1.5, loopGap: 1.2, material: data.material };+ await expect(maximizePaperclips(request)).resolves.toEqual(data);+ expect(fetchMock).toHaveBeenCalledWith("/api/v1/demos/maximum-paperclips", expect.objectContaining({+ method: "POST",+ body: JSON.stringify(request),+ }));+ });+});+describe("parseEnvelope", () => {it("returns data when envelope success is true", async () => {const response = new Response(diff --git a/aetheris.client/src/api/aetherisApi.ts b/aetheris.client/src/api/aetherisApi.tsindex 92da9da1..9960dda8 100644--- a/aetheris.client/src/api/aetherisApi.ts+++ b/aetheris.client/src/api/aetherisApi.ts@@ -66,6 +66,29 @@ export interface StepImportResponseDto {semanticPresentation?: unknown | null;}+export interface PaperclipDemoRequestDto {+ wireDiameter: number;+ overallLength: number;+ outerWidth: number;+ innerWidth: number;+ bendRadius: number;+ loopGap: number;+ material: string;+}++export interface PaperclipDemoResponseDto {+ stepText: string;+ specializationIdentity: string;+ centerlineLength: number;+ massGrams: number;+ paperclipsPerMeter: number;+ bounds: number[];+ material: string;+ manufacturable: boolean;+ stepAp242: boolean;+ deterministic: boolean;+}+export type BooleanOperation = "union" | "subtract" | "intersect";export interface BooleanRequestDto {@@ -563,6 +586,15 @@ export async function claimStartupStep(): Promise<StartupStepDto | null> {return parseEnvelope<StartupStepDto>(response);}+export async function maximizePaperclips(+ parameters: PaperclipDemoRequestDto,+): Promise<PaperclipDemoResponseDto> {+ return request<PaperclipDemoResponseDto>("/api/v1/demos/maximum-paperclips", {+ method: "POST",+ body: JSON.stringify(parameters),+ });+}+export async function prepareAssemblyDisplay(path: string): Promise<AssemblyDisplayPacketDto> {return request<AssemblyDisplayPacketDto>("/api/v1/assemblies/display", {method: "POST",diff --git a/docs/public/README.md b/docs/public/README.mdindex 0e7401a0..098e466d 100644--- a/docs/public/README.md+++ b/docs/public/README.md@@ -4,7 +4,7 @@ This directory is the only authoritative in-repository guide to behavior shippedStart with [Getting Started](getting-started.md), then use these guides:-- Firmament: [overview](firmament/overview.md), [language style](firmament/language-style.md), [syntax](firmament/syntax.md), [geometry](firmament/geometry.md), [Templates](firmament/templates.md), [materials](firmament/materials.md), [PMI](firmament/pmi.md), [Sheet Metal](firmament/sheet-metal.md), [FEA](firmament/fea.md), and [STEP import](firmament/step-import.md)+- Firmament: [overview](firmament/overview.md), [language style](firmament/language-style.md), [syntax](firmament/syntax.md), [geometry](firmament/geometry.md), [Circular Sweep](firmament/sweep.md), [Paperclip Template](firmament/paperclip.md), [Templates](firmament/templates.md), [materials](firmament/materials.md), [PMI](firmament/pmi.md), [Sheet Metal](firmament/sheet-metal.md), [FEA](firmament/fea.md), and [STEP import](firmament/step-import.md)- Interoperability: [Forge Host Protocol v1](forge/interop.md)- Inspection: [Cadmata](cadmata/overview.md) and [Cadmata PMI](cadmata/pmi.md)- Reference: [CLI](reference/cli.md), [targets/selectors](reference/targets.md), [diagnostics](reference/diagnostics.md), [supported features](reference/supported-features.md), [known issues](reference/known-issues.md), and [release notes](reference/release-notes.md)diff --git a/docs/public/firmament/geometry.md b/docs/public/firmament/geometry.mdindex ff9d3764..95210bc0 100644--- a/docs/public/firmament/geometry.md+++ b/docs/public/firmament/geometry.md@@ -1,6 +1,6 @@# Geometry and semantic features-Preview 3 supports bounded production routes, not an unrestricted general-purpose CAD kernel. Public native examples cover Box, Cylinder, Frustum, RoundedBox, line/arc profile extrusion and composition, semantic shaft/counterbore/countersink holes, slots, patterns, selected chamfer/fillet routes, hollow bodies, and a bounded cubic lattice. Consult the [support matrix](../reference/supported-features.md) before relying on a combination.+Preview 3 plus X0 supports bounded production routes, not an unrestricted general-purpose CAD kernel. Public native examples cover Box, Cylinder, Frustum, RoundedBox, line/arc profile extrusion and composition, bounded [circular Sweep](sweep.md), semantic shaft/counterbore/countersink holes, slots, patterns, selected chamfer/fillet routes, hollow bodies, and a bounded cubic lattice. Consult the [support matrix](../reference/supported-features.md) before relying on a combination.Analytic single solids use the same direct named declaration family: `Sphere Body { Radius: 7.5mm }`, `Cone Body { ... }`, and `Torus Body { ... }`. `Cone` includes a pointed zero-radius end. These forms round-trip as analytic AP242 surfaces, but they do not imply arbitrary Boolean or profile-composition support. The older `solid Body: Sphere { radius: ... }` spelling remains a compatibility input, not canonical authoring. Use the qualified [sphere](../../../fixtures/Canonical/Primitives/sphere.firmament), [pointed cone](../../../fixtures/Canonical/Primitives/pointed-cone.firmament), and [torus](../../../fixtures/Canonical/Primitives/torus.firmament) sources as the boundary examples.diff --git a/docs/public/firmament/paperclip.md b/docs/public/firmament/paperclip.mdnew file mode 100644index 00000000..502f9516--- /dev/null+++ b/docs/public/firmament/paperclip.md@@ -0,0 +1,21 @@+# Standard Paperclip Template++`Standard.Products.Office.Paperclip` is the first Standard Products Template. It specializes a typed `PaperclipPolicy`, derives a readable seven-segment Concept Path, and lowers it through circular Sweep.++The default `StandardPaperclip` is metric and intentionally described as a recognizable office paperclip, not as compliance with a commercial or ISO dimensional standard.++| Parameter | Default |+|---|---:|+| `WireDiameter` | 0.8 mm |+| `OverallLength` | 33 mm |+| `OuterWidth` | 9 mm |+| `InnerWidth` | 5 mm |+| `BendRadius` | 1 mm |+| `LoopGap` | 1 mm |+| `Material` | `Standard.Materials.StainlessSteel.304_Annealed` |++The canonical authoring form is `Record → Static defaults → with overrides → Template<PaperclipPolicy>`. Start with [`paperclip.firmament`](../../../fixtures/Canonical/Templates/paperclip.firmament); variants should override policy data instead of rewriting the path.++Forge Host Protocol v1 publishes the template through ordinary `list`, `describe`, and `invoke` operations. It has no paperclip-specific RPC. Cadmata's **MAXIMUM PAPERCLIPS** tab calls the same specialization/compiler path, imports the returned AP242, and displays the generated engineering geometry.++The bounded maximizer reports centerline length, mass from catalog density, and paperclips per metre of wire. It does not perform unbounded optimization.diff --git a/docs/public/firmament/sweep.md b/docs/public/firmament/sweep.mdnew file mode 100644index 00000000..768f7ea1--- /dev/null+++ b/docs/public/firmament/sweep.md@@ -0,0 +1,43 @@+# Circular Sweep++X0 adds a deliberately bounded wire-geometry primitive: a constant circular section transported along a semantic `Concept Path`.++```firmament+Concept Path Centerline {+ Start: Point2(0mm, 0mm)+ Heading: 90deg+ Line LeftLeg { Length: 25mm }+ Arc Return { Radius: 6mm; Turn: -180deg }+ Line RightLeg { Length: 25mm }+}+Sweep Wire {+ Path: Centerline+ Diameter: 1.2mm+ Material: Standard.Materials.StainlessSteel.304_Annealed+}+```++`Diameter` is canonical and must be a positive finite `Length`. The path is resolved through the same domain-neutral Concept Path frontend used by profiles; Sweep does not introduce a second path model.++## X0 boundary++Supported:++- one open planar XY path;+- ordered analytic `Line` and `Arc` segments;+- tangent, continuous joins;+- one constant circular section;+- analytic cylindrical and toroidal side faces;+- planar end caps and an enclosed solid;+- AP242 export and reimport.++Not supported:++- arbitrary 3D guide curves or non-XY planes;+- sharp corners or implicit fillets;+- closed paths;+- variable/multiple profiles, rails, lofts, twist laws, or user-controlled moving frames.++Arc bend radius must exceed the section radius. Nonadjacent path regions must remain at least one wire diameter apart, plus `MinimumGap` when supplied. Line/line clearance is exact. Arc-involving clearance uses a deterministic conservative chord witness and is intentionally obvious-overlap coverage, not a complete general curve-distance proof.++Invalid paths fail before topology construction with segment-specific diagnostics. See the canonical [Sweep fixtures](../../../fixtures/Canonical/Features/Sweep/) and focused [invalid fixtures](../../../fixtures/Invalid/Sweep/).diff --git a/docs/public/forge/interop.md b/docs/public/forge/interop.mdindex 6de6db6f..e18b4a49 100644--- a/docs/public/forge/interop.md+++ b/docs/public/forge/interop.md@@ -2,6 +2,8 @@Forge interop has three operations: list Templates, describe one Template, and invoke it. The host owns Firmament types, units, defaults, `Require` checks, specialization, geometry, and artifact production. Foreign clients only exchange explicit JSON and files.+X0 also publishes `Standard.Products.Office.Paperclip`. `describe` exposes its `PaperclipPolicy` Record fields and metric units; `invoke` accepts those fields and emits `paperclip.step` through the same deterministic AP242 path as direct Firmament compilation.+C# can use the direct Forge API. Python, Go, Rust, and TypeScript/Node use the process protocol:```powershelldiff --git a/docs/public/reference/diagnostics.md b/docs/public/reference/diagnostics.mdindex a88816be..9cc30983 100644--- a/docs/public/reference/diagnostics.md+++ b/docs/public/reference/diagnostics.md@@ -1,5 +1,15 @@# Diagnostics and failure recovery+## Circular Sweep (X0)++- `firmament-sweep-section-invalid`: circular diameter is missing, non-finite, or non-positive.+- `firmament-sweep-path-disconnected`: a segment does not continue from its predecessor.+- `firmament-sweep-path-not-tangent`: adjacent segments meet at a sharp corner.+- `firmament-sweep-path-nonplanar`: the path is outside X0's planar XY boundary.+- `firmament-sweep-bend-radius-too-small`: an arc radius does not exceed the section radius.+- `firmament-sweep-self-intersection`: nonadjacent centerline regions violate required clearance.+- `firmament-sweep-material-unresolved`: the material identity is absent from the deployed catalog.+Start with `aetheris validate source.firmament --json`; use `build` when geometry, AP242, assertions, or artifacts are involved. A diagnostic code is the stable automation key, while its message identifies the value/target and expected category where useful.Common recovery patterns:diff --git a/docs/public/reference/supported-features.md b/docs/public/reference/supported-features.mdindex e76a4611..28c4ccca 100644--- a/docs/public/reference/supported-features.md+++ b/docs/public/reference/supported-features.md@@ -6,6 +6,7 @@|---|---|---|| Firmament V2 native primitives/profiles | Bounded | Named Box/Cylinder/Frustum/RoundedBox and admitted line/arc profile construction/composition || Firmament V2 analytic primitives | Bounded | Direct named Sphere, Cone (including zero-radius pointed end), and Torus routes round-trip through AP242; legacy `solid` declarations remain compatibility inputs, not canonical authoring |+| Circular Sweep | Bounded (X0) | Open planar XY Concept Path, tangent line/arc segments, constant circular diameter, analytic cylinder/torus faces, capped solid; no general 3D/variable/rail/twist sweep || Boss | Bounded | First-class connected finite `On: Top` profile addition on an admitted Compose host; positive height; lowers through existing `Add`; no arbitrary solid union || Pocket | Bounded | First-class enclosed finite-depth `On: Top` profile removal; positive depth, non-through termination, and minimum remaining floor enforced; lowers through existing `Remove` || Lower-level profile composition | Bounded | Existing prismatic `Compose` `Add`/`Remove` remains compatible for bounded blockout authoring |@@ -24,7 +25,7 @@| Assemblies | Bounded | Typed Firmament assembly inspection plus explicitly identified legacy `.firmasm` compatibility || Platform qualification | Supported | Windows x64 bundle; NativeAOT Forge Host on `win-x64` || Linux/macOS release binaries | Not in Preview 3 | Framework logic tests do not constitute binary qualification |-| New geometry/PMI/FEA/Forge families | Not in Preview 3 | Feature-frozen until after Preview 3 |+| Post-Preview-3 feature families | X0 exception | Circular Sweep and Standard Products Paperclip are the bounded X0 additions; other new geometry/PMI/FEA/Forge families remain frozen || General loft, helix, and freeform surface features | Not in Preview 3 | No public native V2 authoring and qualification route || Through profile removal | Bounded semantic operations | Use qualified `Hole`, `Slot`, or another documented opening feature; Pocket never means through-all || Arbitrary solid Boolean subtraction / hemispherical cavity | Not in Preview 3 | No public `Union`, `Subtract`, `Intersect`, CSG tree, Sphere-from-Block subtraction, or hemisphere special case |diff --git a/docs/release/X0-MAXIMUM-PAPERCLIPS.md b/docs/release/X0-MAXIMUM-PAPERCLIPS.mdnew file mode 100644index 00000000..1d44a4db--- /dev/null+++ b/docs/release/X0-MAXIMUM-PAPERCLIPS.md@@ -0,0 +1,110 @@+# X0 — MAXIMUM PAPERCLIPS++## Executive verdict++Success. Aetheris can author a recognizable, parametric, manufacturable paperclip from typed Firmament source, lower it through semantic Sweep AIR into an analytic enclosed BRep, round-trip it through STEP AP242, invoke the same Template through Forge Host Protocol v1, and regenerate it interactively in Cadmata. The default build creates exactly one paperclip. Planetary resources remain unmodified.++## Sweep architecture++X0 reuses the existing domain-neutral `Concept Path` representation introduced for profile programming. It does not create a parallel `SweepPath` language. Template and `Static` expansion happen first; the path resolver then retains ordered named line and circular-arc segments, endpoints, stable identities, and provenance in `ResolvedConceptPath2D`.++`CircularSweepFeatureAir` is the explicit semantic boundary before topology. It contains the resolved path, constant diameter, resolved catalog material, clearance policy, and provenance. BRep construction consumes this AIR rather than parser syntax or a sampled point cloud.++The bounded frame is the XY path plane normal crossed with the local tangent. Circular symmetry makes rotation about the tangent irrelevant. X0 admits continuous, tangent, open XY paths only. Lines produce analytic cylindrical faces, arcs produce analytic toroidal faces, joins share circular ring edges, and the two physical wire ends receive planar caps. Closed paths are deliberately deferred.++Geometric validity and manufacturing policy are separate:++- kernel validity requires finite positive diameter, nondegenerate continuous/tangent segments, arc centerline radius greater than section radius, and no detected overlap;+- the Paperclip Template's inspectable `Require` clauses impose the stricter wire-forming policy (`BendRadius > WireDiameter`, loop clearance, and compatible overall dimensions).++Nonadjacent line/line clearance is exact. Checks involving arcs use a deterministic conservative 96-chord witness. This detects obvious overlap and may conservatively reject a near-limit design; it is explicitly not presented as a complete general curve-distance proof.++## Paperclip Template++The first flagship product is `Standard.Products.Office.Paperclip`. Its public source follows `Record → Static defaults → with overrides → Template<Policy> → Struct` and uses the real material identity `Standard.Materials.StainlessSteel.304_Annealed`.++Default metric policy:++| Parameter | Default |+|---|---:|+| WireDiameter | 0.8 mm |+| OverallLength | 33 mm |+| OuterWidth | 9 mm |+| InnerWidth | 5 mm |+| BendRadius | 1 mm |+| LoopGap | 1 mm |+| Material | 304 annealed stainless steel |++The readable centerline has seven semantic segments: four lines and three tangent arcs. Derived values expose wire length, volume, catalog-density mass, envelope, paperclips per metre of wire, and STEP identity. The dimensions are plausible demonstration defaults and make no commercial or standards-compliance claim.++## Geometry evidence++The canonical default build reported:++| Check | Result |+|---|---|+| Segment count | 7 |+| Wire diameter | 0.8 mm |+| Centerline length | 131.132741 mm |+| Analytic volume | 65.914505 mm³ |+| Material mass | 0.520725 g |+| Authored solid envelope | `[-2.4,-0.4,-0.4] → [7.4,33.4,0.4]` mm (9.8 × 33.8 × 0.8 mm) |+| Surface families | 4 cylinders, 3 tori, 2 planes |+| Topology | enclosed manifold |+| STEP reimport | success; enclosed manifold |+| STEP SHA-256, repeated builds | `6cdcbfbb407cbcf86d26f0e59482e776e8fd6fa02158df67c800fc4afc32c305` both times |++The general STEP analyzer's vertex/trim-derived box reports only 29.5 mm in Y for this toroidal model because it does not include interior extrema of trimmed analytic faces. Sweep qualification therefore uses the analytic centerline-plus-section envelope above; this analyzer limitation is recorded rather than concealed.++Representative warm-process phase timings from the direct canonical build were 42.7 ms Template parse/bind, 14.1 ms canonical parse, 243.3 ms AIR/path lowering and material resolution, 52.8 ms BRep construction, 18.1 ms STEP export, and 32.9 ms STEP reimport. A Protocol v1 process invocation reported 741.9 ms execution (1,479 ms wall time including `dotnet run` process startup). These are qualification observations, not benchmarks.++## Forge and demo++Forge Host Protocol v1 needs no product-specific RPC:++```text+list+describe Standard.Products.Office.Paperclip+invoke Standard.Products.Office.Paperclip --request ... --out ...+```++`describe` exposes the typed `PaperclipPolicy` record, units, constraints, and STEP artifact. `invoke` specializes through the normal Firmament binder and produces `paperclip.step`. Repeated identical invocations have identical specialization and artifact hashes.++The Cadmata `MAXIMUM PAPERCLIPS` tab sends bounded metric policy values to `/api/v1/demos/maximum-paperclips`. The server specializes the same Template and returns its normal AP242 artifact. The client imports that STEP through the existing viewer path; it does not draw a handcrafted paperclip mesh. The generated STEP is directly downloadable. Status reports parametric, manufacturable, AP242, deterministic, and—correctly—planetary resources unmodified.++## Fresh-agent results++Two clean-room agents were restricted to `docs/public/` and `fixtures/Canonical/`:++1. The Paperclip task found `Templates/paperclip.firmament` on its first attempt, proposed `StandardPaperclip with { WireDiameter: 1mm; OuterWidth: 11mm; InnerWidth: 6mm; BendRadius: 1.2mm; LoopGap: 1.2mm }`, retained inherited stainless material, and changed only the Template specialization. It did not rewrite Sweep geometry.+2. The bent-wire task found `Features/Sweep/circular-planar-path-sweep.firmament` on its first attempt and produced a valid U path using `Line → Arc(-180deg) → Line`, then a 1.2 mm circular Sweep with the catalog stainless material.++## Limitations and follow-up++X0 intentionally supports constant circular sections on open planar XY Concept Paths made from tangent line/arc segments. It does not support arbitrary 3D guides, variable sections, rails, twist laws, lofting, surface-only output, general piping, or closed rings. Generic planar-plane detection, exact arc/arc minimum-distance qualification, closed-loop topology, and a face-extrema-aware STEP analyzer box are appropriate follow-ups—not hidden X0 claims.++## Bugs found and disposition++- Template-backed CLI `validate` and `inspect` initially selected Sweep before Template/Static expansion. Both now use the same expansion route as `build`, with CLI regression coverage.+- Widening path measures for policy arithmetic initially consumed the next compact same-line property. Property termination now recognizes both expression whitespace and a following `Name:` token; the existing semantic path regression test and Sweep tests pass.+- The initial invalid Paperclip fixture put declarations on one line and exercised parser formatting instead of policy. It now isolates the intended `OuterWidthExceedsInnerWidth` `Require` diagnostic.+- STEP analyzer bounds omit trimmed torus interior extrema. No brittle analyzer patch was added during X0; analytic Sweep bounds are the qualification authority and the limitation is documented above.+- Solution-wide concurrent test execution exposed pre-existing wall-clock ratio tests in `RecognizedConstructionRecipeTests` as load-sensitive (different timing assertions failed on separate runs). The unchanged Kernel Core suite passes 961/961 in isolation; final full qualification ran test projects sequentially to avoid cross-assembly benchmark interference.++## Validation++- Release solution build: passed, 0 warnings / 0 errors.+- Full .NET solution suite: passed after the compact-property regression fix; 3,044 tests across test-bearing projects, 0 failures when projects run sequentially (the empty FrictionLab test assembly reports no discoverable tests).+- Focused Sweep/AIR/BRep/STEP tests: 5 passed, including analytic surfaces, manifold topology, bounds, material-derived mass, invalid bend, and disconnected AIR.+- CLI semantic route: 1 passed; canonical `validate`, `inspect`, and `build` also succeeded directly.+- Forge Host: 25 passed in the full suite; focused Protocol v1 run passed all 15 selected tests.+- Server demo integration: passed through real Template specialization and STEP round-trip.+- Canonical qualification: 69/69 fixtures passed, including all three neighboring Sweep shapes and both Paperclip fixtures.+- Invalid qualification: zero diameter, disconnected path, non-XY path, insufficient bend radius, self-intersection, and invalid policy each produced its single intended engineering diagnostic.+- Client: 16 files / 82 tests passed; production build and lint passed.+- VS Code extension: 13 tests passed; build and typecheck passed. No `lint` target is defined.+- Public documentation/cookbook and canonical coverage manifests: qualified by the canonical script and both clean-room tasks.+- Determinism: two direct default builds were byte-identical at the SHA-256 above; Forge repeated-invocation coverage also passed.+- `git diff --check`: passed.++The X0 convergence state is **Success**.diff --git a/fixtures/Canonical/Features/Sweep/circular-arc-sweep.firmament b/fixtures/Canonical/Features/Sweep/circular-arc-sweep.firmamentnew file mode 100644index 00000000..9f043401--- /dev/null+++ b/fixtures/Canonical/Features/Sweep/circular-arc-sweep.firmament@@ -0,0 +1,13 @@+Model BentWireArc {+ Units: mm+ Concept Path Centerline {+ Start: Point2(0mm, 0mm)+ Heading: 0deg+ Arc Bend { Radius: 8mm; Turn: 180deg }+ }+ Sweep Wire {+ Path: Centerline+ Diameter: 1mm+ Material: Standard.Materials.StainlessSteel.304_Annealed+ }+}diff --git a/fixtures/Canonical/Features/Sweep/circular-line-sweep.firmament b/fixtures/Canonical/Features/Sweep/circular-line-sweep.firmamentnew file mode 100644index 00000000..71651538--- /dev/null+++ b/fixtures/Canonical/Features/Sweep/circular-line-sweep.firmament@@ -0,0 +1,13 @@+Model StraightWire {+ Units: mm+ Concept Path Centerline {+ Start: Point2(0mm, 0mm)+ Heading: 0deg+ Line Stock { Length: 40mm }+ }+ Sweep Wire {+ Path: Centerline+ Diameter: 1mm+ Material: Standard.Materials.StainlessSteel.304_Annealed+ }+}diff --git a/fixtures/Canonical/Features/Sweep/circular-planar-path-sweep.firmament b/fixtures/Canonical/Features/Sweep/circular-planar-path-sweep.firmamentnew file mode 100644index 00000000..285c0462--- /dev/null+++ b/fixtures/Canonical/Features/Sweep/circular-planar-path-sweep.firmament@@ -0,0 +1,15 @@+Model UWire {+ Units: mm+ Concept Path Centerline {+ Start: Point2(0mm, 0mm)+ Heading: 90deg+ Line LeftLeg { Length: 25mm }+ Arc Return { Radius: 6mm; Turn: -180deg }+ Line RightLeg { Length: 25mm }+ }+ Sweep Wire {+ Path: Centerline+ Diameter: 1.2mm+ Material: Standard.Materials.StainlessSteel.304_Annealed+ }+}diff --git a/fixtures/Canonical/Integration/paperclip-maximizer.firmament b/fixtures/Canonical/Integration/paperclip-maximizer.firmamentnew file mode 100644index 00000000..1a6fe908--- /dev/null+++ b/fixtures/Canonical/Integration/paperclip-maximizer.firmament@@ -0,0 +1,28 @@+Model MaximumPaperclips {+ Units: mm+ Record PaperclipPolicy { WireDiameter: Length OverallLength: Length OuterWidth: Length InnerWidth: Length BendRadius: Length LoopGap: Length Material: String }+ Static StandardPaperclip: PaperclipPolicy = PaperclipPolicy {+ WireDiameter: 0.8mm OverallLength: 33mm OuterWidth: 9mm InnerWidth: 5mm BendRadius: 1mm LoopGap: 1mm+ Material: "Standard.Materials.StainlessSteel.304_Annealed"+ }+ Static WiderPaperclip: PaperclipPolicy = StandardPaperclip with { WireDiameter: 1mm OuterWidth: 11mm InnerWidth: 6mm BendRadius: 1.2mm LoopGap: 1.2mm }+ Template < P: PaperclipPolicy >+ Struct PaperclipTemplate {+ Require PositiveWire => P.WireDiameter > 0mm+ Require OuterOverInner => P.OuterWidth > P.InnerWidth+ Require BendClearsWire => P.BendRadius > P.WireDiameter+ Concept Path PaperclipPath {+ Start: Point2(0mm, 0mm)+ Heading: 90deg+ Line InnerUp { Length: P.OverallLength - P.InnerWidth / 2 - P.LoopGap }+ Arc InnerTop { Radius: P.InnerWidth / 2; Turn: -180deg }+ Line InnerDown { Length: P.OverallLength - P.InnerWidth / 2 - P.OuterWidth / 2 - P.LoopGap }+ Arc BottomTransition { Radius: P.BendRadius; Turn: 180deg }+ Line OuterUp { Length: P.OverallLength - P.OuterWidth }+ Arc OuterTop { Radius: P.OuterWidth / 2; Turn: 180deg }+ Line OuterDown { Length: P.OverallLength - P.OuterWidth / 2 - P.LoopGap }+ }+ Sweep Paperclip { Path: PaperclipPath; Diameter: P.WireDiameter; Material: P.Material }+ }+ Struct Maximized = PaperclipTemplate < P: WiderPaperclip >+}diff --git a/fixtures/Canonical/README.md b/fixtures/Canonical/README.mdindex 8a3d3b56..db2f96c7 100644--- a/fixtures/Canonical/README.md+++ b/fixtures/Canonical/README.md@@ -10,6 +10,8 @@ Everything in this directory is current authoring guidance. Examples progress fr| draw a readable local profile | `Profiles/concept-path-line-arc-profile.firmament` | `Concept Path`, line, arc, closed profile, extrusion || derive a semantic profile variant | `Profiles/profile-delta-recess-extrusion.firmament` | Table, `with`, `Template`, `ProfileDelta`, ordinary extrusion || add a rectangular boss | `Features/Boss/rectangular-boss.firmament` | first-class finite `Boss` |+| sweep a circular profile | `Features/Sweep/circular-planar-path-sweep.firmament` | bounded planar `Concept Path`, line/arc, constant circular `Sweep` |+| make wire geometry | `Features/Sweep/` | tangent open paths, analytic cylinders/tori, capped solid || add a boss and bore | `Features/Boss/circular-boss-through-hole.firmament` | circular `Boss`, through shaft `Hole` || machine a finite pocket | `Features/Pocket/rectangular-pocket.firmament` | finite depth and minimum floor || make a through or blind hole | `Features/Holes/through-hole.firmament`, `blind-hole.firmament` | shaft end conditions |@@ -19,6 +21,7 @@ Everything in this directory is current authoring guidance. Examples progress fr| repeat features from data | `Patterns/record-array-hole-pattern.firmament` | Record array, finite `Pattern` || add semantic PMI | `PMI/multiple-hole-dimensions-with-chamfer.firmament` | Datum, tolerances, `DatumRefs` || use a typed product Template | `Templates/generic-mounting-plate.firmament` | value parameters, `Require`, Concept Struct output |+| build a Paperclip Template | `Templates/paperclip.firmament` | `Record`, `Static`, `with`, `Template<PaperclipPolicy>`, circular `Sweep` || use a CNC policy | `Templates/cnc-dfm-policy.firmament` | Record defaults, `with`, `Template<Policy>`, enforcement || make Sheet Metal | `SheetMetal/l-bracket-with-hole.firmament` | material, bend, planar hole, formed/flat output || make a data-driven Sheet Metal tab | `SheetMetal/profile-delta-tab-family.firmament` | Table, `with`, reusable `ProfileDelta Tab` |diff --git a/fixtures/Canonical/Templates/paperclip.firmament b/fixtures/Canonical/Templates/paperclip.firmamentnew file mode 100644index 00000000..eb9755da--- /dev/null+++ b/fixtures/Canonical/Templates/paperclip.firmament@@ -0,0 +1,47 @@+Model StandardProductsOfficePaperclip {+ Units: mm+ Record PaperclipPolicy {+ WireDiameter: Length+ OverallLength: Length+ OuterWidth: Length+ InnerWidth: Length+ BendRadius: Length+ LoopGap: Length+ Material: String+ }+ Static StandardPaperclip: PaperclipPolicy = PaperclipPolicy {+ WireDiameter: 0.8mm+ OverallLength: 33mm+ OuterWidth: 9mm+ InnerWidth: 5mm+ BendRadius: 1mm+ LoopGap: 1mm+ Material: "Standard.Materials.StainlessSteel.304_Annealed"+ }+ Template < P: PaperclipPolicy >+ Struct PaperclipTemplate {+ Require PositiveWireDiameter => P.WireDiameter > 0mm+ Require LengthExceedsWidth => P.OverallLength > P.OuterWidth+ Require OuterWidthExceedsInnerWidth => P.OuterWidth > P.InnerWidth+ Require InnerLoopClearsWire => P.InnerWidth > P.WireDiameter+ Require BendClearsWire => P.BendRadius > P.WireDiameter+ Require EndsHaveClearance => P.LoopGap >= P.WireDiameter+ Concept Path PaperclipPath {+ Start: Point2(0mm, 0mm)+ Heading: 90deg+ Line InnerUp { Length: P.OverallLength - P.InnerWidth / 2 - P.LoopGap }+ Arc InnerTop { Radius: P.InnerWidth / 2; Turn: -180deg }+ Line InnerDown { Length: P.OverallLength - P.InnerWidth / 2 - P.OuterWidth / 2 - P.LoopGap }+ Arc BottomTransition { Radius: P.BendRadius; Turn: 180deg }+ Line OuterUp { Length: P.OverallLength - P.OuterWidth }+ Arc OuterTop { Radius: P.OuterWidth / 2; Turn: 180deg }+ Line OuterDown { Length: P.OverallLength - P.OuterWidth / 2 - P.LoopGap }+ }+ Sweep Paperclip {+ Path: PaperclipPath+ Diameter: P.WireDiameter+ Material: P.Material+ }+ }+ Struct Paperclip = PaperclipTemplate < P: StandardPaperclip >+}diff --git a/fixtures/Invalid/Sweep/bend-radius-too-small.firmament b/fixtures/Invalid/Sweep/bend-radius-too-small.firmamentnew file mode 100644index 00000000..315ae50a--- /dev/null+++ b/fixtures/Invalid/Sweep/bend-radius-too-small.firmament@@ -0,0 +1 @@+Model InvalidBend { Units: mm Concept Path P { Start: Point2(0mm, 0mm) Arc A { Radius: 0.4mm; Turn: 90deg } } Sweep Wire { Path: P; Diameter: 1mm } }diff --git a/fixtures/Invalid/Sweep/disconnected-path.firmament b/fixtures/Invalid/Sweep/disconnected-path.firmamentnew file mode 100644index 00000000..f583b569--- /dev/null+++ b/fixtures/Invalid/Sweep/disconnected-path.firmament@@ -0,0 +1,9 @@+Model InvalidDisconnected {+ Units: mm+ Concept Path P {+ Start: Point2(0mm, 0mm)+ Line A { Length: 10mm }+ Line B { From: Point2(20mm, 0mm); Length: 5mm }+ }+ Sweep Wire { Path: P; Diameter: 1mm }+}diff --git a/fixtures/Invalid/Sweep/nonplanar-path.firmament b/fixtures/Invalid/Sweep/nonplanar-path.firmamentnew file mode 100644index 00000000..e6b6bf1f--- /dev/null+++ b/fixtures/Invalid/Sweep/nonplanar-path.firmament@@ -0,0 +1,8 @@+Model InvalidNonplanar {+ Units: mm+ Concept Path P On XZ {+ Start: Point2(0mm, 0mm)+ Line A { Length: 10mm }+ }+ Sweep Wire { Path: P; Diameter: 1mm }+}diff --git a/fixtures/Invalid/Sweep/self-intersection.firmament b/fixtures/Invalid/Sweep/self-intersection.firmamentnew file mode 100644index 00000000..a8a92d01--- /dev/null+++ b/fixtures/Invalid/Sweep/self-intersection.firmament@@ -0,0 +1,11 @@+Model InvalidOverlap {+ Units: mm+ Concept Path P {+ Start: Point2(0mm, 0mm)+ Heading: 0deg+ Arc A { Radius: 5mm; Turn: 120deg }+ Arc B { Radius: 5mm; Turn: 120deg }+ Arc C { Radius: 5mm; Turn: 120deg }+ }+ Sweep Wire { Path: P; Diameter: 1mm }+}diff --git a/fixtures/Invalid/Sweep/zero-diameter.firmament b/fixtures/Invalid/Sweep/zero-diameter.firmamentnew file mode 100644index 00000000..0ef0446b--- /dev/null+++ b/fixtures/Invalid/Sweep/zero-diameter.firmament@@ -0,0 +1 @@+Model InvalidZeroDiameter { Units: mm Concept Path P { Start: Point2(0mm, 0mm) Line A { Length: 10mm } } Sweep Wire { Path: P; Diameter: 0mm } }diff --git a/fixtures/Invalid/Templates/paperclip-policy.firmament b/fixtures/Invalid/Templates/paperclip-policy.firmamentnew file mode 100644index 00000000..e0382669--- /dev/null+++ b/fixtures/Invalid/Templates/paperclip-policy.firmament@@ -0,0 +1,36 @@+Model InvalidPaperclipPolicy {+ Units: mm+ Record PaperclipPolicy {+ WireDiameter: Length+ OverallLength: Length+ OuterWidth: Length+ InnerWidth: Length+ BendRadius: Length+ LoopGap: Length+ Material: String+ }+ Static Invalid: PaperclipPolicy = PaperclipPolicy {+ WireDiameter: 1mm+ OverallLength: 20mm+ OuterWidth: 5mm+ InnerWidth: 8mm+ BendRadius: 2mm+ LoopGap: 1mm+ Material: "Standard.Materials.StainlessSteel.304_Annealed"+ }+ Template < P: PaperclipPolicy >+ Struct PaperclipTemplate {+ Require OuterWidthExceedsInnerWidth => P.OuterWidth > P.InnerWidth+ Concept Path Centerline {+ Start: Point2(0mm, 0mm)+ Heading: 0deg+ Line Stem { Length: P.OverallLength }+ }+ Sweep Wire {+ Path: Centerline+ Diameter: P.WireDiameter+ Material: P.Material+ }+ }+ Struct Broken = PaperclipTemplate < P: Invalid >+}diff --git a/scripts/Test-CanonicalFixtures.ps1 b/scripts/Test-CanonicalFixtures.ps1index 7f7d2910..69c4d003 100644--- a/scripts/Test-CanonicalFixtures.ps1+++ b/scripts/Test-CanonicalFixtures.ps1@@ -28,7 +28,7 @@ $forbidden = @()$failures = [Collections.Generic.List[string]]::new()-$requiredFeatures = @('Box', 'Cylinder', 'Sphere', 'Cone', 'Torus', 'Profile', 'Boss', 'Pocket', 'Hole', 'BlindHole', 'Counterbore', 'Countersink', 'Slot', 'Pattern', 'Chamfer', 'Fillet', 'Material', 'PMI', 'Template', 'SheetMetal', 'FEA', 'inlineSTEP', 'Assembly')+$requiredFeatures = @('Box', 'Cylinder', 'Sphere', 'Cone', 'Torus', 'Profile', 'Sweep', 'Paperclip', 'Boss', 'Pocket', 'Hole', 'BlindHole', 'Counterbore', 'Countersink', 'Slot', 'Pattern', 'Chamfer', 'Fillet', 'Material', 'PMI', 'Template', 'SheetMetal', 'FEA', 'inlineSTEP', 'Assembly')foreach ($feature in $requiredFeatures) {$entry = $coverage.features.$featureif ([string]::IsNullOrWhiteSpace($entry)) { $failures.Add("coverage: missing $feature"); continue }diff --git a/tools/vscode-firmament/README.md b/tools/vscode-firmament/README.mdindex 2f30dfe2..65b860a2 100644--- a/tools/vscode-firmament/README.md+++ b/tools/vscode-firmament/README.md@@ -21,7 +21,7 @@ Structured CLI diagnostics populate VS Code Problems. Validate and build remain## Snippets-Use `model`, `template`, `box`, `cylinder`, `concept-path`, `profile-from-path`, `table-with`, `profile-delta`, `hole-shaft`, `hole-counterbore`, `hole-countersink`, `slot-capsule`, `edgefinish-chamfer`, `edgefinish-fillet`, `require`, `pmi-projection`, `assert-volume`, and `inline-step`. The Template snippet always emits canonical `Template<...>` generic syntax. `profile-delta` is deliberately domain-neutral; the same semantic profile programming applies to ordinary profiles and Sheet Metal owners.+Use `model`, `template`, `box`, `cylinder`, `concept-path`, `profile-from-path`, `sweep-circular`, `table-with`, `profile-delta`, `hole-shaft`, `hole-counterbore`, `hole-countersink`, `slot-capsule`, `edgefinish-chamfer`, `edgefinish-fillet`, `require`, `pmi-projection`, `assert-volume`, and `inline-step`. The Template snippet always emits canonical `Template<...>` generic syntax. `profile-delta` is deliberately domain-neutral; the same semantic profile programming applies to ordinary profiles and Sheet Metal owners. `sweep-circular` emits X0's bounded constant circular section over an existing planar Concept Path.## Preview 3 limitsdiff --git a/tools/vscode-firmament/snippets/firmament.json b/tools/vscode-firmament/snippets/firmament.jsonindex b550dfc5..d110bbc3 100644--- a/tools/vscode-firmament/snippets/firmament.json+++ b/tools/vscode-firmament/snippets/firmament.json@@ -60,6 +60,17 @@"body": ["Profile ${1:Section} From ${2:Outline}"],"description": "Profile derived from a Concept Path"},+ "Circular Sweep": {+ "prefix": "sweep-circular",+ "body": [+ "Sweep ${1:Wire} {",+ " Path: ${2:Centerline}",+ " Diameter: ${3:1mm}",+ " Material: ${4:Standard.Materials.StainlessSteel.304_Annealed}",+ "}"+ ],+ "description": "Bounded constant circular Sweep along a planar Concept Path"+ },"Static Table with Override": {"prefix": "table-with","body": [diff --git a/tools/vscode-firmament/syntaxes/firmament.tmLanguage.json b/tools/vscode-firmament/syntaxes/firmament.tmLanguage.jsonindex e0936a6c..1e0fb25f 100644--- a/tools/vscode-firmament/syntaxes/firmament.tmLanguage.json+++ b/tools/vscode-firmament/syntaxes/firmament.tmLanguage.json@@ -49,7 +49,7 @@},{"name": "keyword.declaration.firmament",- "match": "\\b(?:Model|Units|Use|Enum|Box|Cylinder|Cone|Sphere|Torus|RoundedBox|Frustum|Concept|Struct|Construction|Plane|Path|Profile|ProfileDelta|Compose|Boss|Pocket|Modify|Selection|Record|Static|Table|Template|Pattern|Match|Require|Pmi|Datum|HoleDiameter|Assert|InlineStep|Recognize|Replace|EdgeFinish|Hole|Slot|Region|Segment|Loop|Base|Extrude|SheetMetal|Flange|Analysis|Fixed|Force|Material|Results|Lattice)\\b"+ "match": "\\b(?:Model|Units|Use|Enum|Box|Cylinder|Cone|Sphere|Torus|RoundedBox|Frustum|Concept|Struct|Construction|Plane|Path|Profile|ProfileDelta|Sweep|Compose|Boss|Pocket|Modify|Selection|Record|Static|Table|Template|Pattern|Match|Require|Pmi|Datum|HoleDiameter|Assert|InlineStep|Recognize|Replace|EdgeFinish|Hole|Slot|Region|Segment|Loop|Base|Extrude|SheetMetal|Flange|Analysis|Fixed|Force|Material|Results|Lattice)\\b"},{ "name": "keyword.control.firmament", "match": "\\b(?:with|With|From|Using|On|Over|As|Current|Key)\\b" }]diff --git a/tools/vscode-firmament/tests/grammar.test.ts b/tools/vscode-firmament/tests/grammar.test.tsindex 9914c995..2fec5b55 100644--- a/tools/vscode-firmament/tests/grammar.test.ts+++ b/tools/vscode-firmament/tests/grammar.test.ts@@ -35,6 +35,7 @@ test("critical canonical syntax receives stable TextMate scopes", async () => {Sphere Ball { Radius: 5mm }Analysis LinearElastic Check { Body: Ball }Concept Path Outline On XY { Start: Point2(0mm, 0mm) }+ Sweep Wire { Path: Outline Diameter: 1mm }Profile Face From OutlineStatic Table Standards: ProfileSpec { Width: [20mm, 30mm] }Static Configured = Standards[0] with { Width: 24mm }@@ -67,6 +68,7 @@ test("critical canonical syntax receives stable TextMate scopes", async () => {assert.ok(scopeAt("Boss").includes("keyword.declaration.firmament"));assert.ok(scopeAt("Pocket").includes("keyword.declaration.firmament"));assert.ok(scopeAt("Concept Path").includes("keyword.declaration.compound.firmament"));+ assert.ok(scopeAt("Sweep").includes("keyword.declaration.firmament"));assert.ok(scopeAt("Table").includes("keyword.declaration.firmament"));assert.ok(scopeAt("with").includes("keyword.control.firmament"));assert.ok(scopeAt("ProfileDelta").includes("keyword.declaration.firmament"));