Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Language palette and feature insertion for visual editors (G4); fix web runtime build
Claudeb6d2575977d9
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentLanguagePaletteTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentLanguagePaletteTests.csnew file mode 100644index 00000000..cdd25090--- /dev/null+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentLanguagePaletteTests.cs@@ -0,0 +1,106 @@+using Aetheris.Kernel.Firmament.FirmamentV2;++namespace Aetheris.Kernel.Firmament.Tests;++/// <summary>Every palette item is inserted the way a visual editor inserts it and must build.</summary>+public sealed class FirmamentLanguagePaletteTests+{+ private const string Host = "Model PaletteHost {\n Units: mm\n Box Plate { Size: [60mm, 40mm, 10mm] }\n}\n";++ public static TheoryData<string> Items()+ {+ var data = new TheoryData<string>();+ foreach (var item in FirmamentLanguagePaletteService.Palette().Items) data.Add(item.Id);+ return data;+ }++ [Theory]+ [MemberData(nameof(Items))]+ public void Item_InsertedIntoAHost_Builds(string itemId)+ {+ var item = FirmamentLanguagePaletteService.Palette().Items.Single(i => i.Id == itemId);+ var operation = item.Placement switch+ {+ "model" => new FirmamentLanguageEditOperation("insertDeclaration") { Parent = "PaletteHost", Source = item.Source, Name = item.NameStem + "1" },+ "feature" => new FirmamentLanguageEditOperation("insertFeature") { Node = "PaletteHost/Plate", Source = item.Source, Name = item.NameStem + "1" },+ _ => throw new InvalidOperationException(item.Placement)+ };+ var edit = FirmamentLanguageEditService.Apply(Host, "host.firmament", "1", [operation]);+ Assert.Single(edit.Nodes);+ Assert.EndsWith("/" + item.NameStem + "1", edit.Nodes[0], StringComparison.Ordinal);++ var build = FirmamentBuildAndExport.CompileSource(edit.Text);+ Assert.True(build.IsSuccess, $"{item.Id} did not build:\n{edit.Text}\n{string.Join("\n", build.Diagnostics.Select(d => d.Message))}");+ }++ [Theory]+ [InlineData("hole", "chamfer")]+ [InlineData("counterbore", "fillet")]+ public void FeaturesStackedOnOneBody_Build(string first, string second)+ {+ var items = FirmamentLanguagePaletteService.Palette().Items;+ var operations = new[] { first, second }.Select(id => items.Single(i => i.Id == id))+ .Select(item => new FirmamentLanguageEditOperation("insertFeature") { Node = "PaletteHost/Plate", Source = item.Source, Name = item.NameStem })+ .Select((op, index) => index == 0 ? op : op with { Node = "PaletteHost/Box:Plate" }).ToArray();+ var edit = FirmamentLanguageEditService.Apply(Host, "host.firmament", "1", operations);+ var build = FirmamentBuildAndExport.CompileSource(edit.Text);+ Assert.True(build.IsSuccess, $"{first} + {second} did not build:\n{edit.Text}\n{string.Join("\n", build.Diagnostics.Select(d => d.Message))}");+ }++ /// <summary>Current kernel limit, pinned so it is noticed when it lifts: the combined hole and+ /// edge-finish route admits only shaft or counterbore through holes from the top face.</summary>+ [Fact]+ public void CountersinkWithAnEdgeFinish_IsRefusedByTheCombinedRouteForNow()+ {+ var items = FirmamentLanguagePaletteService.Palette().Items;+ var edit = FirmamentLanguageEditService.Apply(Host, "host.firmament", "1",+ [+ new("insertFeature") { Node = "PaletteHost/Plate", Source = items.Single(i => i.Id == "countersink").Source },+ new("insertFeature") { Node = "PaletteHost/Box:Plate", Source = items.Single(i => i.Id == "chamfer").Source },+ ]);+ var build = FirmamentBuildAndExport.CompileSource(edit.Text);+ Assert.False(build.IsSuccess);+ Assert.Contains(build.Diagnostics, d => d.Message.Contains("CombinedFeaturePlanChainInvalid", StringComparison.Ordinal));+ }++ [Fact]+ public void Items_HaveUniqueIdsAndOneDeclarationNamedByTheirStem()+ {+ var items = FirmamentLanguagePaletteService.Palette().Items;+ Assert.Equal(items.Count, items.Select(i => i.Id).Distinct().Count());+ Assert.All(items, item =>+ {+ Assert.Contains(item.Placement, new[] { "model", "feature" });+ var outline = FirmamentLanguageOutlineService.Outline(item.Source, "item", "1");+ Assert.Equal(item.NameStem, Assert.Single(outline.Nodes).Name);+ });+ }++ [Fact]+ public void InsertFeature_ReusesTheBodysModifyOrOpensOneAfterTheBody()+ {+ var hole = FirmamentLanguagePaletteService.Palette().Items.Single(i => i.Id == "hole");+ var first = FirmamentLanguageEditService.Apply(Host, "h", "1",+ [new("insertFeature") { Node = "PaletteHost/Plate", Source = hole.Source, Name = "A" }]);+ Assert.Equal("Model PaletteHost {\n Units: mm\n Box Plate { Size: [60mm, 40mm, 10mm] }\n Modify Plate {\n "+ + hole.Source.Replace("Hole<Shaft> Hole", "Hole<Shaft> A", StringComparison.Ordinal) + "\n }\n}\n", first.Text);+ Assert.Equal(["PaletteHost/Modify:Plate/A"], first.Nodes);++ var second = FirmamentLanguageEditService.Apply(first.Text, "h", "2",+ [new("insertFeature") { Node = "PaletteHost/Box:Plate", Source = hole.Source, Name = "B" }]);+ Assert.Single(System.Text.RegularExpressions.Regex.Matches(second.Text, "Modify Plate"));+ Assert.Contains("End: ThroughAll }\n Hole<Shaft> B {", second.Text);+ Assert.Equal(["PaletteHost/Modify:Plate/B"], second.Nodes);+ }++ [Fact]+ public void InsertDeclaration_FromMultilineSourceKeepsItsShapeAtTheNewIndent()+ {+ var source = "Box Rib {\n Size: [1mm, 2mm, 3mm]\n}";+ var edit = FirmamentLanguageEditService.Apply(Host, "h", "1",+ [new("insertDeclaration") { Parent = "PaletteHost", Source = source, Name = "Web" }]);+ Assert.Contains(" Box Plate { Size: [60mm, 40mm, 10mm] }\n Box Web {\n Size: [1mm, 2mm, 3mm]\n }\n}\n", edit.Text);+ Assert.Equal("edit-invalid-declaration", Assert.Throws<FirmamentLanguageEditException>(() =>+ FirmamentLanguageEditService.Apply(Host, "h", "1", [new("insertDeclaration") { Parent = "PaletteHost", Source = "Box A {} Box B {}" }])).Code);+ }+}diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageEdit.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageEdit.csindex 1ab6c1f1..66afe4bb 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageEdit.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageEdit.cs@@ -6,7 +6,7 @@ namespace Aetheris.Kernel.Firmament.FirmamentV2;/// <summary>One structural edit, addressed by outline node ids (<see cref="FirmamentLanguageOutlineService"/>)./// <c>Kind</c> is <c>setField</c>, <c>removeField</c>, <c>insertDeclaration</c>, <c>removeDeclaration</c>,-/// <c>renameDeclaration</c> or <c>moveDeclaration</c>.</summary>+/// <c>renameDeclaration</c>, <c>moveDeclaration</c> or <c>insertFeature</c>.</summary>public sealed record FirmamentLanguageEditOperation(string Kind){/// <summary>The declaration edited, removed, renamed or moved.</summary>@@ -22,6 +22,9 @@ public sealed record FirmamentLanguageEditOperation(string Kind)/// <summary>renameDeclaration: the new name.</summary>public string? Name { get; init; }public FirmamentDeclarationSpec? Declaration { get; init; }+ /// <summary>insertDeclaration and insertFeature: one declaration as source text, used instead of+ /// <see cref="Declaration"/>. With <see cref="Name"/> its declared name is replaced.</summary>+ public string? Source { get; init; }}/// <summary>A declaration to write: <c>Modifiers Kind<Variant> Name { Field: Value ... }</c>.</summary>@@ -74,6 +77,7 @@ public static class FirmamentLanguageEditService"removeDeclaration" => RemoveDeclaration(text, before, operation, document, warnings),"renameDeclaration" => RenameDeclaration(text, before, operation, document, warnings),"moveDeclaration" => MoveDeclaration(text, before, operation),+ "insertFeature" => InsertFeature(text, before, operation),_ => throw new FirmamentLanguageEditException("edit-unknown-operation", $"Unknown edit operation '{operation.Kind}'.")};var after = Parse(next);@@ -114,13 +118,14 @@ public static class FirmamentLanguageEditServiceprivate static (string, string?) InsertDeclaration(string text, SyntaxParseResult parse, FirmamentLanguageEditOperation op){- var spec = op.Declaration ?? throw new FirmamentLanguageEditException("edit-input-required", "insertDeclaration requires a declaration.");+ if (op.Declaration is null && op.Source is null)+ throw new FirmamentLanguageEditException("edit-input-required", "insertDeclaration requires a declaration or its source.");var declarations = FirmamentLanguageOutlineService.Declarations(parse);DeclarationSyntax? parent = null;if (op.Parent is not null) parent = Find(parse, op.Parent).Syntax;var siblings = Siblings(declarations, op.Parent);var indent = parent is null ? "" : ChildIndent(text, parent);- var snippet = Write(spec, indent, Unit(text));+ var snippet = op.Declaration is { } spec ? Write(spec, indent, Unit(text)) : FromSource(op.Source!, op.Name, indent);CheckSnippet(snippet);var anchor = Anchor(declarations, siblings, op);int at;@@ -142,6 +147,26 @@ public static class FirmamentLanguageEditServicereturn (next, created.Id);}+ /// <summary>A feature goes into the <c>Modify</c> of its body: the last one already written for+ /// that body among its siblings, or a new one placed right after the body.</summary>+ private static (string, string?) InsertFeature(string text, SyntaxParseResult parse, FirmamentLanguageEditOperation op)+ {+ var (id, body) = Find(parse, op.Node);+ if (op.Source is null) throw new FirmamentLanguageEditException("edit-input-required", "insertFeature requires the feature source.");+ if (body.Name is not { } bodyName || FirmamentLanguageOutlineService.NameIsUse(body))+ throw new FirmamentLanguageEditException("edit-not-a-body", $"{id} is not a named body that a feature can modify.");+ var declarations = FirmamentLanguageOutlineService.Declarations(parse);+ var parentId = declarations.First(d => d.Id == id).ParentId;+ var modify = Siblings(declarations, parentId)+ .LastOrDefault(s => s.Syntax.Type.Name.Text is "Modify" or "modify" && s.Syntax.Name?.Text == bodyName.Text);+ if (modify.Syntax is not null)+ return InsertDeclaration(text, parse, new("insertDeclaration") { Parent = modify.Id, Source = op.Source, Name = op.Name });+ var (opened, modifyId) = InsertDeclaration(text, parse,+ new("insertDeclaration") { Parent = parentId, After = id, Source = $"Modify {bodyName.Text} {{\n}}" });+ if (modifyId is null) throw new FirmamentLanguageEditException("edit-unparseable", $"A Modify for {bodyName.Text} could not be opened.");+ return InsertDeclaration(opened, Parse(opened), new("insertDeclaration") { Parent = modifyId, Source = op.Source, Name = op.Name });+ }+private static (string, string?) RemoveDeclaration(string text, SyntaxParseResult parse, FirmamentLanguageEditOperation op,string document, List<string> warnings){@@ -417,6 +442,30 @@ public static class FirmamentLanguageEditServicereturn indent + head + " {\n" + string.Join("\n", fields.Select(f => indent + unit + f)) + "\n" + indent + "}";}+ /// <summary>Declaration source placed at <paramref name="indent"/>, its own relative indentation+ /// kept, its declared name replaced when <paramref name="name"/> is given.</summary>+ private static string FromSource(string source, string? name, string indent)+ {+ var text = source.Replace("\r\n", "\n").Trim();+ var parse = Parse(text);+ if (!parse.IsSuccess || parse.Document.Statements.Count != 1 || parse.Document.Statements[0] is not DeclarationSyntax declaration)+ throw new FirmamentLanguageEditException("edit-invalid-declaration",+ $"The declaration does not parse on its own: {Errors(parse).FirstOrDefault() ?? "expected one declaration"}");+ if (name is not null)+ {+ RequireIdentifier(name, "name");+ if (declaration.Name is not { } declared)+ throw new FirmamentLanguageEditException("edit-unnamed", "The declaration has no name to replace.");+ text = Replace(text, declared.Span.Start, declared.Span.Length, name);+ }+ var lines = text.Split('\n');+ var common = lines.Skip(1).Where(l => l.Trim().Length > 0).Select(l => l.Length - l.TrimStart().Length).DefaultIfEmpty(0).Min();+ // The closing brace sits at the first line's level: keep the rest relative to it.+ var closing = lines.Length > 1 ? lines[^1].Length - lines[^1].TrimStart().Length : 0;+ var strip = Math.Min(common, closing);+ return string.Join("\n", lines.Select((l, i) => i == 0 ? indent + l : l.Trim().Length == 0 ? "" : indent + l[Math.Min(strip, l.Length - l.TrimStart().Length)..]));+ }+private static void CheckSnippet(string snippet){var parse = Parse(snippet);diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguagePalette.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguagePalette.csnew file mode 100644index 00000000..ce40ddfe--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguagePalette.cs@@ -0,0 +1,47 @@+namespace Aetheris.Kernel.Firmament.FirmamentV2;++/// <summary>One thing a visual editor can add. <c>Placement</c> is <c>model</c> (a body in a Model or+/// Struct, inserted with <c>insertDeclaration</c>) or <c>feature</c> (inside the Modify of a body,+/// inserted with <c>insertFeature</c>). <c>Source</c> is one declaration named <c>NameStem</c>; editors+/// pass a unique name with the insert.</summary>+public sealed record FirmamentPaletteItem(string Id, string Label, string Category, string Description,+ string Placement, string NameStem, string Source);++public sealed record FirmamentLanguagePalette(string Version, IReadOnlyList<FirmamentPaletteItem> Items);++/// <summary>+/// The constructs a visual editor offers to add, with starting values. This is a curated catalog,+/// not the schema: every item builds as written (Box host for features), which+/// FirmamentLanguagePaletteTests proves through the same build path the editor uses.+/// Add an item only with that proof.+/// </summary>+public static class FirmamentLanguagePaletteService+{+ public const string Version = "firmament-palette/1";++ private static readonly FirmamentPaletteItem[] Catalog =+ [+ new("box", "Box", "Bodies", "A rectangular block, centered on the origin.", "model", "Block",+ "Box Block { Size: [40mm, 30mm, 10mm] }"),+ new("cylinder", "Cylinder", "Bodies", "A round bar standing on the XY plane.", "model", "Bar",+ "Cylinder Bar { Radius: 10mm Height: 20mm }"),++ new("hole", "Hole", "Holes", "A drilled through hole from the top face.", "feature", "Hole",+ "Hole<Shaft> Hole { On: +Z Center: Point2(0mm, 0mm) Diameter: 6mm End: ThroughAll }"),+ new("hole-blind", "Blind hole", "Holes", "A drilled hole to a depth.", "feature", "BlindHole",+ "Hole<Shaft> BlindHole { On: +Z Center: Point2(0mm, 0mm) Diameter: 6mm End: Blind 5mm }"),+ new("counterbore", "Counterbored hole", "Holes", "A through hole with a flat-bottomed recess for a cap screw head.", "feature", "Counterbore",+ "Hole<Counterbore> Counterbore { On: +Z Center: Point2(0mm, 0mm) Diameter: 4mm CounterboreDiameter: 7mm CounterboreDepth: 3mm End: ThroughAll }"),+ new("countersink", "Countersunk hole", "Holes", "A through hole with a conical recess for a flat-head screw.", "feature", "Countersink",+ "Hole<Countersink> Countersink { On: +Z Center: Point2(0mm, 0mm) Diameter: 6mm CountersinkDiameter: 12mm CountersinkAngle: 90deg End: ThroughAll }"),+ new("perforation", "Perforation", "Holes", "A field of round vents across the top face.", "feature", "Vents",+ "Perforation Vents { On: +Z Diameter: 6mm Layout: Hex Pitch: 9mm Margin: 8mm }"),++ new("chamfer", "Chamfer top edges", "Edges", "Breaks the edges around the top face with a 45° chamfer.", "feature", "TopChamfer",+ "EdgeFinish TopChamfer { Face: +Z Target: Boundary Kind: Chamfer Distance: 1mm }"),+ new("fillet", "Round top edges", "Edges", "Rounds the edges around the top face.", "feature", "TopRound",+ "EdgeFinish TopRound { Face: +Z Target: Boundary Kind: Fillet Radius: 1mm }"),+ ];++ public static FirmamentLanguagePalette Palette() => new(Version, Catalog);+}diff --git a/Aetheris.Web.Runtime/Program.cs b/Aetheris.Web.Runtime/Program.csindex 3f5db654..5df40a5b 100644--- a/Aetheris.Web.Runtime/Program.cs+++ b/Aetheris.Web.Runtime/Program.cs@@ -58,6 +58,7 @@ public static partial class Program"languageAnalyze" => LanguageAnalyze(request),"languageOutline" => LanguageOutline(request),"languageEdit" => LanguageEdit(request),+ "languagePalette" => FirmamentLanguagePaletteService.Palette(),"languageHover" => LanguageHover(request),"languageDefinition" => LanguageDefinition(request),"languageFormat" => LanguageFormat(request),@@ -270,7 +271,8 @@ public static partial class Programstring? SourceRevision = null, int? Offset = null, string? ConstructSemanticId = null,string? FieldId = null, FirmamentProjectedValue? FieldValue = null, int? BuildRevision = null,bool Performance = false, IReadOnlyDictionary<string, string>? ProjectDocuments = null, string? ProjectRoot = null,- int? Bridge = null, IReadOnlyList<FirmamentLanguageEditOperation>? Operations = null);+ int? Bridge = null, string? Motion = null, double? TimeSeconds = null, bool PreserveEndpoint = false,+ IReadOnlyList<FirmamentLanguageEditOperation>? Operations = null);/// <summary>/// BUILD-PERF-M3 response bridge (request <c>bridge: 1</c>, sent by the SDK). Large numeric arraysdiff --git a/Aetheris.Web.Runtime/sdk/README.md b/Aetheris.Web.Runtime/sdk/README.mdindex e779c8d0..0a01c0db 100644--- a/Aetheris.Web.Runtime/sdk/README.md+++ b/Aetheris.Web.Runtime/sdk/README.md@@ -75,9 +75,17 @@ or `first`), `removeDeclaration` (warns about uses that stop resolving),files are not renamed) and `moveDeclaration` (among its siblings). Each edit isa splice placed by the syntax tree, so comments and layout elsewhere are kept,and an edit whose result adds a syntax error is refused with an-`edit-*` error code. Whether the edited model builds is still the compiler's+`edit-*` error code. `insertDeclaration` also takes a declaration as `source`+text, with `name` replacing its declared name; `insertFeature` (`node`, `source`,+`name`) puts a feature in the body's `Modify`, opening one after the body when+there is none. Whether the edited model builds is still the compiler'sdecision.+`cad.language.palette()` lists what a visual editor can add+(`firmament-palette/1`): bodies (`placement: 'model'`) and features on a body+(`placement: 'feature'`), each a declaration `source` with starting values.+Every item is proven to build by the kernel's tests.+Production AOT preserves the semantic provenance record metadata used by thereflection JSON bridge. Package generation clears its owned AOT publish outputbefore publishing, so obsolete fingerprints are not included in the tarball.diff --git a/Aetheris.Web.Runtime/sdk/src/index.d.ts b/Aetheris.Web.Runtime/sdk/src/index.d.tsindex 48fbb367..64c9caec 100644--- a/Aetheris.Web.Runtime/sdk/src/index.d.ts+++ b/Aetheris.Web.Runtime/sdk/src/index.d.ts@@ -46,12 +46,16 @@ export interface DeclarationSpec { readonly kind: string; readonly variant?: strexport type LanguageEditOperation =| { readonly kind: 'setField'; readonly node: string; readonly field: string; readonly value: string }| { readonly kind: 'removeField'; readonly node: string; readonly field: string }- | { readonly kind: 'insertDeclaration'; readonly parent: string | null; readonly declaration: DeclarationSpec; readonly after?: string; readonly first?: boolean }+ | { readonly kind: 'insertDeclaration'; readonly parent: string | null; readonly declaration?: DeclarationSpec; readonly source?: string; readonly name?: string; readonly after?: string; readonly first?: boolean }| { readonly kind: 'removeDeclaration'; readonly node: string }| { readonly kind: 'renameDeclaration'; readonly node: string; readonly name: string }- | { readonly kind: 'moveDeclaration'; readonly node: string; readonly after?: string; readonly first?: boolean };+ | { readonly kind: 'moveDeclaration'; readonly node: string; readonly after?: string; readonly first?: boolean }+ | { readonly kind: 'insertFeature'; readonly node: string; readonly source: string; readonly name?: string };/** The edited source and the single replacement `[start, start + length)` → `replacement` that produces it from the original. `nodes` holds the outline id each operation left behind (created, renamed or edited), in order; removals add none. */export interface LanguageEdit { readonly document: string; readonly revision: string; readonly text: string; readonly changed: boolean; readonly edit: { readonly start: number; readonly length: number; readonly replacement: string }; readonly nodes: readonly string[]; readonly warnings: readonly string[] }+/** Something a visual editor can add. `placement` `model` inserts with `insertDeclaration`; `feature` with `insertFeature` on a body. `source` declares `nameStem`; pass a unique `name` with the insert. Every item is proven to build. */+export interface PaletteItem { readonly id: string; readonly label: string; readonly category: string; readonly description: string; readonly placement: 'model' | 'feature'; readonly nameStem: string; readonly source: string }+export interface LanguagePalette { readonly version: 'firmament-palette/1'; readonly items: readonly PaletteItem[] }export interface LanguageHover { readonly document: string; readonly revision: string; readonly start: number; readonly length: number; readonly title: string; readonly description: string }export interface LanguageFormat { readonly document: string; readonly revision: string; readonly text: string; readonly changed: boolean }export interface SemanticFieldSchema { readonly id: string; readonly name: string; readonly kind: string; readonly unit: 'None' | 'Length' | 'Angle'; readonly required: boolean; readonly default: string | null; readonly choices: readonly string[]; readonly description: string | null; readonly sourceEditable: boolean }@@ -69,7 +73,7 @@ export class Aetheris {static create(options?: AetherisOptions): Promise<Aetheris>;readonly runtimeInfo: RuntimeInfo;readonly workerTiming: WorkerTiming | null;- readonly language: { complete(source: string, offset: number, options: LanguageOptions): Promise<LanguageCompletion>; analyze(source: string, options: LanguageOptions): Promise<LanguageAnalysis>; outline(source: string, options: LanguageOptions): Promise<LanguageOutline>; edit(source: string, operations: readonly LanguageEditOperation[], options: LanguageOptions): Promise<LanguageEdit>; hover(source: string, offset: number, options: LanguageOptions): Promise<LanguageHover | null>; definition(source: string, offset: number, options: LanguageOptions): Promise<SourceReference | null>; format(source: string, options: LanguageOptions): Promise<LanguageFormat>; schema(): Promise<SemanticSchema> };+ readonly language: { complete(source: string, offset: number, options: LanguageOptions): Promise<LanguageCompletion>; analyze(source: string, options: LanguageOptions): Promise<LanguageAnalysis>; outline(source: string, options: LanguageOptions): Promise<LanguageOutline>; edit(source: string, operations: readonly LanguageEditOperation[], options: LanguageOptions): Promise<LanguageEdit>; palette(): Promise<LanguagePalette>; hover(source: string, offset: number, options: LanguageOptions): Promise<LanguageHover | null>; definition(source: string, offset: number, options: LanguageOptions): Promise<SourceReference | null>; format(source: string, options: LanguageOptions): Promise<LanguageFormat>; schema(): Promise<SemanticSchema> };info(): Promise<RuntimeInfo>;capabilities(): Promise<RuntimeCapabilities>;compile(source: string, options?: CompileOptions): Promise<{ model: ModelSession | null; diagnostics: readonly Diagnostic[] }>;diff --git a/Aetheris.Web.Runtime/sdk/src/index.js b/Aetheris.Web.Runtime/sdk/src/index.jsindex d5996cd3..1b8b2047 100644--- a/Aetheris.Web.Runtime/sdk/src/index.js+++ b/Aetheris.Web.Runtime/sdk/src/index.js@@ -88,6 +88,7 @@ export class Aetheris {sourceName: options.sourceName, sourceRevision: options.sourceRevision, projectDocuments: options.projectDocuments, projectRoot: options.projectRoot }),outline: (source, options = {}) => this.transport.request({ operation: 'languageOutline', source,sourceName: options.sourceName, sourceRevision: options.sourceRevision, projectDocuments: options.projectDocuments, projectRoot: options.projectRoot }),+ palette: () => this.transport.request({ operation: 'languagePalette' }),edit: (source, operations, options = {}) => this.transport.request({ operation: 'languageEdit', source, operations,sourceName: options.sourceName, sourceRevision: options.sourceRevision }),hover: (source, offset, options = {}) => this.transport.request({ operation: 'languageHover', source, offset,diff --git a/Aetheris.Web.Runtime/sdk/tests/language.test.mjs b/Aetheris.Web.Runtime/sdk/tests/language.test.mjsindex b108f1c3..88f2fb4a 100644--- a/Aetheris.Web.Runtime/sdk/tests/language.test.mjs+++ b/Aetheris.Web.Runtime/sdk/tests/language.test.mjs@@ -55,3 +55,10 @@ test('public language edit sends operations with the source revision through runassert.deepEqual(edit.nodes, ['M']);assert.deepEqual(requests, [{ operation: 'languageEdit', source: 'Model M { Units: mm }', operations, sourceName: 'm.firmament', sourceRevision: 'r3' }]);});++test('public language palette asks the runtime for the catalog', async () => {+ const requests = [];+ const cad = new Aetheris({ request: async request => { requests.push(request); return { version: 'firmament-palette/1', items: [] }; } });+ assert.equal((await cad.language.palette()).version, 'firmament-palette/1');+ assert.deepEqual(requests, [{ operation: 'languagePalette' }]);+});