Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Remove obsolete rendering and shader assets
Yuechen Lif32b49c851f2
diff --git a/Aetheris.Cadmata.Desktop/Aetheris.Cadmata.Desktop.csproj b/Aetheris.Cadmata.Desktop/Aetheris.Cadmata.Desktop.csprojnew file mode 100644index 00000000..e8e6164a--- /dev/null+++ b/Aetheris.Cadmata.Desktop/Aetheris.Cadmata.Desktop.csproj@@ -0,0 +1,21 @@+<Project Sdk="Microsoft.NET.Sdk">+ <PropertyGroup>+ <OutputType>WinExe</OutputType>+ <TargetFramework>net10.0-windows</TargetFramework>+ <EnableWindowsTargeting>true</EnableWindowsTargeting>+ <UseWindowsForms>true</UseWindowsForms>+ <AssemblyName>Cadmata.Desktop</AssemblyName>+ <Product>Cadmata — Aetheris Preview 4</Product>+ <Description>Portable Windows host for Cadmata</Description>+ <PublishTrimmed>false</PublishTrimmed>+ </PropertyGroup>+ <ItemGroup>+ <ProjectReference Include="..\Aetheris.Server\Aetheris.Server.csproj" />+ <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.4258.31" />+ </ItemGroup>+ <Target Name="RemoveUnusedWebViewWpfReference" BeforeTargets="ResolveAssemblyReferences">+ <ItemGroup>+ <Reference Remove="@(Reference)" Condition="'%(Reference.Filename)' == 'Microsoft.Web.WebView2.Wpf'" />+ </ItemGroup>+ </Target>+</Project>diff --git a/Aetheris.Cadmata.Desktop/DiagnosticLog.cs b/Aetheris.Cadmata.Desktop/DiagnosticLog.csnew file mode 100644index 00000000..11a8326d--- /dev/null+++ b/Aetheris.Cadmata.Desktop/DiagnosticLog.cs@@ -0,0 +1,50 @@+using Microsoft.Extensions.Logging;++namespace Aetheris.Cadmata.Desktop;++internal sealed class DiagnosticLog : IDisposable+{+ private readonly StreamWriter _writer;+ private readonly object _gate = new();+ internal string DataRoot { get; } = System.IO.Path.Combine(+ Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Aetheris", "Cadmata");+ internal string Path { get; }++ internal DiagnosticLog()+ {+ var logs = System.IO.Path.Combine(DataRoot, "logs");+ Directory.CreateDirectory(logs);+ Path = System.IO.Path.Combine(logs, $"cadmata-{DateTime.UtcNow:yyyyMMdd-HHmmss}-{Environment.ProcessId}.log");+ _writer = new StreamWriter(Path) { AutoFlush = true };+ // Keep diagnostic history bounded without touching active instances.+ foreach (var old in new DirectoryInfo(logs).GetFiles("*.log").OrderByDescending(f => f.LastWriteTimeUtc).Skip(20))+ try { old.Delete(); } catch (IOException) { } catch (UnauthorizedAccessException) { }+ var sessions = System.IO.Path.Combine(DataRoot, "sessions");+ if (Directory.Exists(sessions))+ foreach (var old in new DirectoryInfo(sessions).GetDirectories().Where(d => d.LastWriteTimeUtc < DateTime.UtcNow.AddDays(-1)))+ try { old.Delete(true); } catch (IOException) { } catch (UnauthorizedAccessException) { }+ }++ internal void Write(string message)+ {+ lock (_gate) _writer.WriteLine($"{DateTime.UtcNow:O} {message}");+ }+ internal ILoggerProvider Provider => new ProviderAdapter(this);+ public void Dispose() { lock (_gate) _writer.Dispose(); }++ private sealed class ProviderAdapter(DiagnosticLog owner) : ILoggerProvider+ {+ public ILogger CreateLogger(string categoryName) => new FileLogger(owner, categoryName);+ public void Dispose() { } // The desktop lifetime owns the writer.+ }++ private sealed class FileLogger(DiagnosticLog owner, string category) : ILogger+ {+ public IDisposable? BeginScope<TState>(TState state) where TState : notnull => null;+ public bool IsEnabled(LogLevel level) => level >= LogLevel.Warning;+ public void Log<TState>(LogLevel level, EventId id, TState state, Exception? exception, Func<TState, Exception?, string> formatter)+ {+ if (IsEnabled(level)) owner.Write($"{level} {category} {formatter(state, exception)} {exception}");+ }+ }+}diff --git a/Aetheris.Cadmata.Desktop/Program.cs b/Aetheris.Cadmata.Desktop/Program.csnew file mode 100644index 00000000..07a06bf3--- /dev/null+++ b/Aetheris.Cadmata.Desktop/Program.cs@@ -0,0 +1,186 @@+using System.Diagnostics;+using System.Reflection;+using System.Security.Cryptography;+using Aetheris.Server.Startup;+using Microsoft.AspNetCore.Hosting.Server;+using Microsoft.AspNetCore.Hosting.Server.Features;+using Microsoft.Extensions.DependencyInjection;+using Microsoft.Web.WebView2.Core;+using Microsoft.Web.WebView2.WinForms;++namespace Aetheris.Cadmata.Desktop;++internal static class Program+{+ [STAThread]+ private static int Main(string[] args)+ {+ ApplicationConfiguration.Initialize();+ using var log = new DiagnosticLog();+ try+ {+ log.Write("startup " + BuildIdentity + " root=" + AppContext.BaseDirectory);+ using var window = new CadmataWindow(args, log);+ Application.ThreadException += (_, e) => window.ShowFailure(e.Exception);+ AppDomain.CurrentDomain.UnhandledException += (_, e) => log.Write("fatal " + e.ExceptionObject);+ Application.Run(window);+ return 0;+ }+ catch (Exception exception)+ {+ log.Write("fatal " + exception);+ MessageBox.Show($"Cadmata could not start.\n\n{exception.Message}\n\nDiagnostic log: {log.Path}",+ "Cadmata", MessageBoxButtons.OK, MessageBoxIcon.Error);+ return 2;+ }+ }++ internal static string BuildIdentity => typeof(Program).Assembly+ .GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Preview 4";+}++internal sealed class CadmataWindow : Form+{+ private readonly WebView2 _view = new() { Dock = DockStyle.Fill };+ private readonly Label _status = new() { Dock = DockStyle.Fill, Text = "Starting Cadmata…", TextAlign = ContentAlignment.MiddleCenter };+ private readonly DiagnosticLog _log;+ private readonly CancellationTokenSource _lifetime = new();+ private Microsoft.AspNetCore.Builder.WebApplication? _server;+ private readonly string _profile;+ private readonly string[] _args;+ private bool _closing;+ private bool _shutdownComplete;++ internal CadmataWindow(string[] args, DiagnosticLog log)+ {+ _args = args;+ _log = log;+ _profile = System.IO.Path.Combine(log.DataRoot, "sessions", Guid.NewGuid().ToString("N"));+ Text = "Cadmata — Aetheris Preview 4";+ Width = 1440; Height = 960; MinimumSize = new Size(900, 600);+ Controls.Add(_view); Controls.Add(_status);+ var menu = new MenuStrip();+ menu.Items.Add("About Cadmata", null, (_, _) => MessageBox.Show(+ $"Cadmata — Aetheris Preview 4\n{Program.BuildIdentity}\n\nLogs: {_log.Path}\nSource: https://github.com/yuechen-li-dev/Aetheris",+ "About Cadmata"));+ menu.Items.Add("Open diagnostic log", null, (_, _) => Process.Start(new ProcessStartInfo(_log.Path) { UseShellExecute = true }));+ Controls.Add(menu); MainMenuStrip = menu;+ Shown += async (_, _) => await InitializeAsync();+ }++ private async Task InitializeAsync()+ {+ try+ {+ var runtime = System.IO.Path.Combine(AppContext.BaseDirectory, "webview2");+ if (!File.Exists(System.IO.Path.Combine(runtime, "msedgewebview2.exe")))+ throw new FileNotFoundException("Bundled WebView2 runtime is missing. Extract the complete Cadmata ZIP again.");+ var options = CadmataLaunchOptions.Parse(_args.Length == 0+ ? [System.IO.Path.Combine(AppContext.BaseDirectory, "samples", "mounting-block.firmament")]+ : _args);+ options.ValidateProductionAssets(AppContext.BaseDirectory);+ var token = Convert.ToHexString(RandomNumberGenerator.GetBytes(32));+ _server = CadmataApplication.Create([], options, portable: true, logging: _log.Provider, sessionToken: token);+ using var startup = CancellationTokenSource.CreateLinkedTokenSource(_lifetime.Token);+ startup.CancelAfter(TimeSpan.FromSeconds(45));+ await _server.StartAsync(startup.Token);+ var address = _server.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>()!+ .Addresses.Single();+ _log.Write("backend ready " + address);+ _server.Lifetime.ApplicationStopped.Register(() =>+ {+ if (!_lifetime.IsCancellationRequested && !IsDisposed)+ BeginInvoke(() => ShowFailure(new InvalidOperationException("The local CAD service stopped unexpectedly. Reopen Cadmata.")));+ });+ Directory.CreateDirectory(_profile);+ var environment = await CoreWebView2Environment.CreateAsync(runtime, _profile);+ await _view.EnsureCoreWebView2Async(environment).WaitAsync(startup.Token);+ if (_lifetime.IsCancellationRequested) return;+ _view.CoreWebView2.Settings.AreDevToolsEnabled = false;+ _view.CoreWebView2.Settings.IsStatusBarEnabled = false;+ _view.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;+ _view.CoreWebView2.NewWindowRequested += (_, e) => e.Handled = true;+ _view.CoreWebView2.WindowCloseRequested += (_, _) => Close();+ _view.CoreWebView2.NavigationStarting += (_, e) =>+ {+ if (!Uri.TryCreate(e.Uri, UriKind.Absolute, out var uri) || uri.GetLeftPart(UriPartial.Authority) != address.TrimEnd('/'))+ e.Cancel = true;+ };+ _view.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All);+ _view.CoreWebView2.WebResourceRequested += (_, e) =>+ {+ if (Uri.TryCreate(e.Request.Uri, UriKind.Absolute, out var uri)+ && uri.Scheme is "http" or "https" && uri.GetLeftPart(UriPartial.Authority) != address.TrimEnd('/'))+ e.Response = environment.CreateWebResourceResponse(null, 403, "Offline local application", "");+ };+ _view.CoreWebView2.WebMessageReceived += (_, e) =>+ {+ if (e.Source.StartsWith(address + "/", StringComparison.Ordinal))+ _log.Write("frontend " + e.WebMessageAsJson);+ };+ _view.CoreWebView2.ProcessFailed += (_, e) => ShowFailure(new InvalidOperationException($"WebView2 process failed: {e.ProcessFailedKind}. Reopen Cadmata."));+ _view.CoreWebView2.DownloadStarting += (_, e) =>+ {+ _log.Write("export download " + e.ResultFilePath);+ e.DownloadOperation.StateChanged += (_, _) =>+ _log.Write("export " + e.DownloadOperation.State + " " + e.DownloadOperation.InterruptReason);+ };+ _view.CoreWebView2.NavigationCompleted += (_, e) =>+ {+ if (e.IsSuccess) { _status.Visible = false; _log.Write("UI visible"); }+ else ShowFailure(new InvalidOperationException("The local page could not load: " + e.WebErrorStatus));+ };+ _view.CoreWebView2.Navigate(address + "/__cadmata/session/" + token);+ }+ catch (OperationCanceledException) when (_lifetime.IsCancellationRequested) { }+ catch (Exception exception) { if (!IsDisposed) ShowFailure(exception); }+ }++ internal void ShowFailure(Exception exception)+ {+ _log.Write("failure " + exception);+ _status.Text = $"Cadmata could not continue.\n\n{exception.Message}\n\nLog: {_log.Path}\nClose and reopen Cadmata after correcting the problem.";+ _status.Visible = true; _status.BringToFront();+ }++ protected override async void OnFormClosing(FormClosingEventArgs e)+ {+ base.OnFormClosing(e);+ if (e.Cancel || _shutdownComplete) return;+ e.Cancel = true;+ if (_closing) return;+ _closing = true;+ _log.Write("closing");+ _status.Text = "Closing Cadmata…";+ _status.Visible = true;+ _status.BringToFront();+ _lifetime.Cancel();+ _view.Dispose();+ _log.Write("browser controller closed");+ if (_server is not null)+ {+ try+ {+ using var shutdown = new CancellationTokenSource(TimeSpan.FromSeconds(5));+ await _server.StopAsync(shutdown.Token);+ await _server.DisposeAsync();+ _log.Write("backend stopped");+ }+ catch (Exception exception) { _log.Write("shutdown " + exception); }+ }+ _shutdownComplete = true;+ Close();+ }++ protected override void OnFormClosed(FormClosedEventArgs e)+ {+ // The browser may release profile locks a moment after its controller.+ // Deletion is bounded; a stale session is cleaned on the next launch.+ try { Directory.Delete(_profile, true); }+ catch (IOException) { _log.Write("profile cleanup deferred " + _profile); }+ catch (UnauthorizedAccessException) { _log.Write("profile cleanup deferred " + _profile); }+ _log.Write("closed");+ _lifetime.Dispose();+ base.OnFormClosed(e);+ }+}diff --git a/Aetheris.Cadmata.Desktop/licenses/draco3d-LICENSE.txt b/Aetheris.Cadmata.Desktop/licenses/draco3d-LICENSE.txtnew file mode 100644index 00000000..30109545--- /dev/null+++ b/Aetheris.Cadmata.Desktop/licenses/draco3d-LICENSE.txt@@ -0,0 +1,252 @@+ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.++--------------------------------------------------------------------------------+Files: docs/assets/js/ASCIIMathML.js++Copyright (c) 2014 Peter Jipsen and other ASCIIMathML.js contributors++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in+all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+THE SOFTWARE.++--------------------------------------------------------------------------------+Files: docs/assets/css/pygments/*++This is free and unencumbered software released into the public domain.++Anyone is free to copy, modify, publish, use, compile, sell, or+distribute this software, either in source code form or as a compiled+binary, for any purpose, commercial or non-commercial, and by any+means.++In jurisdictions that recognize copyright laws, the author or authors+of this software dedicate any and all copyright interest in the+software to the public domain. We make this dedication for the benefit+of the public at large and to the detriment of our heirs and+successors. We intend this dedication to be an overt act of+relinquishment in perpetuity of all present and future rights to this+software under copyright law.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR+OTHER DEALINGS IN THE SOFTWARE.++For more information, please refer to <http://unlicense.org>diff --git a/Aetheris.Cadmata.Desktop/licenses/react-three-fiber-LICENSE.txt b/Aetheris.Cadmata.Desktop/licenses/react-three-fiber-LICENSE.txtnew file mode 100644index 00000000..493cfb3c--- /dev/null+++ b/Aetheris.Cadmata.Desktop/licenses/react-three-fiber-LICENSE.txt@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2019-2025 Poimandres++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/Aetheris.Cadmata.Desktop/licenses/sqlitepclraw-LICENSE.txt b/Aetheris.Cadmata.Desktop/licenses/sqlitepclraw-LICENSE.txtnew file mode 100644index 00000000..d6456956--- /dev/null+++ b/Aetheris.Cadmata.Desktop/licenses/sqlitepclraw-LICENSE.txt@@ -0,0 +1,202 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.diff --git a/Aetheris.Cadmata.Desktop/licenses/supplemental-sources.json b/Aetheris.Cadmata.Desktop/licenses/supplemental-sources.jsonnew file mode 100644index 00000000..19464a0a--- /dev/null+++ b/Aetheris.Cadmata.Desktop/licenses/supplemental-sources.json@@ -0,0 +1,26 @@+[+ {+ "sha256": "d3709b0fb4b8a94bbb1d02b8a2e484f258b0d9c5c5a01f940391f3fe662cd1a4",+ "identity": "[email protected]",+ "file": "draco3d-LICENSE.txt",+ "url": "https://raw.githubusercontent.com/google/draco/8786740086a9f4d83f44aa83badfbea4dce7a1b5/LICENSE"+ },+ {+ "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30",+ "identity": "SQLitePCLRaw.bundle_e_sqlite3/3.0.5",+ "file": "sqlitepclraw-LICENSE.txt",+ "url": "https://raw.githubusercontent.com/ericsink/SQLitePCL.raw/96043b8cff323f21919df86a431c136655d81b4a/LICENSE.TXT"+ },+ {+ "sha256": "c87a9ab2520595bc7c31343b5250e8f3779a65c6051612118b0accd200f24d07",+ "identity": "Swashbuckle.AspNetCore/6.6.2",+ "file": "swashbuckle-LICENSE.txt",+ "url": "https://raw.githubusercontent.com/domaindrivendev/Swashbuckle.AspNetCore/fe87e6d4ce56cda59474763067b929d4d92fd146/LICENSE"+ },+ {+ "identity": "@react-three/[email protected]",+ "file": "react-three-fiber-LICENSE.txt",+ "url": "https://raw.githubusercontent.com/pmndrs/react-three-fiber/v9.7.0/LICENSE",+ "sha256": "9c35b5de7b7493a707fffe4eb23bd2f7f449153c1911f7c6eefb4e591fd5349a"+ }+]diff --git a/Aetheris.Cadmata.Desktop/licenses/swashbuckle-LICENSE.txt b/Aetheris.Cadmata.Desktop/licenses/swashbuckle-LICENSE.txtnew file mode 100644index 00000000..4f3e7c85--- /dev/null+++ b/Aetheris.Cadmata.Desktop/licenses/swashbuckle-LICENSE.txt@@ -0,0 +1,21 @@+The MIT License (MIT)++Copyright (c) 2016 Richard Morris++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/Aetheris.Server.Tests/CadmataStartupTests.cs b/Aetheris.Server.Tests/CadmataStartupTests.csindex 2d830a49..be6ae801 100644--- a/Aetheris.Server.Tests/CadmataStartupTests.cs+++ b/Aetheris.Server.Tests/CadmataStartupTests.cs@@ -11,6 +11,28 @@ namespace Aetheris.Server.Tests;public sealed class CadmataStartupTests{+ [Fact]+ public async Task PortableHost_BindsLoopbackEphemeralPortAndRequiresSessionCookie()+ {+ await using var app = CadmataApplication.Create([], new(null, true, false), portable: true, sessionToken: "test-secret");+ await app.StartAsync();+ try+ {+ var address = app.Urls.Single();+ Assert.StartsWith("http://127.0.0.1:", address);+ Assert.DoesNotContain(":0", address);+ using var handler = new HttpClientHandler { AllowAutoRedirect = false };+ using var client = new HttpClient(handler) { BaseAddress = new Uri(address) };+ Assert.Equal(HttpStatusCode.Forbidden, (await client.PostAsync("/api/v1/startup/step", null)).StatusCode);+ Assert.Equal(HttpStatusCode.Forbidden, (await client.GetAsync("/__cadmata/session/wrong")).StatusCode);+ var bootstrap = await client.GetAsync("/__cadmata/session/test-secret");+ Assert.Equal(HttpStatusCode.Redirect, bootstrap.StatusCode);+ Assert.Contains("httponly", bootstrap.Headers.GetValues("Set-Cookie").Single(), StringComparison.OrdinalIgnoreCase);+ Assert.Equal(HttpStatusCode.NoContent, (await client.PostAsync("/api/v1/startup/step", null)).StatusCode);+ }+ finally { await app.StopAsync(); }+ }+[Fact]public void Parse_NormalizesRelativeUnicodePathWithSpaces(){diff --git a/Aetheris.Server/Aetheris.Server.csproj b/Aetheris.Server/Aetheris.Server.csprojindex bbccc1aa..f0e17857 100644--- a/Aetheris.Server/Aetheris.Server.csproj+++ b/Aetheris.Server/Aetheris.Server.csproj@@ -8,7 +8,7 @@<AssemblyName>Cadmata</AssemblyName><SpaRoot>..\aetheris.client\</SpaRoot><SpaProxyServerUrl>https://localhost:5173</SpaProxyServerUrl>- <SpaProxyLaunchCommand>tspack run dev</SpaProxyLaunchCommand>+ <SpaProxyLaunchCommand>tspack run dev --root ..</SpaProxyLaunchCommand><SpaProxyWorkingDirectory>$(SpaRoot)</SpaProxyWorkingDirectory></PropertyGroup>diff --git a/Aetheris.Server/Program.cs b/Aetheris.Server/Program.csindex 23f45be5..97c0f991 100644--- a/Aetheris.Server/Program.cs+++ b/Aetheris.Server/Program.cs@@ -19,58 +19,7 @@ catch (CadmataLaunchException exception)return 2;}-var builder = WebApplication.CreateBuilder(new WebApplicationOptions-{- Args = args,- ContentRootPath = AppContext.BaseDirectory,-});--if (launchOptions.Step is not null && !launchOptions.HasExplicitUrls)-{- builder.WebHost.UseUrls("http://127.0.0.1:0");-}--if (launchOptions.Step is not null)-{- // The CLI intentionally returns after process creation. Keep the detached- // host from retaining noisy per-request console output in redirected pipes.- builder.Logging.ClearProviders();-}--var stepUploadOptions = builder.Configuration- .GetSection(StepUploadOptions.SectionName)- .Get<StepUploadOptions>()- ?? new StepUploadOptions();--builder.WebHost.ConfigureKestrel(options =>-{- options.Limits.MaxRequestBodySize = stepUploadOptions.MaxUploadSizeBytes;-});--builder.Services.AddSingleton(stepUploadOptions);-builder.Services.AddEndpointsApiExplorer();-builder.Services.AddSwaggerGen();-builder.Services.AddSingleton<KernelDocumentStore>();-builder.Services.AddSingleton(new CadmataStartupStep(launchOptions.Step));--var app = builder.Build();--if (app.Environment.IsDevelopment())-{- app.UseSwagger();- app.UseSwaggerUI();-}--app.MapKernelApi();-app.MapCadmataStartupApi();-app.MapPaperclipDemoApi();-app.MapStandardProductGalleryApi();--app.UseDefaultFiles();-var staticContentTypes = new FileExtensionContentTypeProvider();-staticContentTypes.Mappings[".wgsl"] = "text/plain";-app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = staticContentTypes });-app.MapFallbackToFile("index.html");+var app = CadmataApplication.Create(args, launchOptions);if (launchOptions.Step is null){diff --git a/Aetheris.Server/Startup/CadmataApplication.cs b/Aetheris.Server/Startup/CadmataApplication.csnew file mode 100644index 00000000..21470a40--- /dev/null+++ b/Aetheris.Server/Startup/CadmataApplication.cs@@ -0,0 +1,100 @@+using Aetheris.Server.Api;+using Aetheris.Server.Configuration;+using Aetheris.Server.Documents;+using Microsoft.AspNetCore.StaticFiles;++namespace Aetheris.Server.Startup;++public static class CadmataApplication+{+ public static WebApplication Create(string[] args, CadmataLaunchOptions launchOptions, bool portable = false, ILoggerProvider? logging = null, string? sessionToken = null)+ {+ var builder = WebApplication.CreateBuilder(new WebApplicationOptions+ {+ Args = args,+ EnvironmentName = portable ? Environments.Production : null,+ ContentRootPath = AppContext.BaseDirectory,+ });++ if (!portable && launchOptions.Step is not null && !launchOptions.HasExplicitUrls)+ {+ builder.WebHost.UseUrls("http://127.0.0.1:0");+ }++ if (portable || launchOptions.Step is not null)+ {+ // The CLI intentionally returns after process creation. Keep the detached+ // host from retaining noisy per-request console output in redirected pipes.+ builder.Logging.ClearProviders();+ if (logging is not null) builder.Logging.AddProvider(logging);+ }++ if (portable)+ {+ builder.Configuration.Sources.Clear();+ builder.WebHost.ConfigureKestrel(options => options.Listen(System.Net.IPAddress.Loopback, 0));+ }++ var stepUploadOptions = builder.Configuration+ .GetSection(StepUploadOptions.SectionName)+ .Get<StepUploadOptions>()+ ?? new StepUploadOptions();++ builder.WebHost.ConfigureKestrel(options =>+ {+ options.Limits.MaxRequestBodySize = stepUploadOptions.MaxUploadSizeBytes;+ });++ builder.Services.AddSingleton(stepUploadOptions);+ builder.Services.AddEndpointsApiExplorer();+ builder.Services.AddSwaggerGen();+ builder.Services.AddSingleton<KernelDocumentStore>();+ builder.Services.AddSingleton(new CadmataStartupStep(launchOptions.Step));++ var app = builder.Build();++ if (app.Environment.IsDevelopment())+ {+ app.UseSwagger();+ app.UseSwaggerUI();+ }++ if (sessionToken is not null) ConfigureSession(app, sessionToken);+ app.MapKernelApi();+ app.MapCadmataStartupApi();+ app.MapPaperclipDemoApi();+ app.MapStandardProductGalleryApi();++ app.UseDefaultFiles();+ var staticContentTypes = new FileExtensionContentTypeProvider();+ staticContentTypes.Mappings[".wgsl"] = "text/plain";+ app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = staticContentTypes });+ app.MapFallbackToFile("index.html");++ return app;+ }++ private static void ConfigureSession(WebApplication app, string token)+ {+ // The embedded window receives an unguessable session cookie. Other+ // browser origins cannot invoke the engineering API without the cookie.+ app.Use(async (context, next) =>+ {+ if (context.Request.Path == "/__cadmata/session/" + token)+ {+ context.Response.Cookies.Append("cadmata-session", token, new CookieOptions+ {+ HttpOnly = true, SameSite = SameSiteMode.Strict, Path = "/",+ });+ context.Response.Redirect("/");+ return;+ }+ if (context.Request.Cookies["cadmata-session"] != token)+ {+ context.Response.StatusCode = StatusCodes.Status403Forbidden;+ return;+ }+ await next(context);+ });+ }+}diff --git a/Aetheris.slnx b/Aetheris.slnxindex d3cd7c1c..c084f969 100644--- a/Aetheris.slnx+++ b/Aetheris.slnx@@ -1,4 +1,5 @@<Solution>+ <Project Path="Aetheris.Cadmata.Desktop/Aetheris.Cadmata.Desktop.csproj" /><Project Path="Aetheris.Server/Aetheris.Server.csproj" /><Project Path="Aetheris.Drawing/Aetheris.Drawing.csproj" /><Project Path="Aetheris.Drawing.Tests/Aetheris.Drawing.Tests.csproj" />diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.mdindex 392dc714..78176ac3 100644--- a/THIRD_PARTY_NOTICES.md+++ b/THIRD_PARTY_NOTICES.md@@ -61,6 +61,17 @@ AGPL-licensed or authored by Aetheris.## Other dependencies+Cadmata's portable Windows package bundles the Microsoft WebView2 Fixed Version+Runtime and WebView2 SDK under Microsoft's supplied terms. It preserves their+LICENSE/NOTICE files, the .NET runtime notices, and resolved frontend/NuGet+dependency notices under `licenses/`. The npm archive for React Three Fiber+9.7.0 omits its MIT text; the unmodified upstream v9.7.0 license is preserved+at `Aetheris.Cadmata.Desktop/licenses/react-three-fiber-LICENSE.txt`.+Additional package omissions are supplied from the pinned upstream sources in+`Aetheris.Cadmata.Desktop/licenses/supplemental-sources.json`. The portable+package includes an explicit `licenses/AUDIT.json`; incomplete notices hold+the candidate from public distribution.+Drawing Notes uses the MIT-licensed `PDFtoImage` .NET package, which wraps theBSD-licensed PDFium renderer and MIT-licensed SkiaSharp graphics library. Theirbinary packages and license metadata are restored from NuGet and retain theirdiff --git a/aetheris.client/aetheris.client.esproj b/aetheris.client/aetheris.client.esprojindex d9911613..20fc5ed6 100644--- a/aetheris.client/aetheris.client.esproj+++ b/aetheris.client/aetheris.client.esproj@@ -1,6 +1,6 @@<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.4338480"><PropertyGroup>- <StartupCommand>tspack run dev</StartupCommand>+ <StartupCommand>tspack run dev --root ..</StartupCommand><ShouldRunNpmInstall>false</ShouldRunNpmInstall><ShouldRunNpmAudit>false</ShouldRunNpmAudit><JavaScriptTestRoot>src\</JavaScriptTestRoot>diff --git a/aetheris.client/manifest.tsx b/aetheris.client/package.manifest.tsxsimilarity index 85%rename from aetheris.client/manifest.tsxrename to aetheris.client/package.manifest.tsxindex 928f9cdc..01ae56ac 100644--- a/aetheris.client/manifest.tsx+++ b/aetheris.client/package.manifest.tsx@@ -5,22 +5,22 @@ import {Package,Policies,RunTargets,- Security,Targets,Tools,TsConfig,VSCode,- Workspace,- define,+ definePackage,defineDeps,dep,npm,+ path,tool,type BoundaryPolicy,type TypePolicy,} from "tspack/manifest";const deps = defineDeps({+ telos: dep(path("../Aetheris.Web.Runtime/telos"), { key: "@aetheris/three-telos" }),react: dep(npm("react", "^19.2.0")),reactDom: dep(npm("react-dom", "^19.2.0"), { key: "react-dom" }),three: dep(npm("three", "^0.183.1")),@@ -78,8 +78,7 @@ const boundaries = {crossTargetImports: "error",} satisfies BoundaryPolicy;-export default define(- <Workspace name="aetheris-cadmata" runtime="nodejs">+export default definePackage(<Packagename="aetheris.client"version="2.0.0-preview.3"@@ -87,6 +86,7 @@ export default define(license="AGPL-3.0-only"dependencies={{values: [+ deps.telos,deps.react,deps.reactDom,deps.three,@@ -134,6 +134,7 @@ export default define(types: "",javascriptRuntime: "browser",deps: [+ deps.telos,deps.react,deps.reactDom,deps.three,@@ -177,12 +178,12 @@ export default define(/><RunTargetsrows={[- { name: "dev", runtime: "node", command: ["vite"], url: "https://localhost:5173" },- { name: "typecheck", runtime: "node", command: ["tsc", "-b", "--pretty", "false"] },- { name: "test", runtime: "node", command: ["vitest", "run"] },+ { name: "dev", runtime: "node", cwd: "package", command: ["vite"], url: "https://localhost:5173" },+ { name: "typecheck", runtime: "node", cwd: "package", command: ["tsc", "-b", "--pretty", "false"] },+ { name: "test", runtime: "node", cwd: "package", command: ["vitest", "run"] },{name: "profile-grid",- runtime: "node",+ runtime: "node", cwd: "package",command: ["vitest","run",@@ -191,28 +192,14 @@ export default define("--disableConsoleIntercept",],},- { name: "build", runtime: "node", command: ["vite", "build"] },- { name: "lint", runtime: "node", command: ["eslint", "."] },+ { name: "build", runtime: "node", cwd: "package", command: ["vite", "build"] },+ { name: "lint", runtime: "node", cwd: "package", command: ["eslint", "."] },]}/>- </Package><CompatFiles><JsonFile path="tsconfig.tspack.json" value={TsConfig.manifestEditor()} /><JsonFile path=".vscode/settings.json" value={VSCode.settings()} /><JsonFile path=".vscode/extensions.json" value={VSCode.extensions()} /></CompatFiles>- <Security- acknowledgedLifecycleCategories={[- {- category: "consumer-install",- reason:- "Vite, Biome, and renderer dependencies select platform binaries; TSPack records but does not execute lifecycle scripts.",- },- {- category: "maintainer-publish",- reason: "Cadmata is an application and is not published as an npm package.",- },- ]}- />- </Workspace>,+ </Package>,);diff --git a/aetheris.client/src/api/aetherisApi.ts b/aetheris.client/src/api/aetherisApi.tsindex 685332b1..5bb907c4 100644--- a/aetheris.client/src/api/aetherisApi.ts+++ b/aetheris.client/src/api/aetherisApi.ts@@ -1,3 +1,5 @@+import { reportDesktopDiagnostic } from "../desktopDiagnostics";+export interface DiagnosticDto {code: string;severity: string;@@ -462,7 +464,15 @@ async function request<T>(path: string, init: RequestInit): Promise<T> {},});- return parseEnvelope<T>(response);+ try {+ const result = await parseEnvelope<T>(response);+ if (/import\/step|export\/step|assembly/.test(path))+ reportDesktopDiagnostic("CAD request", { path, status: response.status });+ return result;+ } catch (error) {+ reportDesktopDiagnostic("CAD request failed", { path, status: response.status, message: String(error) });+ throw error;+ }}export async function createDocument(name?: string): Promise<DocumentCreateResponseDto> {diff --git a/aetheris.client/src/desktopDiagnostics.ts b/aetheris.client/src/desktopDiagnostics.tsnew file mode 100644index 00000000..70935b58--- /dev/null+++ b/aetheris.client/src/desktopDiagnostics.ts@@ -0,0 +1,12 @@+/** Optional native diagnostic sink; normal browser hosting remains unchanged. */+export function reportDesktopDiagnostic(event: string, detail: unknown): void {+ const host = window as Window & {+ chrome?: { webview?: { postMessage(message: unknown): void } };+ };+ host.chrome?.webview?.postMessage({ event, detail });+}++window.addEventListener("error", (event) =>+ reportDesktopDiagnostic("error", event.message));+window.addEventListener("unhandledrejection", (event) =>+ reportDesktopDiagnostic("unhandledrejection", String(event.reason)));diff --git a/aetheris.client/src/main.tsx b/aetheris.client/src/main.tsxindex 9cd1cc60..6f22c0f6 100644--- a/aetheris.client/src/main.tsx+++ b/aetheris.client/src/main.tsx@@ -2,6 +2,7 @@ import { StrictMode } from "react";import { createRoot } from "react-dom/client";import "./index.css";import App from "./App.tsx";+import "./desktopDiagnostics";createRoot(document.getElementById("root")!).render(<StrictMode>diff --git a/aetheris.client/src/viewer/AetherisViewport.tsx b/aetheris.client/src/viewer/AetherisViewport.tsxindex 0fcaa53a..1d8a04b6 100644--- a/aetheris.client/src/viewer/AetherisViewport.tsx+++ b/aetheris.client/src/viewer/AetherisViewport.tsx@@ -10,6 +10,7 @@ const LegacyAetherisViewport = lazy(() =>);import { cadmataTelosScene } from "./cadmataTelos";import { ATELIER_VIEWPORT_THEME } from "./viewportTheme";+import { reportDesktopDiagnostic } from "../desktopDiagnostics";export type { AetherisViewportProps } from "./viewportProps";/** One graphics authority; legacy rendering is loaded only for unsupported browsers. */@@ -132,6 +133,7 @@ function TelosViewport(props: AetherisViewportProps & { onRetry(): void }) {return;}host.current = current;+ reportDesktopDiagnostic("renderer", { host: "three-telos", aa: latest.current.aaMode ?? "SpatialOnly" });setLabelHost(current);current.camera.mode = "orthographic";current.camera.up.set(0, 0, 1);@@ -141,6 +143,7 @@ function TelosViewport(props: AetherisViewportProps & { onRetry(): void }) {latest.current.onHostReady?.(current);}).catch((error) => {+ reportDesktopDiagnostic("renderer-failure", String(error));if (!disposed) setDiagnostic(String(error));});return () => {diff --git a/aetheris.client/vite.config.ts b/aetheris.client/vite.config.tsindex 5cdd6974..fec156ed 100644--- a/aetheris.client/vite.config.ts+++ b/aetheris.client/vite.config.ts@@ -53,6 +53,7 @@ export default defineConfig(({ command }) => ({},},build: {+ assetsInlineLimit: (filePath) => filePath.endsWith(".wgsl") ? false : undefined,// The rendering core is intentionally a single cached vendor chunk. Its// measured production size is 724 KB; retain a small budget above that// rather than accepting Vite's generic 500 KB advisory.diff --git a/docs/public/cadmata/portable-windows.md b/docs/public/cadmata/portable-windows.mdnew file mode 100644index 00000000..0d3ad10f--- /dev/null+++ b/docs/public/cadmata/portable-windows.md@@ -0,0 +1,36 @@+# Cadmata — Aetheris Preview 4++Release instructions draft. This local candidate is **not approved for public+distribution**: the redistribution notice audit and required manual session+remain open. No GitHub Release has been published.++When released, download `Cadmata-Preview4-win-x64.zip` from Aetheris GitHub Releases.+Extract the entire ZIP to a local folder. Run **Cadmata.exe**.++The included mounting block opens automatically. Use STEP 242 Viewer to open+your own STEP file and **Download Canonical 242** to save a canonical STEP file.+Close the window to exit; reopen Cadmata.exe to start another session.++Windows 11 x64 is the initial qualification target. A WebGPU-capable GPU/driver+is recommended. Three Telos uses automatic CIR where qualified and mesh+otherwise. A browser without WebGPU uses the labeled existing WebGL fallback;+initialization/device failures show a diagnostic. The ZIP includes .NET,+ASP.NET, WindowsDesktop and fixed WebView2 153.0.4234.48. No SDK, Node, browser+runtime installation, terminal or internet connection is needed for local CAD.+Run from a local disk; network/UNC folders are unsupported by fixed WebView2.++The executable is unsigned. Windows may display an unknown-publisher warning+for a downloaded ZIP. Preview 4 has no installer or automatic updater.+Download a newer ZIP to update the bundled browser/security runtime.++About Cadmata shows the version and source identity. Open diagnostic log shows+the current session log. Logs and disposable browser profiles live under+`%LOCALAPPDATA%\Aetheris\Cadmata`; the extracted application is read-only during+normal use. Twenty diagnostic logs are retained. Exports use browser downloads,+and model state is session-local. Reopening loads the included sample again.++Aetheris is AGPL-3.0-only; see LICENSE and licenses/ for bundled dependency+notices. Corresponding source: https://github.com/yuechen-li-dev/Aetheris.+BUILD-METADATA.json identifies the source revision, modifications and files.+A package marked `modifiedSource` is a local qualification candidate, not a+published source-identical release.diff --git a/docs/public/cadmata/preview4-release-notes-draft.md b/docs/public/cadmata/preview4-release-notes-draft.mdnew file mode 100644index 00000000..d9539eb6--- /dev/null+++ b/docs/public/cadmata/preview4-release-notes-draft.md@@ -0,0 +1,27 @@+# Cadmata Preview 4 — distribution note draft++**Held local candidate; not published.** Redistribution notices and the+mandatory manual packaged-app session remain open.++Cadmata is Aetheris's engineering viewer for authored models and STEP AP242.+The Windows x64 portable ZIP includes the application, .NET runtime, fixed+WebView2 browser runtime, shaders and small samples.++When released: download the ZIP, extract it completely to a local folder and+run **Cadmata.exe**. The included mounting block opens automatically. No SDK,+Node/npm, terminal, repository checkout or separate backend startup is needed.++Automated tests of the extracted application demonstrate Three Telos rendering,+qualified direct CIR, mesh fallback, orbit/selection, external STEP import with+PMI, STEP download/reimport and clean window shutdown. The same workflow passes+after relocation with the package directory non-writable.++Initial qualification covers Windows 11 x64 on one NVIDIA WebGPU configuration.+Native picker/Save As and the required manual session remain unverified. The+app is unsigned; Windows may show an unknown-publisher warning for downloaded+files. Session state resets on reopen. Updates use a newer downloaded ZIP.++Source and licensing: [Aetheris](https://github.com/yuechen-li-dev/Aetheris),+AGPL-3.0-only. The package identifies its source/base revision and modified-source+status. A public artifact requires a published corresponding source revision+and a complete bundled-dependency notice audit.diff --git a/docs/release/P4-02-CADMATA-DISTRIBUTION-X0.md b/docs/release/P4-02-CADMATA-DISTRIBUTION-X0.mdnew file mode 100644index 00000000..08de6f2b--- /dev/null+++ b/docs/release/P4-02-CADMATA-DISTRIBUTION-X0.md@@ -0,0 +1,300 @@+# P4-02 — CADMATA-DISTRIBUTION-X0++Verdict: **Meaningful progression**, 2026-10-06. A self-contained Windows ZIP+now runs the actual Cadmata backend, production frontend and Three Telos+without development tools on the application's PATH. The extracted app renders+the mechanical sample, imports an external AP242 part, exports/reimports STEP,+selects geometry and closes its backend. Direct CIR also renders through the+packaged host. Public distribution remains held by incomplete dependency+notices and the required manual packaged-app session.++## Package architecture++`Cadmata.exe` is a Windows Forms WinExe host. It runs the existing+`CadmataApplication` ASP.NET application in the same process, rather than+launching a second server executable or duplicating the CAD API. Both the+existing server entrypoint and the desktop host use this startup owner. The+existing development/server launch behavior remains available.+The desktop project opts into `EnableWindowsTargeting` for the existing Ubuntu+solution-build lane, following [NETSDK1100 guidance](https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1100).+Linux CI was not executed here; this permits Windows cross-target compilation,+not a Linux desktop distribution. The final Windows republish after that+property change produced the identical ZIP hash recorded below.++The desktop starts Kestrel in Production on an ephemeral `127.0.0.1` port.+An explicit endpoint takes precedence over developer URL/environment settings.+An unguessable per-launch bootstrap URL gives the embedded browser an HttpOnly,+SameSite=Strict cookie; requests without it receive 403. There is no LAN+listener, fixed production port, certificate or firewall configuration step.+The socket integration test covers endpoint selection and the cookie boundary.++WebView2 SDK 1.0.4258.31 loads the complete bundled **Fixed Version runtime+153.0.4234.48 x64**, with a new browser profile for each window. The host blocks+off-origin HTTP(S) resource requests, external navigation and new windows.+The normal app does not enable remote debugging; the qualification harness+enables it only for its own child process.++The package contains self-contained .NET 10, ASP.NET and WindowsDesktop,+production Vite JS/CSS, standalone Telos `mesh.wgsl`/`line.wgsl` and optional+temporal shaders. Managed CIR/WGSL emission remains the existing backend path;+no Node, DXC, Naga executable or Vite server is started at runtime. Ordinary+mesh and qualified CIR retain the same shared Telos ownership and SpatialOnly+AA. No packaging-specific renderer fallback was added.++No-argument launch opens `samples/mounting-block.firmament`. This is the existing+small machined mounting-block source, including authored PMI. A second small+`samples/cylinder.firmament` supplies the already-qualified direct CIR witness.+Paths resolve from the executable root. Existing startup arguments also accept+STEP/Firmament/Assembly documents; no new import formats were added.++Startup is bounded to 45 seconds and failures show a diagnostic with the log+path. About exposes Preview 4/version/source identity. Logs live under+`%LOCALAPPDATA%\Aetheris\Cadmata\logs`; twenty logs are retained. Disposable+WebView profiles live in the sibling `sessions` directory. Profile deletion+can be deferred by browser locks; stale profiles older than one day are retried+on later launches. Exports use the browser download mechanism. Model state is+session-local; reopening starts with the bundled sample.++Closing asynchronously disposes the browser controller, stops/disposes the+backend and closes the form. The first implementation's synchronous UI-thread+shutdown failed the packaged WM_CLOSE test. Awaiting shutdown fixed this:+the recorded final session stopped the backend in milliseconds and the listener+was gone before the harness completed. No background service, updater or+startup hook was introduced.++## Repeatable build++From a source checkout with .NET 10 SDK, Node/npm and TSPack available:++```powershell+./scripts/package-cadmata-preview4.ps1+```++The default output is ignored `artifacts/local/cadmata-distribution/release/`.+The script builds Telos from its tracked npm lock, synchronizes the locked+client workspace with TSPack, typechecks/builds the frontend, publishes the+desktop self-contained for win-x64, verifies/downloads the fixed runtime CAB,+collects licenses, inventories files, creates the ZIP and writes SHA256SUMS.+`-WebViewCab <absolute-path>` reuses a previously downloaded, hash-verified CAB.+These tools are build prerequisites; none are application prerequisites.++The previous package-local TSPack manifest omitted the real sibling Telos+dependency and depended on an untracked client npm lock. The workspace now+declares that local source dependency. `ts-lock.toml` moved to the workspace+root byte-for-byte; registry versions were not updated. RunTargets use the+client package working directory. Existing generic release/SpaProxy targets+now point at the root workspace.++Current TSPack synchronization does not materialize this local source link.+The packaging script creates the declared Telos source junction and makes the+client use the workspace module tree. A stale client installation is moved to+ignored output rather than reused. These links are build-only and are absent+from the ZIP. An attempted fresh resolver update also rejected Tailwind's+`>=3.0.0 || insiders` peer range; the existing locked graph passes sync/check,+typecheck, lint, tests and production build. No sibling tooling repo was edited.++Qualification used a clean Git archive of base revision+`a8891bf7ea3a92f6bae2b13a7872195683d6f070`, overlaid with this task's source+changes, without development binaries, node_modules or the untracked client+npm lock. The snapshot is under ignored `artifacts/local/cadmata-distribution/clean-source`.+Its package explicitly identifies `.modified` source; it is not a release+whose exact source is already available at the base GitHub revision. Publication+requires committing/providing the corresponding final source revision.++ZIP entries have sorted paths and normalized timestamps. Packaging is+repeatable; byte-for-byte reproducibility across different SDKs, dependency+caches and checkout paths has not been established.++## Runtime pin and packaged qualification++The complete official WebView2 154.0.4258.62 runtime launched the sample backend+but failed Three Telos `requestDevice` with:++```text+DynamicLib.Open: dxil.dll Windows Error: 87+EnsureDXCLibraries(...dawn...PlatformFunctionsD3D12.cpp:221)+```++The packaged DXIL/DXC libraries were present. Changing the working directory+did not fix it. Runtime 153 rendered in the same extraction path, including+spaces and `ü`, so the build pins that version and packages it completely.+The final successful run uses the bundled runtime with no browser-folder+override. No DLL replacement, GPU sandbox disabling or legacy renderer patch+was used. The 154 failure remains preserved in local diagnostic evidence.+Any future browser pin change needs this packaged qualification again.++Official fixed-runtime distribution reference:+[Microsoft WebView2 distribution](https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution).+The initial qualification target is Windows 11 x64, local disk. Windows 10,+UNC paths, other GPUs/driver versions and ARM64 are not qualified here.++The final ZIP is copied outside the repo into a fresh Temp extraction directory.+The application child receives System32-only PATH, an invalid DOTNET_ROOT,+unrelated Windows working directory and deliberately conflicting development+ASPNETCORE settings. The driver connects to the **actual extracted Cadmata.exe+WebView2**, without launching an alternate browser/backend. Its own Node and+Playwright are test tooling, outside the application dependency graph.+The harness verifies the browser origin against this new process's PID-specific+readiness log before driving it. Debug ports are selected dynamically by default.++Automated replay, using an absolute path to a locally available Playwright module:++```powershell+node scripts/qualify-cadmata-portable.mts "<extracted-package>" artifacts/local/cadmata-distribution/replay "<playwright/index.mjs>" "<external-part.stp>"+```++An optional fifth argument is the extracted `samples/cylinder.firmament` to+assert a direct CIR field draw. This replay does not satisfy manual qualification.++Observed host: Windows 11 Pro x64 build 26200, NVIDIA RTX 3070, NVIDIA driver+32.0.15.9636. Each launch creates a fresh WebView profile. This is not a new+Windows user account or a machine with the SDK uninstalled.++| Check | Recorded result |+| --- | --- |+| Default sample | Mounting block renders, mesh fallback explicitly `no-field-representation` |+| Telos / AA | Three Telos, SpatialOnly, local mesh/line shader requests succeed |+| Qualified CIR | Cylinder: one field draw, one engineering pick proxy, `shader-artifact-bound` |+| Camera / selection | Scripted orbit/pan/zoom and geometry selection succeed; orbit changes rendered pixels |+| External STEP | NIST CTC03 AP242 copied outside repo, actual packaged import and mesh display succeed |+| PMI | CTC03 published/evidence entities, position callouts and leaders visible in packaged screenshot |+| Export/reimport | Canonical download creates ISO-10303-21 file; reimport succeeds |+| Invalid STEP | Visible import failure, process remains alive, last valid model/export remains available |+| Security | Unauthenticated API request 403, ephemeral IPv4 loopback listener |+| Offline resource guard | All recorded application HTTP requests use its loopback origin; host blocks external web requests |+| Spaces/non-ASCII/CWD | Sample and complete scripted workflow pass outside repo in space/`ü` path, CWD Windows |+| Move / read-only | Same extracted package moved; write-deny ACL verified by an actual rejected write, workflow still passes |+| Close/reopen | Repeated packaged sessions close via native WM_CLOSE; process exits and listener no longer responds |+| Concurrent windows | Two simultaneous instances use distinct loopback ports and fresh profiles; both complete and close |+| Version / writes | Preview 4 identity in log/About implementation; application/log/profile paths follow documented ownership |++Fresh account, physical internet disconnection, filesystem denial of repo+access, downloaded-ZIP SmartScreen/Defender observation, native picker/Save As,+native title-bar interaction, window resize/device-loss recovery,+broad Assembly/Scene qualification and PMI filter interactions are+not claimed by this automated evidence. The active development server was not+stopped or moved to simulate isolation.+The final process inventory found no Cadmata/WebView2 process executing from+any of this task's extraction directories. PE subsystem 2 confirms the entrypoint+is a GUI application; its file metadata carries the Preview 4 product/version.++### Manual session — required, not completed++No human/manual packaged session is claimed. The successful evidence is an+automated actual-host test, with browser input-file injection/CDP downloads and+native WM_CLOSE. The available computer-use surface has native APIs disabled;+the Windows computer-use skill says "Run this once per fresh `node_repl`+JavaScript session," and that session tool is not an+available tool in this run. An automated screenshot cannot substitute for the+mission's mandatory manual session.++Before acceptance, use this ZIP in an interactive Windows session: extract,+double-click Cadmata.exe, observe the sample, orbit/select, use the real file+picker to import STEP, save STEP using the actual browser dialog, close the+title bar and reopen. Record native prompts, picker/export behavior and process+cleanup. Observe unsigned-app/SmartScreen and firewall behavior on a downloaded+artifact. The WinExe is unsigned; no signing result or absence of security+prompts is inferred from test-process launch.++## Contents, size and provenance++Final artifact: `release-final/Cadmata-Preview4-win-x64.zip`.+ZIP: **399,619,347 bytes (381.11 MiB)**. Extracted: **901,096,773 bytes+(859.35 MiB)**, 1,017 files including BUILD-METADATA.json.++```text+e0a74dbc1b3ec7a732e476f3760011e24c93385cd17567b20f76ca7a90f41d35+```++Fixed WebView2 CAB SHA-256:+`11e8240cb0bc56dcd3e4498907203c251346f65107fe35a3a13e152c7d51c79e`.++Final-ZIP automated sample-ready measurements: 2.756 s and 2.513 s for the+simultaneous sessions, 2.219 s after relocation/read-only guard, 1.663 s for+the qualified cylinder. These measure harness observation of model/host+readiness, not a manually observed first pixel. Logs separately record backend+readiness and page visibility.++Repository CLI inspection independently confirms the external and exported+STEP each have one body/shell, 120 faces, 354 edges and 236 vertices, with an+enclosed-manifold assessment. This does not assert complete PMI roundtrip+preservation.++`BUILD-METADATA.json` records Preview 4/base source identity, modified-source+status, fixed runtime URL/hash, notice audit status and each payload file's+path, byte size, purpose and SHA-256. Its inventory excludes the metadata file+itself; `package-summary.json` measures all extracted files including metadata.++The dominant component is the complete fixed browser runtime (about 700 MB+uncompressed). Self-contained .NET/ASP.NET/WindowsDesktop and dependencies are+about 183 MB; the CAD/backend assemblies about 15 MB; frontend/shaders about+1.7 MB. Source samples are a few kilobytes. Complete measured groups are in the+local content summary. No runtime/framework trimming was attempted.++The ZIP has one obvious Cadmata.exe. Extra executable payloads belonging to+the browser and .NET crash helper are internal runtime components. The unused+Forge Host apphost, PDBs and static-webasset development manifest are removed.+It contains no node_modules, source tree, tests, build intermediates or session+logs. Browser third-party notices and .NET runtime notices are retained.++### Redistribution audit — release hold++Aetheris LICENSE/THIRD_PARTY_NOTICES and collected dependency notices are+included. Supplied npm license/notice text and NuGet nuspec/license metadata+are preserved. Pinned upstream license copies cover Fiber, Draco and two+NuGet meta-package omissions; supplemental sources/hashes are checked in.+Other NuGet omissions are retrieved from their supplied repository commit.++The conservative runtime dependency/peer closure still has explicit unresolved+notice entries in `licenses/AUDIT.json`. The seven Copeland packages used for+managed WGSL have **no license text/expression or repository URL in their+published nuspec metadata**, so their terms cannot be inferred here. The+affected version is `0.1.0-preview.1-a3.7329cf8ff04d504a`:+Markdown, Profile, SpanAllocation, TS, TS.Backend.Wgsl, TS.Mir and TS.Workspace.+The remaining npm omissions are MediaPipe Tasks Vision 0.10.17, maath 0.10.8+and stats-gl 2.4.2. Their installed license identifiers do not supply the+missing text/attribution; pinned historical upstream trees checked for maath+and stats-gl also omit a license file. This is an intentionally conservative+hold, not an assertion that all transitive optional code is shipped by Vite.++Complete the owner-supplied Copeland notices and resolve these package+omissions (or prove unused code is excluded) before public redistribution.+No terms were invented and no sibling repository was modified. The package+README and metadata visibly identify it as a held local candidate.++## Regression evidence and local artifacts++Clean-snapshot .NET solution build passes. Fast kernel lane: **1,016 passed**.+Full serial solution lane: **4,333 passed, 0 failed, 7 skipped** in 20 suites.+The seven skips are existing local 3DM qualification tests whose external+assets are absent from the clean source archive. Client typecheck,+lint, production build and **86 tests in 18 files** pass. The packaging script+also rebuilds/typechecks the production frontend and self-contained desktop.++```powershell+dotnet build Aetheris.slnx -c Release -m:1+dotnet test Aetheris.Kernel.Core.Tests -c Release --no-build --filter "Category!=SlowCorpus"+dotnet test Aetheris.slnx -c Release --no-build -m:1 -- RunConfiguration.MaxCpuCount=1+```++An initial test run under relocated `--artifacts-path` failed existing tests+that calculate repo roots from assembly depth. Running the normal build/test+layout in the clean source snapshot resolves those failures. Initial failed+logs remain available and are not substituted for the final green lanes.++Raw logs/screenshots and the candidate remain ignored under+`artifacts/local/cadmata-distribution/`:++- `release-final/Cadmata-Preview4-win-x64.zip`, `SHA256SUMS`, package/content summaries.+- `final-package-build.log`, `final-solution-build.log`, `final-fast-tests.log`, `final-full-tests.log`.+- `ci-compatible-package-build.log`: repeated packaging, same final ZIP bytes/hash.+- `final-qualification/`: mounting-block image, orbit/selection image, external STEP/PMI image, export and qualification JSON.+- `cir-qualification/`: actual cylinder field draw and subsequent STEP workflow.+- `moved-read-only-qualification/`: relocated package workflow and `read-only-guard.txt`.+- `concurrent-qualification/`: second simultaneous instance and independent loopback port.+- `diagnostic/` and `runtime-153-diagnostic/`: original 154 error and isolated 153 rendering evidence.++No GitHub Release was published. The requested normal-user verdict is not yet+Accepted: the real packaged engineering workflow improves and is demonstrated,+but distribution notices and manual native-interaction evidence remain concrete+release gates.diff --git a/manifest.tsx b/manifest.tsxnew file mode 100644index 00000000..9e7176e1--- /dev/null+++ b/manifest.tsx@@ -0,0 +1,15 @@+import { define, Packages, Security, Workspace } from "tspack/manifest";++// Cadmata imports the sibling Telos package. The workspace owns both paths;+// package-local manifests retain the client contract and RunTargets.+export default define(+ <Workspace name="aetheris-cadmata" runtime="nodejs">+ <Packages rows={[+ { name: "aetheris.client", root: "aetheris.client", manifest: "aetheris.client/package.manifest.tsx" },+ ]} />+ <Security acknowledgedLifecycleCategories={[+ { category: "consumer-install", reason: "Vite, Biome and renderer dependencies select platform binaries; lifecycle execution remains blocked." },+ { category: "maintainer-publish", reason: "Cadmata is an application, not an npm publication." },+ ]} />+ </Workspace>,+);diff --git a/scripts/collect-cadmata-licenses.mts b/scripts/collect-cadmata-licenses.mtsnew file mode 100644index 00000000..0451442c--- /dev/null+++ b/scripts/collect-cadmata-licenses.mts@@ -0,0 +1,97 @@+import { readFile, readdir, mkdir, copyFile, writeFile, realpath } from "node:fs/promises";+import { join, resolve } from "node:path";+import { createRequire } from "node:module";+import { createHash } from "node:crypto";+const [root, stage, assetsPath] = process.argv.slice(2).map(path => resolve(path));+const output = join(stage, "licenses");+await mkdir(output, { recursive: true });+const notices: string[] = [];+const unresolved: string[] = [];+const fetched = new Map<string, string>();+const supplements = JSON.parse(await readFile(join(root, "Aetheris.Cadmata.Desktop/licenses/supplemental-sources.json"), "utf8")) as+ { identity: string; file: string; url: string; sha256: string }[];+async function supplemental(identity: string, target: string): Promise<boolean> {+ const source = supplements.find(item => item.identity === identity);+ if (!source) return false;+ const file = join(root, "Aetheris.Cadmata.Desktop/licenses", source.file);+ const bytes = await readFile(file);+ if (createHash("sha256").update(bytes).digest("hex") !== source.sha256) throw new Error("Supplemental license hash mismatch: " + identity);+ await copyFile(file, join(target, "LICENSE.txt"));+ await writeFile(join(target, "UPSTREAM-LICENSE-SOURCE.txt"), source.url + "\nSHA256 " + source.sha256 + "\n");+ notices.push(identity + ": checked-in upstream license, source and hash supplied");+ return true;+}+async function collect(directory: string, identity: string) {+ const files = await readdir(directory);+ const matches = files.filter((name) => /^(license|licence|copying|notice|third.?party.?notices)([.-]|$)/i.test(name));+ const target = join(output, identity.replace(/[^\w.-]/g, "_"));+ await mkdir(target, { recursive: true });+ for (const name of matches) await copyFile(join(directory, name), join(target, name));+ notices.push(`${identity}: ${matches.length ? matches.join(", ") : "license metadata below"}`);+ const packageJson = join(directory, "package.json");+ try {+ const metadata = JSON.parse(await readFile(packageJson, "utf8"));+ await writeFile(join(target, "package-license.json"), JSON.stringify({ name: metadata.name, version: metadata.version,+ license: metadata.license, repository: metadata.repository }, null, 2));+ if (!matches.length && !metadata.name?.startsWith("@aetheris/") && !await supplemental(identity, target))+ unresolved.push(identity + ": npm package omits license text");+ } catch (error) { if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; }+}+// Preserve the installed runtime dependency/peer closure. Build tools and their+// platform executables are not distributed in Cadmata and need no ZIP payload.+const seen = new Set<string>();+async function visit(directory: string, includeOwnNotice = true) {+ const canonical = await realpath(directory);+ if (seen.has(canonical)) return;+ seen.add(canonical);+ const metadata = JSON.parse(await readFile(join(directory, "package.json"), "utf8"));+ if (includeOwnNotice) await collect(directory, `${metadata.name}@${metadata.version}`);+ const resolver = createRequire(join(directory, "package.json"));+ for (const name of Object.keys({ ...metadata.dependencies, ...metadata.peerDependencies }).sort()) {+ for (const modules of resolver.resolve.paths(name) ?? []) {+ const candidate = join(modules, name);+ try { await readFile(join(candidate, "package.json")); }+ catch (error) { if ((error as NodeJS.ErrnoException).code === "ENOENT") continue; throw error; }+ await visit(candidate);+ break;+ }+ }+}+await visit(join(root, "aetheris.client"), false);+await visit(join(root, "Aetheris.Web.Runtime/telos"));+const assets = JSON.parse(await readFile(assetsPath, "utf8"));+for (const [identity, library] of Object.entries(assets.libraries) as [string, { type: string; path: string }][]) {+ if (library.type !== "package") continue;+ const directory = join(Object.keys(assets.packageFolders)[0], library.path);+ await collect(directory, `nuget-${identity}`);+ const nuspec = (await readdir(directory)).find(name => name.endsWith(".nuspec"));+ if (nuspec) {+ const target = join(output, `nuget-${identity}`.replace(/[^\w.-]/g,"_"));+ await copyFile(join(directory, nuspec), join(target, nuspec));+ const metadata = await readFile(join(directory, nuspec), "utf8");+ if (!(await readdir(target)).some(name => /^(license|licence|copying)([.-]|$)/i.test(name))) {+ const repository = metadata.match(/<repository[^>]*url="https:\/\/github.com\/([^"\s]+)"[^>]*commit="([0-9a-f]+)"/);+ let found = await supplemental(identity, target);+ if (!found && repository) {+ const key = repository[1].replace(/\.git$/, "") + "/" + repository[2];+ let license = fetched.get(key);+ if (!license) {+ for (const name of ["LICENSE", "LICENSE.txt", "LICENSE.TXT", "LICENSE.md", "License.txt"]) {+ const url = `https://raw.githubusercontent.com/${key}/${name}`;+ const response = await fetch(url);+ if (!response.ok) continue;+ license = await response.text();+ fetched.set(key, license);+ await writeFile(join(target, "UPSTREAM-LICENSE-SOURCE.txt"), url + "\n");+ break;+ }+ }+ if (license) { await writeFile(join(target, "LICENSE.txt"), license); found = true; }+ }+ if (!found) unresolved.push(identity + ": no supplied license text or resolvable pinned source license");+ }+ }+}+await writeFile(join(output, "INDEX.txt"), notices.sort().join("\n"));+await writeFile(join(output, "AUDIT.json"), JSON.stringify({ redistributionNoticesComplete: unresolved.length === 0, unresolved }, null, 2));+if (unresolved.length) process.stderr.write("Release notice audit incomplete:\n" + unresolved.join("\n") + "\n");diff --git a/scripts/inspect-cadmata-portable.mts b/scripts/inspect-cadmata-portable.mtsnew file mode 100644index 00000000..e13b2e6e--- /dev/null+++ b/scripts/inspect-cadmata-portable.mts@@ -0,0 +1,14 @@+import { resolve, join } from "node:path";+import { pathToFileURL } from "node:url";+import { mkdir, writeFile } from "node:fs/promises";+const [modulePath, output] = process.argv.slice(2).map(path => resolve(path));+const { chromium } = await import(pathToFileURL(modulePath).href);+const browser = await chromium.connectOverCDP("http://127.0.0.1:9237");+try {+ await mkdir(output, { recursive: true });+ const page = browser.contexts()[0].pages()[0];+ await page.screenshot({ path: join(output, "packaged-diagnostic.png") });+ await writeFile(join(output, "packaged-page.txt"), await page.locator("body").innerText());+ const session = await browser.newBrowserCDPSession();+ await writeFile(join(output, "gpu-info.json"), JSON.stringify(await session.send("SystemInfo.getInfo"), null, 2));+} finally { await browser.close(); }diff --git a/scripts/package-cadmata-preview4.ps1 b/scripts/package-cadmata-preview4.ps1new file mode 100644index 00000000..800b6bf8--- /dev/null+++ b/scripts/package-cadmata-preview4.ps1@@ -0,0 +1,131 @@+[CmdletBinding()]+param(+ [string]$OutputDirectory = 'artifacts/local/cadmata-distribution/release',+ [string]$WebViewCab,+ [string]$SourceRevision+)+$ErrorActionPreference = 'Stop'+$PSNativeCommandUseErrorActionPreference = $true+$repoRoot = Split-Path -Parent $PSScriptRoot+$output = [IO.Path]::GetFullPath((Join-Path $repoRoot $OutputDirectory))+$repoPrefix = [IO.Path]::GetFullPath($repoRoot).TrimEnd('\') + '\'+if (-not $output.StartsWith($repoPrefix, [StringComparison]::OrdinalIgnoreCase)) {+ throw 'Package output must be inside the working repository.'+}+$stage = Join-Path $output 'package'+if (Test-Path -LiteralPath $stage) { Remove-Item -LiteralPath $stage -Recurse -Force }+New-Item -ItemType Directory -Force $stage | Out-Null+if (-not $SourceRevision) { $SourceRevision = (git -C $repoRoot rev-parse HEAD).Trim() }+$dirty = if (Test-Path (Join-Path $repoRoot '.git')) { [bool](git -C $repoRoot status --porcelain) } else { $true }+$version = '2.0.0-preview.4'+$identity = "$version+$SourceRevision" + $(if ($dirty) { '.modified' } else { '' })++# Fixed distribution: no runtime detection, installed Edge dependency or bootstrap.+$runtimeVersion = '153.0.4234.48'+$runtimeUrl = 'https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/08cd33ee-d109-49b8-9301-9f0bea43c575/Microsoft.WebView2.FixedVersionRuntime.153.0.4234.48.x64.cab'+$runtimeHash = '11E8240CB0BC56DCD3E4498907203C251346F65107FE35A3A13E152C7D51C79E'+if (-not $WebViewCab) {+ $WebViewCab = Join-Path $output 'webview2-x64.cab'+ if (-not (Test-Path -LiteralPath $WebViewCab)) { Invoke-WebRequest $runtimeUrl -OutFile $WebViewCab }+}+$WebViewCab = [IO.Path]::GetFullPath($WebViewCab)+if ((Get-FileHash $WebViewCab -Algorithm SHA256).Hash -ne $runtimeHash) { throw 'Fixed WebView2 CAB hash mismatch.' }+$expanded = Join-Path $output 'runtime-expanded'+if (Test-Path -LiteralPath $expanded) { Remove-Item -LiteralPath $expanded -Recurse -Force }+New-Item -ItemType Directory -Force $expanded | Out-Null+expand.exe $WebViewCab '-F:*' $expanded > (Join-Path $output 'runtime-expansion.log')++# Build every asset from source, including Telos's standalone WGSL files.+Push-Location (Join-Path $repoRoot 'Aetheris.Web.Runtime/telos')+try { npm ci; npm run build } finally { Pop-Location }+Push-Location (Join-Path $repoRoot 'aetheris.client')+try {+ tspack sync --root $repoRoot+ # Materialize the explicitly declared repository-owned source dependency.+ # The locked third-party graph stays unchanged; no registry update occurs.+ $scope = Join-Path $repoRoot 'node_modules/@aetheris'+ New-Item -ItemType Directory -Force $scope | Out-Null+ $telosLink = Join-Path $scope 'three-telos'+ if (-not (Test-Path -LiteralPath $telosLink)) {+ New-Item -ItemType Junction -Path $telosLink -Target (Join-Path $repoRoot 'Aetheris.Web.Runtime/telos') | Out-Null+ }+ # A stale package-local installation must not shadow the workspace graph.+ $clientModules = Join-Path $repoRoot 'aetheris.client/node_modules'+ if (Test-Path -LiteralPath $clientModules) {+ $existing = Get-Item -LiteralPath $clientModules+ if ($existing.LinkType -ne 'Junction' -or $existing.Target -ne (Join-Path $repoRoot 'node_modules')) {+ $backup = Join-Path $output ('previous-client-modules-' + [Guid]::NewGuid().ToString('N'))+ if (-not $clientModules.StartsWith($repoPrefix) -or -not $backup.StartsWith($repoPrefix)) { throw 'Unsafe dependency move path.' }+ Move-Item -LiteralPath $clientModules -Destination $backup+ }+ }+ if (-not (Test-Path -LiteralPath $clientModules)) {+ New-Item -ItemType Junction -Path $clientModules -Target (Join-Path $repoRoot 'node_modules') | Out-Null+ }+ tspack check --root $repoRoot+ tspack run typecheck --root $repoRoot+ tspack run build --root $repoRoot+} finally { Pop-Location }+dotnet publish (Join-Path $repoRoot 'Aetheris.Cadmata.Desktop/Aetheris.Cadmata.Desktop.csproj') `+ -c Release -r win-x64 --self-contained true -m:1 -t:Rebuild `+ --artifacts-path (Join-Path $output 'build') `+ -p:Version=$version -p:InformationalVersion=$identity -p:IncludeSourceRevisionInInformationalVersion=false `+ -p:DebugType=None -p:DebugSymbols=false -o $stage+Move-Item -LiteralPath (Join-Path $stage 'Cadmata.Desktop.exe') -Destination (Join-Path $stage 'Cadmata.exe') -Force+Copy-Item -LiteralPath (Join-Path $repoRoot 'aetheris.client/dist') -Destination (Join-Path $stage 'wwwroot') -Recurse -Force+# Referenced executable projects publish helper apphosts; no helper is needed.+foreach ($name in @('Aetheris.Forge.Host.exe', 'Cadmata.staticwebassets.runtime.json')) {+ Remove-Item -LiteralPath (Join-Path $stage $name) -Force -ErrorAction SilentlyContinue+}+Get-ChildItem $stage -Filter '*.pdb' -Recurse -File | Remove-Item -Force+Copy-Item -LiteralPath (Join-Path $expanded "Microsoft.WebView2.FixedVersionRuntime.$runtimeVersion.x64") -Destination (Join-Path $stage 'webview2') -Recurse+New-Item -ItemType Directory -Force (Join-Path $stage 'samples'), (Join-Path $stage 'licenses') | Out-Null+Copy-Item -LiteralPath (Join-Path $repoRoot 'fixtures/Canonical/Integration/machined-mounting-block.firmament') -Destination (Join-Path $stage 'samples/mounting-block.firmament')+Copy-Item -LiteralPath (Join-Path $repoRoot 'fixtures/Canonical/Basics/cylinder.firmament') -Destination (Join-Path $stage 'samples/cylinder.firmament')+Copy-Item -LiteralPath (Join-Path $repoRoot 'docs/public/cadmata/portable-windows.md') -Destination (Join-Path $stage 'README.md')+Copy-Item -LiteralPath (Join-Path $repoRoot 'LICENSE') -Destination $stage+Copy-Item -LiteralPath (Join-Path $repoRoot 'THIRD_PARTY_NOTICES.md') -Destination $stage+node (Join-Path $repoRoot 'scripts/collect-cadmata-licenses.mts') $repoRoot $stage (Join-Path $output 'build/obj/Aetheris.Cadmata.Desktop/project.assets.json')++if (-not (Test-Path (Join-Path $stage 'wwwroot/index.html'))) { throw 'Production frontend missing.' }+foreach ($shader in @('mesh', 'line')) {+ if (-not (Get-ChildItem (Join-Path $stage 'wwwroot') -Recurse -File -Filter "$shader*.wgsl")) {+ throw "Telos $shader shader missing from production assets."+ }+}+$files = @(Get-ChildItem $stage -Recurse -File | Sort-Object FullName | ForEach-Object {+ $relative = [IO.Path]::GetRelativePath($stage, $_.FullName).Replace('\','/')+ $purpose = if ($relative.StartsWith('webview2/')) { 'Fixed WebView2 browser runtime' }+ elseif ($relative.StartsWith('wwwroot/')) { 'Production frontend and shader assets' }+ elseif ($relative.StartsWith('licenses/') -or $relative -match 'LICENSE|NOTICES|README') { 'Redistribution notice or release instructions' }+ elseif ($relative.StartsWith('samples/')) { 'Bundled authored sample' }+ elseif ($relative -like 'Aetheris*' -or $relative -like 'Cadmata*') { 'Cadmata and existing CAD backend' }+ else { 'Self-contained .NET/ASP.NET/WindowsDesktop runtime or dependency' }+ [PSCustomObject][ordered]@{ path=$relative; bytes=$_.Length; purpose=$purpose; sha256=(Get-FileHash $_.FullName -Algorithm SHA256).Hash }+})+$licenseAudit = Get-Content (Join-Path $stage 'licenses/AUDIT.json') -Raw | ConvertFrom-Json+$metadata = [ordered]@{ version=$version; identity=$identity; sourceRevision=$SourceRevision; modifiedSource=$dirty+ qualificationStatus='Local candidate; acceptance requires packaged qualification and complete redistribution audit'+ redistributionNoticesComplete=$licenseAudit.redistributionNoticesComplete+ source="https://github.com/yuechen-li-dev/Aetheris/tree/$SourceRevision"; webviewVersion=$runtimeVersion+ webviewCabUrl=$runtimeUrl; webviewCabSha256=$runtimeHash; inventoryBytes=($files | Measure-Object bytes -Sum).Sum; files=$files }+$metadata | ConvertTo-Json -Depth 8 | Set-Content (Join-Path $stage 'BUILD-METADATA.json') -Encoding utf8+$zip = Join-Path $output 'Cadmata-Preview4-win-x64.zip'+if (Test-Path -LiteralPath $zip) { Remove-Item -LiteralPath $zip -Force }+Add-Type -AssemblyName System.IO.Compression+$archive = [IO.Compression.ZipFile]::Open($zip, [IO.Compression.ZipArchiveMode]::Create)+try {+ foreach ($file in (Get-ChildItem $stage -File -Recurse | Sort-Object FullName)) {+ $entry = $archive.CreateEntry([IO.Path]::GetRelativePath($stage, $file.FullName).Replace('\','/'), [IO.Compression.CompressionLevel]::Optimal)+ $entry.LastWriteTime = [DateTimeOffset]::new(1980,1,1,0,0,0,[TimeSpan]::Zero)+ $input = [IO.File]::OpenRead($file.FullName)+ $stream = $entry.Open()+ try { $input.CopyTo($stream) } finally { $stream.Dispose(); $input.Dispose() }+ }+} finally { $archive.Dispose() }+$hash = (Get-FileHash $zip -Algorithm SHA256).Hash.ToLowerInvariant()+"$hash Cadmata-Preview4-win-x64.zip" | Set-Content (Join-Path $output 'SHA256SUMS') -Encoding ascii+[ordered]@{zip=$zip; sha256=$hash; packageBytes=(Get-Item $zip).Length;+ extractedBytes=(Get-ChildItem $stage -Recurse -File | Measure-Object Length -Sum).Sum; identity=$identity} |+ ConvertTo-Json | Set-Content (Join-Path $output 'package-summary.json')+Write-Output "Package: $zip ($((Get-Item $zip).Length) bytes), SHA256 $hash"diff --git a/scripts/package-release.ps1 b/scripts/package-release.ps1index 422d7262..165839e8 100644--- a/scripts/package-release.ps1+++ b/scripts/package-release.ps1@@ -105,12 +105,12 @@ try {if (-not (Get-Command tspack -ErrorAction SilentlyContinue)) {throw 'TSPack is required to build Cadmata. Restore the repository build prerequisite; do not substitute an npm lockfile.'}- tspack sync- tspack check- tspack run typecheck- tspack run test- tspack run build- tspack run lint+ tspack sync --root $repoRoot+ tspack check --root $repoRoot+ tspack run typecheck --root $repoRoot+ tspack run test --root $repoRoot+ tspack run build --root $repoRoot+ tspack run lint --root $repoRoot}finally { Pop-Location }diff --git a/scripts/qualify-cadmata-portable.mts b/scripts/qualify-cadmata-portable.mtsnew file mode 100644index 00000000..22419e45--- /dev/null+++ b/scripts/qualify-cadmata-portable.mts@@ -0,0 +1,204 @@+import { spawn, execFile } from "node:child_process";+import { promisify } from "node:util";+import { mkdir, writeFile, readFile, readdir } from "node:fs/promises";+import { createServer } from "node:net";+import { resolve, join } from "node:path";+import { pathToFileURL } from "node:url";+import assert from "node:assert/strict";+import { createHash } from "node:crypto";++// Connect to the actual extracted Windows application's WebView2. Never launch+// a substitute Edge browser, Vite server or source-tree backend.+const [packageDirectory, outputDirectory, playwrightModule, stepFile, startupFile] = process.argv.slice(2).map(path => resolve(path));+const { chromium } = await import(pathToFileURL(playwrightModule).href);+await mkdir(outputDirectory, { recursive: true });+const reservation = createServer();+await new Promise<void>((resolve, reject) => {+ reservation.once("error", reject);+ reservation.listen(0, "127.0.0.1", resolve);+});+const debugPort = Number(process.env.CADMATA_QUALIFICATION_DEBUG_PORT ?? (reservation.address() as { port: number }).port);+await new Promise<void>(resolve => reservation.close(() => resolve()));+const metadata = JSON.parse(await readFile(join(packageDirectory, "BUILD-METADATA.json"), "utf8"));+const executableSha256 = createHash("sha256").update(await readFile(join(packageDirectory, "Cadmata.exe"))).digest("hex");+const started = Date.now();+const app = spawn(join(packageDirectory, "Cadmata.exe"), startupFile ? [startupFile] : [], {+ cwd: process.env.CADMATA_QUALIFICATION_CWD ?? process.env.SystemRoot,+ windowsHide: false, // WinExe has no console; qualify the visible product window.+ env: {+ ...process.env, PATH: join(process.env.SystemRoot!, "System32"),+ DOTNET_ROOT: join(outputDirectory, "no-installed-dotnet"),+ ASPNETCORE_URLS: "http://0.0.0.0:5000", ASPNETCORE_ENVIRONMENT: "Development",+ AETHERIS_CADMATA_PATH: "", AETHERIS_CAD_ASSISTANT_PATH: "",+ WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: `--remote-debugging-port=${debugPort}`,+ },+});+assert(app.pid, "The extracted app must start");+let closed = false;+app.on("exit", () => closed = true);+const report: Record<string, unknown> = { executable: join(packageDirectory, "Cadmata.exe"), pid: app.pid,+ qualification: "automated actual packaged WebView2 session; not a human manual session",+ guards: ["System32-only application PATH", "unrelated CWD", "fresh browser profile", "external web requests blocked by desktop host"], };+report.package = { identity: metadata.identity, webviewVersion: metadata.webviewVersion,+ executableSha256 };+let browser;+try {+ for (let attempt = 0; ; attempt++) {+ try { await fetch(`http://127.0.0.1:${debugPort}/json/version`); break; }+ catch {+ assert(!closed, "Cadmata exited before WebView2 became ready");+ if (attempt > 180) throw new Error("Packaged WebView2 did not become ready within 45 seconds");+ await new Promise(resolve => setTimeout(resolve, 250));+ }+ }+ browser = await chromium.connectOverCDP(`http://127.0.0.1:${debugPort}`);+ const context = browser.contexts()[0];+ const page = context.pages()[0] ?? await context.waitForEvent("page");+ page.setDefaultTimeout(45000);+ page.setDefaultNavigationTimeout(45000);+ const errors: string[] = [];+ const requests: string[] = [];+ const shaders: string[] = [];+ page.on("pageerror", (error: Error) => errors.push(String(error)));+ page.on("request", (request: { url(): string }) => requests.push(request.url()));+ page.on("response", async (response: { url(): string; json(): Promise<unknown> }) => {+ if (response.url().includes("/assembly/") || response.url().endsWith("/assemblies/display"))+ await writeFile(join(outputDirectory, "authored-display.json"), JSON.stringify(await response.json(), null, 2));+ if (response.url().includes(".wgsl")) shaders.push(response.url());+ });+ await page.waitForURL(/http:\/\/127\.0\.0\.1:\d+\/$/, { timeout: 45000 });+ const address = new URL(page.url()).origin;+ const logs = join(process.env.LOCALAPPDATA!, "Aetheris/Cadmata/logs");+ const logFile = (await readdir(logs)).find(file => file.endsWith(`-${app.pid}.log`));+ assert(logFile, "This app's PID-specific diagnostic log must exist");+ assert((await readFile(join(logs, logFile), "utf8")).includes("backend ready " + address),+ "Debug connection must belong to this newly spawned application before any UI actions");+ report.diagnosticLog = join(logs, logFile);+ report.unauthenticatedStatus = (await fetch(address + "/api/v1/startup/step", { method: "POST" })).status;+ assert.equal(report.unauthenticatedStatus, 403);+ await page.locator('[aria-label="Assembly product tree"] button').first().waitFor({ timeout: 45000 });+ await page.waitForFunction(() => document.querySelector('[data-display-host="three-telos"]')?.getAttribute("aria-busy") === "false");+ report.sampleVisibleMs = Date.now() - started;+ report.gpu = await page.evaluate(async () => {+ const adapter = await navigator.gpu?.requestAdapter();+ return { available: !!adapter, vendor: adapter?.info.vendor, architecture: adapter?.info.architecture, description: adapter?.info.description };+ });+ assert((report.gpu as { available: boolean }).available, "Bundled WebView2 must expose WebGPU");+ await page.waitForFunction(() => {+ const display = JSON.parse(document.querySelector("canvas")?.getAttribute("data-telos-display") ?? "{}");+ return display.meshSurfaces > 0 || display.fields > 0;+ }, undefined, { timeout: 30000 });+ report.directCirFieldDraws = await page.locator("canvas").getAttribute("data-telos-field-draws");+ report.sampleDisplay = JSON.parse(await page.locator("canvas").getAttribute("data-telos-display") ?? "{}");+ if (startupFile) assert(Number(report.directCirFieldDraws) > 0, "Qualified cylinder must draw direct CIR");+ const canvas = page.getByLabel("Engineering WebGPU viewport");+ const box = await canvas.boundingBox();+ assert(box);+ await page.screenshot({ path: join(outputDirectory, "packaged-sample.png") });+ const before = await canvas.screenshot();+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);+ await page.mouse.down();+ await page.mouse.move(box.x + box.width / 2 + 70, box.y + box.height / 2 + 25, { steps: 12 });+ await page.mouse.up();+ await page.waitForTimeout(200);+ assert(!before.equals(await canvas.screenshot()), "Orbit must change the rendered view");+ await page.mouse.down({ button: "right" });+ await page.mouse.move(box.x + box.width / 2 + 100, box.y + box.height / 2 + 40, { steps: 6 });+ await page.mouse.up({ button: "right" });+ await page.mouse.wheel(0, -130);+ await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);+ await page.locator('[aria-label="Assembly product tree"] .active-row').waitFor();+ await page.screenshot({ path: join(outputDirectory, "packaged-orbit-selection.png") });+ report.navigationAndSelection = true;+ await page.locator('input[type="file"]').setInputFiles(stepFile);+ await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();+ await page.getByText("Import complete.", { exact: true }).waitFor({ timeout: 120000 });+ const downloadButton = page.getByRole("button", { name: "Download Canonical 242", exact: true });+ await downloadButton.waitFor({ timeout: 120000 });+ await page.waitForFunction(() => {+ const canvas = document.querySelector<HTMLCanvasElement>("canvas");+ return JSON.parse(canvas?.dataset.telosDisplay ?? "{}").meshSurfaces > 0;+ });+ report.meshFallback = JSON.parse(await canvas.getAttribute("data-telos-display") ?? "{}");+ await page.waitForFunction(() => !document.querySelector('[data-display-host="three-telos"][aria-busy="true"]'));+ await page.screenshot({ path: join(outputDirectory, "packaged-step-import.png") });+ assert(!before.equals(await canvas.screenshot()), "External STEP must replace the rendered sample");+ const session = await context.newCDPSession(page);+ await session.send("Browser.setDownloadBehavior", { behavior: "allow", downloadPath: outputDirectory, eventsEnabled: true });+ const downloadEvent = new Promise<string>((resolve) => session.once("Browser.downloadWillBegin", (event: { suggestedFilename: string }) => resolve(event.suggestedFilename)));+ await downloadButton.click();+ const name = await Promise.race([downloadEvent, new Promise<never>((_, reject) => setTimeout(() => reject(new Error("STEP download event missing")), 15000))]);+ const exportedPath = join(outputDirectory, name);+ for (let attempt = 0; ; attempt++) {+ try { assert((await readFile(exportedPath, "utf8")).startsWith("ISO-10303-21;")); break; }+ catch (error) { if (attempt > 60) throw error; await new Promise(resolve => setTimeout(resolve, 250)); }+ }+ report.exportedStep = exportedPath;+ await page.locator('input[type="file"]').setInputFiles(exportedPath);+ await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();+ await page.waitForTimeout(1500);+ assert(await downloadButton.isEnabled());+ // An invalid file must retain the last usable model and visible error.+ await page.locator('input[type="file"]').setInputFiles({ name: "invalid.step", mimeType: "application/step", buffer: Buffer.from("invalid STEP") });+ await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();+ await page.getByText("Import failed", { exact: true }).waitFor();+ assert(await downloadButton.isEnabled());+ report.invalidFilePreservedModel = true;+ report.shaderUrls = shaders;+ report.requests = requests.filter(url => /^https?:/.test(url));+ assert((report.requests as string[]).every(url => new URL(url).origin === address), "Application resources must stay on its loopback origin");+ report.errors = errors;+ assert.equal(errors.length, 0, "No uncaught browser errors");+ await writeFile(join(outputDirectory, "page-text.txt"), await page.locator("body").innerText());+ // Integration-test WM_CLOSE on the owning form, including a window hidden+ // by the CI launcher. CloseMainWindow excludes hidden windows. This exercises+ // FormClosed cleanup, but is not the required human title-bar interaction.+ const closeCommand = `+Add-Type -TypeDefinition @'+using System;+using System.Runtime.InteropServices;+using System.Text;+public static class CadmataQualificationWindow {+ public delegate bool Visitor(IntPtr handle, IntPtr data);+ [DllImport("user32.dll")] public static extern bool EnumWindows(Visitor visitor, IntPtr data);+ [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr handle, out uint process);+ [DllImport("user32.dll", CharSet=CharSet.Unicode)] public static extern int GetWindowText(IntPtr handle, StringBuilder text, int length);+ [DllImport("user32.dll")] public static extern bool PostMessage(IntPtr handle, uint message, IntPtr w, IntPtr l);+}+'@+$closedWindowCount = 0+[CadmataQualificationWindow]::EnumWindows({ param($handle, $data)+ $ownerProcess = 0+ [void][CadmataQualificationWindow]::GetWindowThreadProcessId($handle, [ref]$ownerProcess)+ $windowTitle = [Text.StringBuilder]::new(512)+ [void][CadmataQualificationWindow]::GetWindowText($handle, $windowTitle, 512)+ if ($ownerProcess -eq ${app.pid} -and $windowTitle.ToString().StartsWith('Cadmata')) {+ [void][CadmataQualificationWindow]::PostMessage($handle, 16, [IntPtr]::Zero, [IntPtr]::Zero)+ $script:closedWindowCount+++ }+ return $true+}, [IntPtr]::Zero) | Out-Null+$closedWindowCount+`;+ const close = await promisify(execFile)(join(process.env.SystemRoot!, "System32/WindowsPowerShell/v1.0/powershell.exe"),+ ["-NoProfile", "-Command", closeCommand], { windowsHide: true });+ report.closeWindowCount = Number(close.stdout.trim());+ assert(Number(report.closeWindowCount) > 0, "Owning native window must receive WM_CLOSE");+ for (let attempt = 0; !closed && attempt < 80; attempt++) await new Promise(resolve => setTimeout(resolve, 100));+ assert(closed, "Closing the window must terminate the application");+ try { await fetch(address); throw new Error("Local CAD service survived closing the window"); }+ catch (error) { if (String(error).includes("survived")) throw error; }+ report.closeStoppedServer = true;+ report.closeMethod = "automated native WM_CLOSE, not a human title-bar click";+} catch (error) {+ report.failure = String(error);+ if (browser) {+ const page = browser.contexts()[0]?.pages()[0];+ if (page) await page.screenshot({ path: join(outputDirectory, "packaged-failure.png") }).catch(() => {});+ }+ throw error;+} finally {+ await writeFile(join(outputDirectory, "qualification.json"), JSON.stringify(report, null, 2));+ if (browser) await browser.close().catch(() => {});+ if (!closed) app.kill();+}diff --git a/aetheris.client/ts-lock.toml b/ts-lock.tomlsimilarity index 100%rename from aetheris.client/ts-lock.tomlrename to ts-lock.toml