Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(feat) Get Plug-ins: install open-source plugins from the Nota registry

Egor Khindikaynen0b6db03fbb0e
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 98d1211c..b320ad07 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -127,6 +127,21 @@ JUCE is confined to `pluginhost/`, built as a separate static library and reache
dependency at all. VST3 is hosted everywhere; AU is macOS-only. Plugin scanning runs
out-of-process in `nota-scanworker` so a crashing plugin cannot take the app down.
+A plugin is found by its JUCE identifier, `<format>-<name>-<path hash>-<uid>`. When no
+catalog entry matches exactly, the lookup falls back to format + name + uid, so a project
+still finds a plugin that lives at another path on this machine.
+
+**Get Plug-ins** (`IPluginStore` → `Infrastructure/PluginStore/`) installs open-source VST3
+plugins listed in the [plugin registry](https://github.com/nota-daw/nota-plugins-registry).
+The registry is one static `index.json` on GitHub Pages, and the repo's README documents its
+manifest. A release asset downloads straight from the plugin's GitHub release and must
+match the size and sha256 pinned in the index. `ArchiveUnpacker` then unpacks it:
+zip / tar / dmg / pkg-payload / deb, and no installer ever runs. The listed bundles are
+copied into `<data>/plugins/VST3/<id>/`, which is registered as a scan path. Set
+`NOTA_PLUGIN_REGISTRY` to point Nota at another index (a URL or a local file). Set
+`NOTA_DATA_DIR` to relocate the data dir, including the native catalog and scan paths, for
+tests.
+
This module is also the reason Nota's open build is AGPL — see
[`LICENSES/README.md`](LICENSES/README.md#why-agpl-and-not-gpl).
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c8154142..115bfc1b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -116,6 +116,20 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
## [Unreleased]
+### Added
+- **Get Plug-ins.** Preferences has a new Get Plug-ins page. It lists open-source VST3
+ plug-ins from the Nota plugin registry, among them Surge XT, Dexed, Dragonfly Reverb,
+ CHOW Tape Model and Stochas. Install, update or remove one with a click and it shows up
+ in the browser. Each plug-in downloads from its own project's GitHub release and is
+ checked against the registry before it's unpacked. Nota never runs an installer.
+- **Opening a project that uses a missing plug-in** now offers to install it when the
+ registry has it, then reopens the project with the plug-in and its saved settings.
+
+### Fixed
+- A project now finds its plug-ins even when they're installed in a different folder than on
+ the computer that saved it. Before, such a plug-in counted as missing.
+- Rescanning plug-ins removes VST3 plug-ins that were deleted from disk from the browser.
+
### Changed
- VST3 and AU plug-ins get a proper device card with two sizes. The header names the
plug-in. The small card shows its vendor, format, parameter count and latency, with
diff --git a/FEATURES.md b/FEATURES.md
index b11e5699..76f95fcf 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -617,6 +617,10 @@ and user presets, automation, persistence and cloning.
- **AU** (macOS) and **VST3** (all platforms) — instruments and effects.
- **Scanning** and a catalogue of installed plugins (a separate `nota-scanworker`), scan
paths in Preferences, and Rescan.
+- **Get Plug-ins** — open-source VST3 plugins from the
+ [Nota plugin registry](https://github.com/nota-daw/nota-plugins-registry), installed,
+ updated and removed from Preferences (checksum-verified; archives only, installers never
+ run). A project that needs a missing registry plugin offers to install it.
- **Loading** into a track or rack chain, with the plugin's **native GUI** (an editor
window that opens on top and focused, and closes when the device is removed).
- **State save and restore** in the project, and **bypass**.
diff --git a/src/managed/Nota.App/App.axaml.cs b/src/managed/Nota.App/App.axaml.cs
index 9202ad24..2af1b4f2 100644
--- a/src/managed/Nota.App/App.axaml.cs
+++ b/src/managed/Nota.App/App.axaml.cs
@@ -35,6 +35,7 @@ public partial class App : Avalonia.Application
services.AddSingleton<ILogSink, LogSink>();
services.AddSingleton<ISettingsService, SettingsService>();
services.AddSingleton<IPluginCatalog, PluginCatalog>();
+ services.AddSingleton<IPluginStore, PluginStore>();
services.AddSingleton<IPresetLibrary, PresetLibrary>();
services.AddSingleton<IProjectStore, ProjectStore>();
services.AddSingleton<IPresetStore, PresetStore>();
@@ -79,6 +80,10 @@ public partial class App : Avalonia.Application
// paints so nothing flashes graphite on the way to paper.
NotaThemeService.Set(Services.GetRequiredService<ISettingsService>().Current.Theme);
+ // Plugins installed from the registry (Preferences → Get Plug-ins) live in their own folder.
+ try { PluginScan.EnsureStoreScanPath(Services.GetRequiredService<IPluginCatalog>(), Services.GetRequiredService<IPluginStore>()); }
+ catch (Exception e) { log.Error("Couldn't register the Get Plug-ins folder", e); }
+
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
// Show the splash immediately, then defer the heavy engine spin-up to a
diff --git a/src/managed/Nota.App/MainWindow.Files.cs b/src/managed/Nota.App/MainWindow.Files.cs
index be9c6347..7a844137 100644
--- a/src/managed/Nota.App/MainWindow.Files.cs
+++ b/src/managed/Nota.App/MainWindow.Files.cs
@@ -245,6 +245,7 @@ public partial class MainWindow
? $"Opened {System.IO.Path.GetFileName(dir)}"
: $"Opened {System.IO.Path.GetFileName(dir)} — {warnings.Count} item(s) downgraded: {warnings[0]}";
_ = BuildWarpCachesAsync(); // fill the deferred warp caches in the background
+ _ = OfferMissingPluginsAsync(dir, result.MissingPlugins);
}
catch (Exception ex)
{
diff --git a/src/managed/Nota.App/MainWindow.MissingPlugins.cs b/src/managed/Nota.App/MainWindow.MissingPlugins.cs
new file mode 100644
index 00000000..f4d4e5d1
--- /dev/null
+++ b/src/managed/Nota.App/MainWindow.MissingPlugins.cs
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// After a project opens with hosted plugins that aren't installed, offer the ones the
+// Nota plugin registry provides: install them (Get Plug-ins), rescan, and reopen the
+// project so the devices come back with their saved state. Silent when offline or when
+// the registry has none of them — the status bar already reports what was skipped.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
+using Nota.Application;
+
+namespace Nota.App;
+
+public partial class MainWindow
+{
+ private async Task OfferMissingPluginsAsync(string dir, IReadOnlyList<string> missing)
+ {
+ if (_vm is null || missing.Count == 0) return;
+ var store = App.Services.GetRequiredService<IPluginStore>();
+ try { await store.FetchAsync(); }
+ catch (PluginStoreException) { return; }
+
+ var offers = missing.Select(store.FindProvider).OfType<StorePlugin>()
+ .Where(p => p.Asset is not null).DistinctBy(p => p.Id)
+ // Already installed yet still unresolved (the scan didn't match it): reinstalling won't help.
+ .Where(p => !store.Installed.Any(i => i.Id == p.Id && i.Version == p.Version))
+ .ToList();
+ if (offers.Count == 0 || _projectPath != dir) return;
+
+ bool one = offers.Count == 1;
+ var names = string.Join(", ", offers.Select(p => p.Name));
+ var ok = await new ConfirmWindow("Missing plugins",
+ $"This project uses {names}, which {(one ? "isn't" : "aren't")} installed. " +
+ $"{(one ? "It's" : "They're")} open source and available from the Nota plugin registry. " +
+ "Install and reopen the project?",
+ "Install", "Not now").ShowDialog<bool>(this);
+ if (!ok || _vm is null) return;
+
+ string? error = null;
+ await RunBackgroundAsync("Installing plugins…", async prog =>
+ {
+ foreach (var p in offers)
+ {
+ try
+ {
+ await store.InstallAsync(p, new Progress<StoreProgress>(r =>
+ prog.Report(r.Fraction < 0 ? ProgressReport.Indeterminate(r.Message) : ProgressReport.At(r.Fraction, r.Message))));
+ }
+ catch (PluginStoreException e) { error ??= e.Message; }
+ }
+ prog.Report(ProgressReport.Indeterminate("Scanning plugins…"));
+ await PluginScan.RescanAsync(_vm);
+ });
+
+ if (error is not null) { _vm.StatusText = error; return; }
+ // Reopen only when that's lossless: same project, nothing edited since it opened.
+ if (_projectPath == dir && !HasUnsavedChanges()) OpenProject(dir);
+ else _vm.StatusText = $"Installed {names} — reopen the project to use {(one ? "it" : "them")}.";
+ }
+}
diff --git a/src/managed/Nota.App/PluginScan.cs b/src/managed/Nota.App/PluginScan.cs
new file mode 100644
index 00000000..a6a2d278
--- /dev/null
+++ b/src/managed/Nota.App/PluginScan.cs
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Plugin rescans shared by Preferences (Rescan, Get Plug-ins) and the open-project
+// "install missing plugins" offer. The scan runs out-of-process in nota-scanworker,
+// shipped beside the app; the native catalog tolerates a scan off the UI thread.
+
+using System;
+using System.IO;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
+using Nota.Application;
+using Nota.Presentation;
+
+namespace Nota.App;
+
+internal static class PluginScan
+{
+ /// <summary>The bundled scan worker, or null when it isn't beside the app.</summary>
+ public static string? WorkerPath
+ {
+ get
+ {
+ var name = OperatingSystem.IsWindows() ? "nota-scanworker.exe" : "nota-scanworker";
+ var path = Path.Combine(AppContext.BaseDirectory, name);
+ return File.Exists(path) ? path : null;
+ }
+ }
+
+ /// <summary>Makes the Get Plug-ins folder a scan path (once; persisted by the catalog).</summary>
+ public static void EnsureStoreScanPath(IPluginCatalog catalog, IPluginStore store)
+ {
+ for (int i = 0; i < catalog.ScanPathCount; i++)
+ if (string.Equals(catalog.ScanPath(i), store.PluginsDir, StringComparison.Ordinal)) return;
+ catalog.AddScanPath(store.PluginsDir);
+ }
+
+ /// <summary>Rescans off the UI thread, then rebuilds the browser lists. Returns the number
+ /// of known plugins, or null when the scan worker is missing.</summary>
+ public static async Task<int?> RescanAsync(MainWindowViewModel main)
+ {
+ if (WorkerPath is not { } worker) return null;
+ var catalog = App.Services.GetRequiredService<IPluginCatalog>();
+ int n = await Task.Run(() => catalog.Scan(worker));
+ main.Browser.Rebuild();
+ return n;
+ }
+}
diff --git a/src/managed/Nota.App/PreferencesWindow.Store.cs b/src/managed/Nota.App/PreferencesWindow.Store.cs
new file mode 100644
index 00000000..498a918b
--- /dev/null
+++ b/src/managed/Nota.App/PreferencesWindow.Store.cs
@@ -0,0 +1,291 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Preferences → Get Plug-ins: browse the Nota plugin registry and install / update /
+// remove open-source VST3 plugins (IPluginStore). One install at a time; it keeps
+// running when the user switches panes and is cancelled when the window closes. After
+// every change the catalog is rescanned so the browser lists the new plugins.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Layout;
+using Avalonia.Media;
+using Avalonia.Threading;
+using Microsoft.Extensions.DependencyInjection;
+using Nota.Application;
+
+namespace Nota.App;
+
+public sealed partial class PreferencesWindow
+{
+ private static readonly string[] StoreFilters = { "All", "Instruments", "Effects", "Installed" };
+
+ private readonly IPluginStore _store = App.Services.GetRequiredService<IPluginStore>();
+ private IReadOnlyList<StorePlugin>? _storePlugins;
+ private int _storeFilter;
+ private string _storeSearch = "";
+ private string? _storeBusyId; // plugin being installed / removed
+ private StoreProgress _storeProgress;
+ private string? _storeMessage; // last result or error, shown under the toolbar
+ private CancellationTokenSource? _storeCts;
+ private StackPanel? _storeList; // null while another pane is showing
+ private TextBlock? _storeStatus;
+ private ProgressBar? _storeBar;
+
+ private Control StorePane()
+ {
+ var body = new StackPanel { Spacing = 10 };
+ body.Children.Add(SectionLabel("GET PLUG-INS"));
+ body.Children.Add(Caption("Open-source VST3 plugins from the Nota plugin registry. Each one downloads from the project's own GitHub release, is checked against the registry's checksum and unpacked — installers never run."));
+
+ var strip = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 2 };
+ var segs = new List<Avalonia.Controls.Primitives.ToggleButton>();
+ for (int i = 0; i < StoreFilters.Length; i++)
+ {
+ int idx = i;
+ var b = new Avalonia.Controls.Primitives.ToggleButton { Content = StoreFilters[i], Classes = { "seg" }, IsChecked = i == _storeFilter };
+ b.Click += (_, _) =>
+ {
+ for (int k = 0; k < segs.Count; k++) segs[k].IsChecked = k == idx;
+ _storeFilter = idx;
+ RenderStoreList();
+ };
+ segs.Add(b);
+ strip.Children.Add(b);
+ }
+ var search = new TextBox { PlaceholderText = "Search", Text = _storeSearch, Width = 160, Classes = { "search" }, VerticalAlignment = VerticalAlignment.Center };
+ search.TextChanged += (_, _) => { _storeSearch = search.Text ?? ""; RenderStoreList(); };
+ var refresh = new Button { Content = "Refresh", Classes = { "ghost" } };
+ ToolTip.SetTip(refresh, "Reload the registry");
+ refresh.Click += (_, _) => _ = LoadStoreAsync(refresh: true);
+
+ var toolbar = new DockPanel { LastChildFill = false };
+ DockPanel.SetDock(strip, Dock.Left);
+ toolbar.Children.Add(new Border { Classes = { "segmented" }, Child = strip });
+ var right = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { search, refresh } };
+ DockPanel.SetDock(right, Dock.Right);
+ toolbar.Children.Add(right);
+ body.Children.Add(toolbar);
+
+ _storeStatus = Caption("");
+ _storeBar = new ProgressBar { Minimum = 0, Maximum = 1, Height = 4, IsVisible = false };
+ body.Children.Add(_storeStatus);
+ body.Children.Add(_storeBar);
+
+ _storeList = new StackPanel { Spacing = 6 };
+ body.Children.Add(_storeList);
+ body.Children.Add(Caption($"Installed to {_store.PluginsDir}"));
+
+ body.DetachedFromVisualTree += (_, _) => { _storeList = null; _storeStatus = null; _storeBar = null; };
+ if (_storePlugins is null) _ = LoadStoreAsync(refresh: false);
+ else RenderStoreList();
+ return body;
+ }
+
+ private async Task LoadStoreAsync(bool refresh)
+ {
+ _storeMessage = "Loading the plugin registry…";
+ RenderStoreList();
+ try
+ {
+ _storePlugins = await _store.FetchAsync(refresh);
+ _storeMessage = null;
+ }
+ catch (PluginStoreException e)
+ {
+ _storeMessage = e.Message;
+ }
+ RenderStoreList();
+ }
+
+ private void RenderStoreList()
+ {
+ if (_storeList is null) return;
+ UpdateStoreStatus();
+ _storeList.Children.Clear();
+ if (_storePlugins is null) return;
+
+ var installed = _store.Installed.ToDictionary(i => i.Id);
+ var q = _storeSearch.Trim();
+ var shown = _storePlugins.Where(p => _storeFilter switch
+ {
+ 1 => p.Kind is "instrument",
+ 2 => p.Kind is "effect" or "midi" or "bundle",
+ 3 => installed.ContainsKey(p.Id),
+ _ => true,
+ })
+ .Where(p => q.Length == 0
+ || p.Name.Contains(q, StringComparison.OrdinalIgnoreCase)
+ || p.Developer.Contains(q, StringComparison.OrdinalIgnoreCase)
+ || p.Description.Contains(q, StringComparison.OrdinalIgnoreCase)
+ || p.Tags.Any(t => t.Contains(q, StringComparison.OrdinalIgnoreCase)))
+ .ToList();
+
+ if (shown.Count == 0)
+ {
+ _storeList.Children.Add(Caption(_storeFilter == 3 && q.Length == 0 ? "Nothing installed from the registry yet." : "No plugins match."));
+ return;
+ }
+ foreach (var p in shown)
+ _storeList.Children.Add(StoreRow(p, installed.GetValueOrDefault(p.Id)));
+ }
+
+ private void UpdateStoreStatus()
+ {
+ if (_storeStatus is null || _storeBar is null) return;
+ bool busy = _storeBusyId is not null;
+ _storeStatus.Text = busy ? _storeProgress.Message : _storeMessage ?? "";
+ _storeStatus.IsVisible = _storeStatus.Text.Length > 0;
+ _storeBar.IsVisible = busy;
+ _storeBar.IsIndeterminate = busy && _storeProgress.Fraction < 0;
+ if (busy && _storeProgress.Fraction >= 0) _storeBar.Value = _storeProgress.Fraction;
+ }
+
+ private Control StoreRow(StorePlugin p, InstalledStorePlugin? inst)
+ {
+ var name = new TextBlock { Text = p.Name, FontSize = 12, FontWeight = FontWeight.SemiBold, Foreground = TextPrimary };
+ var kind = new TextBlock
+ {
+ Text = KindLabel(p.Kind), FontSize = 9, FontFamily = NotaFonts.MonoFamily, Foreground = TextTertiary,
+ VerticalAlignment = VerticalAlignment.Center,
+ };
+ var meta = new TextBlock
+ {
+ Text = $"{p.Developer} · {p.Version} · {p.License}",
+ FontSize = 10, Foreground = TextTertiary,
+ };
+ var text = new StackPanel
+ {
+ Spacing = 3,
+ Children =
+ {
+ new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { name, kind } },
+ meta,
+ new TextBlock { Text = p.Description, FontSize = 11, Foreground = TextSecondary, TextWrapping = TextWrapping.Wrap },
+ },
+ };
+ if (p.Notes is { Length: > 0 } notes)
+ text.Children.Add(new TextBlock { Text = notes, FontSize = 10, Foreground = NotaPalette.TextMuted, TextWrapping = TextWrapping.Wrap });
+
+ var actions = new StackPanel { Spacing = 6, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top };
+ bool busy = _storeBusyId is not null;
+ if (_storeBusyId == p.Id)
+ {
+ actions.Children.Add(Caption("Working…"));
+ }
+ else if (p.Asset is null)
+ {
+ actions.Children.Add(new TextBlock { Text = "Not available for this computer", FontSize = 10, Foreground = TextTertiary, TextWrapping = TextWrapping.Wrap, Width = 110, TextAlignment = TextAlignment.Right });
+ }
+ else if (inst is null)
+ {
+ actions.Children.Add(StoreButton("Install", ghost: false, enabled: !busy, () => InstallFromStore(p)));
+ }
+ else
+ {
+ if (inst.Version != p.Version)
+ actions.Children.Add(StoreButton($"Update to {p.Version}", ghost: false, enabled: !busy, () => InstallFromStore(p)));
+ else
+ actions.Children.Add(new TextBlock { Text = "Installed", FontSize = 10, Foreground = AccentBright, HorizontalAlignment = HorizontalAlignment.Right });
+ actions.Children.Add(StoreButton("Remove", ghost: true, enabled: !busy, () => RemoveFromStore(p)));
+ }
+ var source = StoreButton("Source", ghost: true, enabled: true, () => _ = Launcher.LaunchUriAsync(new Uri(p.Repo)));
+ ToolTip.SetTip(source, "Open the source repository");
+ actions.Children.Add(source);
+
+ var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,Auto"), ColumnSpacing = 12 };
+ grid.Children.Add(text);
+ Grid.SetColumn(actions, 1);
+ grid.Children.Add(actions);
+ return new Border
+ {
+ Background = Raised, BorderBrush = Divider, BorderThickness = new Thickness(1),
+ CornerRadius = NotaRadius.Tile, Padding = new Thickness(12, 10), Child = grid,
+ };
+ }
+
+ // Rows use raised buttons for actions and ghost for secondary links: a list of solid brass
+ // Install buttons would break "one primary action per context".
+ private static Button StoreButton(string label, bool ghost, bool enabled, Action onClick)
+ {
+ var b = new Button { Content = label, IsEnabled = enabled, HorizontalAlignment = HorizontalAlignment.Right };
+ if (ghost) b.Classes.Add("ghost");
+ b.Click += (_, _) => onClick();
+ return b;
+ }
+
+ private static string KindLabel(string kind) => kind switch
+ {
+ "instrument" => "INSTRUMENT",
+ "effect" => "EFFECT",
+ "midi" => "MIDI",
+ "bundle" => "COLLECTION",
+ _ => kind.ToUpperInvariant(),
+ };
+
+ private async void InstallFromStore(StorePlugin p)
+ {
+ if (_storeBusyId is not null) return;
+ _storeBusyId = p.Id;
+ _storeProgress = new StoreProgress(0, $"Downloading {p.Name}…");
+ _storeCts ??= new CancellationTokenSource();
+ RenderStoreList();
+ var progress = new Progress<StoreProgress>(r => { _storeProgress = r; UpdateStoreStatus(); });
+ try
+ {
+ await _store.InstallAsync(p, progress, _storeCts.Token);
+ _storeProgress = new StoreProgress(-1, $"Scanning {p.Name}…");
+ UpdateStoreStatus();
+ _storeMessage = await RescanAfterStoreChange() ? $"{p.Name} {p.Version} is installed — find it in the browser." : $"{p.Name} is installed. Rescan plugins to use it.";
+ }
+ catch (PluginStoreException e) { _storeMessage = e.Message; }
+ catch (OperationCanceledException) { _storeMessage = null; }
+ catch (Exception e)
+ {
+ App.Services.GetRequiredService<ILogSink>().Error($"Installing {p.Id} failed", e);
+ _storeMessage = $"Installing {p.Name} failed: {e.Message}";
+ }
+ finally { _storeBusyId = null; }
+ RenderStoreList();
+ }
+
+ private async void RemoveFromStore(StorePlugin p)
+ {
+ if (_storeBusyId is not null) return;
+ var ok = await new ConfirmWindow("Remove plugin",
+ $"Remove {p.Name}? Projects that use it will load without it until it's installed again.",
+ "Remove", "Cancel").ShowDialog<bool>(this);
+ if (!ok) return;
+ _storeBusyId = p.Id;
+ _storeProgress = new StoreProgress(-1, $"Removing {p.Name}…");
+ RenderStoreList();
+ try
+ {
+ _store.Uninstall(p.Id);
+ await RescanAfterStoreChange();
+ _storeMessage = $"{p.Name} was removed.";
+ }
+ catch (PluginStoreException e) { _storeMessage = e.Message; }
+ finally { _storeBusyId = null; }
+ RenderStoreList();
+ }
+
+ private async Task<bool> RescanAfterStoreChange()
+ {
+ if (_main is null) return false;
+ return await PluginScan.RescanAsync(_main) is not null;
+ }
+
+ // Called from the constructor's Closed handler chain: stop a running download.
+ private void CancelStoreWork()
+ {
+ _storeCts?.Cancel();
+ _storeCts?.Dispose();
+ _storeCts = null;
+ }
+}
diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.cs
index 8d0e8194..0db1cfd5 100644
--- a/src/managed/Nota.App/PreferencesWindow.cs
+++ b/src/managed/Nota.App/PreferencesWindow.cs
@@ -28,7 +28,7 @@ using Nota.Presentation;
namespace Nota.App;
-public sealed class PreferencesWindow : NotaWindow
+public sealed partial class PreferencesWindow : NotaWindow
{
private static readonly IBrush Panel = NotaPalette.SurfaceCard;
private static readonly IBrush Sidebar = NotaPalette.SurfaceInset;
@@ -45,7 +45,7 @@ public sealed class PreferencesWindow : NotaWindow
private static readonly IBrush TextSecondary = NotaPalette.TextSecondary;
private static readonly IBrush TextTertiary = NotaPalette.TextTertiary;
- private static readonly string[] Sections = { "Audio", "MIDI", "Gamepads", "Plug-ins", "Library", "Appearance", "Shortcuts" };
+ private static readonly string[] Sections = { "Audio", "MIDI", "Gamepads", "Plug-ins", "Get Plug-ins", "Library", "Appearance", "Shortcuts" };
private readonly ObservableCollection<string> _paths = new();
private readonly MainWindowViewModel? _main;
@@ -98,7 +98,7 @@ public sealed class PreferencesWindow : NotaWindow
grid.Children.Add(_content);
SetBody(grid);
- Closed += (_, _) => StopTests();
+ Closed += (_, _) => { StopTests(); CancelStoreWork(); };
Select(0);
}
@@ -123,8 +123,9 @@ public sealed class PreferencesWindow : NotaWindow
1 => MidiPane(),
2 => GamepadsPane(),
3 => PluginsPane(),
- 4 => LibraryPane(),
- 5 => AppearancePane(),
+ 4 => StorePane(),
+ 5 => LibraryPane(),
+ 6 => AppearancePane(),
_ => ShortcutsPane(),
};
@@ -488,14 +489,17 @@ public sealed class PreferencesWindow : NotaWindow
body.Children.Add(SectionLabel("SCAN"));
var rescanStatus = Caption("");
var rescan = new Button { Content = "Rescan plugins" };
- rescan.Click += (_, _) =>
+ rescan.Click += async (_, _) =>
{
if (_main is null) { rescanStatus.Text = "Plugin scanning is unavailable in this window."; return; }
- var workerName = OperatingSystem.IsWindows() ? "nota-scanworker.exe" : "nota-scanworker";
- var worker = System.IO.Path.Combine(AppContext.BaseDirectory, workerName);
- if (!System.IO.File.Exists(worker)) { rescanStatus.Text = "Scanner worker not found."; return; }
- int n = _main.Browser.Scan(worker);
- rescanStatus.Text = $"Found {n} plugin{(n == 1 ? "" : "s")}.";
+ rescan.IsEnabled = false;
+ rescanStatus.Text = "Scanning…";
+ try
+ {
+ int? n = await PluginScan.RescanAsync(_main);
+ rescanStatus.Text = n is { } c ? $"Found {c} plugin{(c == 1 ? "" : "s")}." : "Scanner worker not found.";
+ }
+ finally { rescan.IsEnabled = true; }
};
body.Children.Add(rescan);
body.Children.Add(rescanStatus);
diff --git a/src/managed/Nota.Application/Ports/IPluginStore.cs b/src/managed/Nota.Application/Ports/IPluginStore.cs
new file mode 100644
index 00000000..aa116ce0
--- /dev/null
+++ b/src/managed/Nota.Application/Ports/IPluginStore.cs
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+
+namespace Nota.Application;
+
+/// <summary>A plugin listed in the Nota plugin registry (github.com/nota-daw/nota-plugins-registry),
+/// reduced to what the running platform can install.</summary>
+public sealed record StorePlugin(
+ string Id,
+ string Name,
+ string Developer,
+ string Description,
+ string Kind, // instrument | effect | midi | bundle
+ string License, // SPDX id
+ string Repo, // source repository URL
+ string? Homepage,
+ IReadOnlyList<string> Tags,
+ IReadOnlyList<string> Provides, // VST3 display names, as the plugin scan reports them
+ string Version, // newest registry version
+ StoreAsset? Asset) // null: no build for this platform
+{
+ /// <summary>Optional caveat from the registry (e.g. "factory content is a separate download").</summary>
+ public string? Notes { get; init; }
+}
+
+/// <summary>One downloadable release asset and the VST3 bundles inside it.</summary>
+public sealed record StoreAsset(
+ string Platform, // e.g. macos-universal, windows-x64, linux-x64
+ string Url,
+ string Sha256,
+ long Size,
+ string Archive, // zip | tar | dmg | pkg | deb
+ string? Inner, // nested archive to expand as well (a .pkg inside a .dmg)
+ IReadOnlyList<string> Bundles); // relative .vst3 paths inside the (inner) archive
+
+/// <summary>A registry plugin installed into Nota's managed plugin folder.</summary>
+public sealed record InstalledStorePlugin(string Id, string Version, string Platform, string Sha256,
+ IReadOnlyList<string> Bundles, DateTimeOffset InstalledAt);
+
+/// <summary>Install progress: <paramref name="Fraction"/> in 0..1, or negative when unknown.</summary>
+public readonly record struct StoreProgress(double Fraction, string Message);
+
+/// <summary>Browse and install open-source plugins from the Nota plugin registry. Installs only
+/// unpack archives (never run installers) into <see cref="PluginsDir"/>, which the plugin scan
+/// searches; callers rescan the catalog after <see cref="InstallAsync"/> / <see cref="Uninstall"/>.</summary>
+public interface IPluginStore
+{
+ /// <summary>Folder that holds installed VST3 bundles, one subfolder per plugin id.</summary>
+ string PluginsDir { get; }
+
+ /// <summary>The registry's plugins (newest version each). Served from the on-disk cache unless
+ /// <paramref name="refresh"/> is set or the cache is older than a day; falls back to the cache
+ /// when offline. Throws only when there is neither network nor cache.</summary>
+ Task<IReadOnlyList<StorePlugin>> FetchAsync(bool refresh = false, CancellationToken ct = default);
+
+ /// <summary>Plugins installed from the registry.</summary>
+ IReadOnlyList<InstalledStorePlugin> Installed { get; }
+
+ /// <summary>Downloads, verifies (size + sha256) and unpacks the plugin's asset, replacing any
+ /// installed version. Throws <see cref="PluginStoreException"/> with a user-facing message.</summary>
+ Task InstallAsync(StorePlugin plugin, IProgress<StoreProgress>? progress = null, CancellationToken ct = default);
+
+ /// <summary>Removes an installed plugin's files. No-op when it isn't installed.</summary>
+ void Uninstall(string id);
+
+ /// <summary>The registry plugin providing a hosted-plugin catalog identifier (as saved in
+ /// projects: "VST3-Name-hash-uid"), from the last fetched list; null if none does.</summary>
+ StorePlugin? FindProvider(string pluginIdentifier);
+}
+
+public sealed class PluginStoreException(string message, Exception? inner = null) : Exception(message, inner);
diff --git a/src/managed/Nota.Application/Ports/IProjectStore.cs b/src/managed/Nota.Application/Ports/IProjectStore.cs
index 59ad42dc..b3201025 100644
--- a/src/managed/Nota.Application/Ports/IProjectStore.cs
+++ b/src/managed/Nota.Application/Ports/IProjectStore.cs
@@ -10,7 +10,11 @@ public readonly record struct TransportState(double Bpm, double MasterVolume, bo
/// <summary>Outcome of loading a project: the transport to restore + any items that
/// were downgraded/skipped (referential-integrity warnings).</summary>
-public readonly record struct ProjectLoadResult(TransportState Transport, IReadOnlyList<string> Warnings);
+public readonly record struct ProjectLoadResult(TransportState Transport, IReadOnlyList<string> Warnings)
+{
+ /// <summary>Hosted-plugin identifiers the project uses that aren't installed (distinct).</summary>
+ public IReadOnlyList<string> MissingPlugins { get; init; } = [];
+}
/// <summary>Save/load of the <c>.nota</c> project bundle. Hides the on-disk document
/// model and the engine-capture/apply mechanics behind a use-case surface.</summary>
diff --git a/src/managed/Nota.Infrastructure/NotaPaths.cs b/src/managed/Nota.Infrastructure/NotaPaths.cs
index 5b112afa..884631d3 100644
--- a/src/managed/Nota.Infrastructure/NotaPaths.cs
+++ b/src/managed/Nota.Infrastructure/NotaPaths.cs
@@ -31,7 +31,10 @@ public static class NotaPaths
private static string ResolveDataDir()
{
string root;
- if (OperatingSystem.IsWindows())
+ // NOTA_DATA_DIR (tests) relocates the data root; the native plugin host honours it too.
+ if (Environment.GetEnvironmentVariable("NOTA_DATA_DIR") is { Length: > 0 } over)
+ root = over;
+ else if (OperatingSystem.IsWindows())
{
// %APPDATA% == Roaming AppData; on Windows SpecialFolder.ApplicationData maps here.
root = Path.Combine(
diff --git a/src/managed/Nota.Infrastructure/Persistence/ProjectStore.cs b/src/managed/Nota.Infrastructure/Persistence/ProjectStore.cs
index 66b766ad..03215fe5 100644
--- a/src/managed/Nota.Infrastructure/Persistence/ProjectStore.cs
+++ b/src/managed/Nota.Infrastructure/Persistence/ProjectStore.cs
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+using System.Text.Json.Nodes;
+
namespace Nota.Infrastructure;
/// <summary>IProjectStore over ProjectService — hides the on-disk document and the
@@ -23,7 +25,34 @@ public sealed class ProjectStore : IProjectStore
doc.Transport.Bpm, doc.Transport.MasterVolume,
doc.Transport.MetronomeOn, doc.Transport.LoopOn,
doc.Transport.TimeSigNumerator, doc.Transport.TimeSigDenominator);
- return new ProjectLoadResult(transport, warnings);
+ return new ProjectLoadResult(transport, warnings) { MissingPlugins = MissingPlugins(doc) };
+ }
+
+ // Every "pluginId" in the document (instruments, effects on any track or bus) that the
+ // catalog can't resolve — offered for install from the plugin registry after load.
+ private static List<string> MissingPlugins(ProjectDocument doc)
+ {
+ var missing = new List<string>();
+ void Walk(JsonNode? node)
+ {
+ switch (node)
+ {
+ case JsonObject o:
+ foreach (var (key, value) in o)
+ {
+ if (key == "pluginId" && value is JsonValue v && v.TryGetValue(out string? id)
+ && id.Length > 0 && !missing.Contains(id) && NotaEngine.PluginIndexOfId(id) < 0)
+ missing.Add(id);
+ else Walk(value);
+ }
+ break;
+ case JsonArray a:
+ foreach (var item in a) Walk(item);
+ break;
+ }
+ }
+ Walk(JsonNode.Parse(ProjectService.SerializeManifest(doc)));
+ return missing;
}
public string Fingerprint(IAudioEngine engine, TransportState transport)
diff --git a/src/managed/Nota.Infrastructure/PluginStore/ArchiveUnpacker.cs b/src/managed/Nota.Infrastructure/PluginStore/ArchiveUnpacker.cs
new file mode 100644
index 00000000..70d5d5b7
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/PluginStore/ArchiveUnpacker.cs
@@ -0,0 +1,214 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Expands a downloaded plugin release asset. Only ever *unpacks*: installer scripts
+// never run (a .pkg is expanded with `pkgutil --expand-full`, which extracts payloads
+// without executing anything). Mirrors unpack() in the registry's scripts/registry.py.
+// zip -> ditto on macOS (keeps bundle symlinks + permissions), else managed
+// tar -> the system tar (bsdtar on macOS/Windows, GNU tar on Linux: gz/xz/bz2)
+// dmg -> hdiutil attach (read-only, hidden) + copy + detach (macOS)
+// pkg -> pkgutil --expand-full (macOS)
+// deb -> ar parsed here, then data.tar.* through the system tar
+
+using System.Diagnostics;
+using System.IO.Compression;
+
+namespace Nota.Infrastructure;
+
+public static class ArchiveUnpacker
+{
+ /// <summary>Archive kind from a file name / URL, or null.</summary>
+ public static string? KindOf(string name)
+ {
+ var n = name.ToLowerInvariant();
+ if (n.EndsWith(".zip")) return "zip";
+ if (n.EndsWith(".tar") || n.EndsWith(".tar.gz") || n.EndsWith(".tgz") || n.EndsWith(".tar.xz")
+ || n.EndsWith(".txz") || n.EndsWith(".tar.bz2")) return "tar";
+ if (n.EndsWith(".dmg")) return "dmg";
+ if (n.EndsWith(".pkg")) return "pkg";
+ if (n.EndsWith(".deb")) return "deb";
+ return null;
+ }
+
+ /// <summary>Expands <paramref name="archive"/> into <paramref name="dest"/> (must not exist yet).</summary>
+ public static void Unpack(string archive, string kind, string dest, CancellationToken ct = default)
+ {
+ switch (kind)
+ {
+ case "zip":
+ if (OperatingSystem.IsMacOS() && !ScanZip(archive))
+ Run("ditto", ["-x", "-k", archive, dest], ct);
+ else
+ Unzip(archive, dest);
+ break;
+ case "tar":
+ Directory.CreateDirectory(dest);
+ Run("tar", ["-xf", archive, "-C", dest], ct);
+ break;
+ case "dmg":
+ RequireMac(kind);
+ UnpackDmg(archive, dest, ct);
+ break;
+ case "pkg":
+ RequireMac(kind);
+ Run("pkgutil", ["--expand-full", archive, dest], ct);
+ break;
+ case "deb":
+ UnpackDeb(archive, dest, ct);
+ break;
+ default:
+ throw new PluginStoreException($"Unsupported archive type \"{kind}\".");
+ }
+ }
+
+ private static void RequireMac(string kind)
+ {
+ if (!OperatingSystem.IsMacOS()) throw new PluginStoreException($"A .{kind} archive can only be unpacked on macOS.");
+ }
+
+ // Refuses entries that would land outside the destination (absolute, drive-rooted or
+ // climbing ".."), whichever extractor runs. Returns whether any name uses backslashes:
+ // some Windows-built zips store "a\b\c", which only the managed path treats as folders.
+ private static bool ScanZip(string archive)
+ {
+ using var z = ZipFile.OpenRead(archive);
+ bool backslashes = false;
+ foreach (var e in z.Entries)
+ {
+ var rel = e.FullName.Replace('\\', '/');
+ if (rel.StartsWith('/') || rel.Contains(':') || rel.Split('/').Contains(".."))
+ throw new PluginStoreException($"The archive contains an unsafe path: {e.FullName}");
+ backslashes |= e.FullName.Contains('\\');
+ }
+ return backslashes;
+ }
+
+ private static void Unzip(string archive, string dest)
+ {
+ ScanZip(archive);
+ var root = Path.GetFullPath(dest) + Path.DirectorySeparatorChar;
+ using var z = ZipFile.OpenRead(archive);
+ foreach (var e in z.Entries)
+ {
+ var rel = e.FullName.Replace('\\', '/');
+ var target = Path.GetFullPath(Path.Combine(dest, rel));
+ if (!target.StartsWith(root, StringComparison.Ordinal) && target + Path.DirectorySeparatorChar != root)
+ throw new PluginStoreException($"The archive contains an unsafe path: {e.FullName}");
+ if (rel.EndsWith('/')) { Directory.CreateDirectory(target); continue; }
+ Directory.CreateDirectory(Path.GetDirectoryName(target)!);
+ e.ExtractToFile(target, overwrite: true);
+ if (!OperatingSystem.IsWindows() && ((e.ExternalAttributes >> 16) & 0b001_001_001) != 0)
+ File.SetUnixFileMode(target, (UnixFileMode)0b111_101_101); // 0755: keep executables executable
+ }
+ }
+
+ private static void UnpackDmg(string archive, string dest, CancellationToken ct)
+ {
+ var mount = Directory.CreateTempSubdirectory("nota-dmg-").FullName;
+ // "Y" accepts a license agreement if the image carries one (else attach waits on stdin).
+ Run("hdiutil", ["attach", "-nobrowse", "-readonly", "-noautoopen", "-mountpoint", mount, archive], ct, stdin: "Y\n");
+ try
+ {
+ Run("ditto", [mount, dest], ct);
+ }
+ finally
+ {
+ try { Run("hdiutil", ["detach", mount, "-force"], CancellationToken.None); } catch { /* best-effort */ }
+ try { Directory.Delete(mount); } catch { /* best-effort */ }
+ }
+ }
+
+ // A .deb is an ar archive: "!<arch>\n", then 60-byte headers (name[16] … size[10] at 48) +
+ // 2-byte-aligned data. The files live in the data.tar.{gz,xz,bz2} member.
+ private static void UnpackDeb(string archive, string dest, CancellationToken ct)
+ {
+ using var f = File.OpenRead(archive);
+ var magic = new byte[8];
+ if (f.Read(magic) != 8 || System.Text.Encoding.ASCII.GetString(magic) != "!<arch>\n")
+ throw new PluginStoreException("The .deb archive is damaged.");
+ var header = new byte[60];
+ while (f.Read(header) == 60)
+ {
+ var name = System.Text.Encoding.ASCII.GetString(header, 0, 16).Trim().TrimEnd('/');
+ long size = long.Parse(System.Text.Encoding.ASCII.GetString(header, 48, 10).Trim());
+ if (name.StartsWith("data.tar", StringComparison.Ordinal))
+ {
+ var member = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(dest))!, name);
+ using (var o = File.Create(member)) CopyExactly(f, o, size);
+ try
+ {
+ Directory.CreateDirectory(dest);
+ Run("tar", ["-xf", member, "-C", dest], ct);
+ }
+ finally { File.Delete(member); }
+ return;
+ }
+ f.Seek(size + (size & 1), SeekOrigin.Current);
+ }
+ throw new PluginStoreException("The .deb archive has no data.");
+ }
+
+ private static void CopyExactly(Stream from, Stream to, long count)
+ {
+ var buf = new byte[1 << 16];
+ while (count > 0)
+ {
+ int n = from.Read(buf, 0, (int)Math.Min(buf.Length, count));
+ if (n <= 0) throw new PluginStoreException("The .deb archive is truncated.");
+ to.Write(buf, 0, n);
+ count -= n;
+ }
+ }
+
+ /// <summary>Copies a bundle directory (or single-file .vst3) to <paramref name="dest"/>,
+ /// preserving symlinks, permissions and code signatures (ditto on macOS).</summary>
+ public static void CopyBundle(string src, string dest, CancellationToken ct = default)
+ {
+ if (OperatingSystem.IsMacOS()) { Run("ditto", [src, dest], ct); return; }
+ if (File.Exists(src)) { File.Copy(src, dest, overwrite: true); return; }
+ CopyTree(new DirectoryInfo(src), dest);
+ }
+
+ private static void CopyTree(DirectoryInfo src, string dest)
+ {
+ Directory.CreateDirectory(dest);
+ foreach (var entry in src.EnumerateFileSystemInfos())
+ {
+ var target = Path.Combine(dest, entry.Name);
+ if (entry.LinkTarget is { } link) { File.CreateSymbolicLink(target, link); continue; }
+ if (entry is DirectoryInfo d) CopyTree(d, target);
+ else
+ {
+ File.Copy(entry.FullName, target, overwrite: true);
+ if (!OperatingSystem.IsWindows()) File.SetUnixFileMode(target, File.GetUnixFileMode(entry.FullName));
+ }
+ }
+ }
+
+ private static void Run(string exe, string[] args, CancellationToken ct, string? stdin = null)
+ {
+ var psi = new ProcessStartInfo(exe)
+ {
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ RedirectStandardInput = stdin is not null,
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ };
+ foreach (var a in args) psi.ArgumentList.Add(a);
+
+ Process p;
+ try { p = Process.Start(psi) ?? throw new PluginStoreException($"Couldn't start {exe}."); }
+ catch (System.ComponentModel.Win32Exception e) { throw new PluginStoreException($"Unpacking needs \"{exe}\", which wasn't found.", e); }
+ using (p)
+ {
+ if (stdin is not null) { p.StandardInput.Write(stdin); p.StandardInput.Close(); }
+ var stderr = p.StandardError.ReadToEndAsync(ct);
+ _ = p.StandardOutput.ReadToEndAsync(ct);
+ try { p.WaitForExitAsync(ct).GetAwaiter().GetResult(); }
+ catch (OperationCanceledException) { try { p.Kill(entireProcessTree: true); } catch { } throw; }
+ if (p.ExitCode != 0)
+ throw new PluginStoreException($"{exe} failed ({p.ExitCode}): {stderr.GetAwaiter().GetResult().Trim()}");
+ }
+ }
+}
diff --git a/src/managed/Nota.Infrastructure/PluginStore/PluginStore.cs b/src/managed/Nota.Infrastructure/PluginStore/PluginStore.cs
new file mode 100644
index 00000000..c3dfa80a
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/PluginStore/PluginStore.cs
@@ -0,0 +1,308 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Get Plug-ins: installs open-source VST3 plugins listed in the Nota plugin registry
+// (github.com/nota-daw/nota-plugins-registry). The registry is one static index.json on
+// GitHub Pages; assets download straight from each plugin's GitHub release and must match
+// the size + sha256 pinned in the index before anything is unpacked.
+//
+// Layout under <data>/plugins:
+// VST3/<id>/<Bundle>.vst3 installed bundles, one folder per plugin (the scan path)
+// registry-index.json last fetched index (offline fallback, 24 h freshness)
+// installed.json what was installed from where
+// An install unpacks into a temp dir, copies the bundles into VST3/.staging-<id>, then
+// swaps that folder in — a failed install never leaves a half-copied plugin behind.
+// NOTA_PLUGIN_REGISTRY overrides the index URL (or points at a local index.json).
+
+using System.Security.Cryptography;
+using System.Text.Json;
+
+namespace Nota.Infrastructure;
+
+public sealed class PluginStore : IPluginStore
+{
+ public const string DefaultIndexUrl = "https://nota-daw.github.io/nota-plugins-registry/index.json";
+ private static readonly TimeSpan CacheFreshFor = TimeSpan.FromHours(24);
+ private static readonly JsonSerializerOptions Json = new(JsonSerializerDefaults.Web) { WriteIndented = true };
+
+ private readonly string _root;
+ private readonly string _indexSource;
+ private readonly IReadOnlyList<string> _platformKeys;
+ private readonly HttpClient _http;
+ private readonly object _gate = new();
+ private IReadOnlyList<StorePlugin> _plugins = [];
+ private List<InstalledStorePlugin> _installed;
+
+ public PluginStore() : this(NotaPaths.SubDir("plugins")) { }
+
+ /// <param name="root">Store folder (tests pass a temp dir).</param>
+ /// <param name="indexSource">Index URL or local path; defaults to NOTA_PLUGIN_REGISTRY, then the public registry.</param>
+ /// <param name="platformKeys">Asset keys to install, most specific first; defaults to the running platform.</param>
+ public PluginStore(string root, string? indexSource = null, IReadOnlyList<string>? platformKeys = null, HttpMessageHandler? handler = null)
+ {
+ _root = root;
+ var env = Environment.GetEnvironmentVariable("NOTA_PLUGIN_REGISTRY");
+ _indexSource = indexSource ?? (string.IsNullOrEmpty(env) ? DefaultIndexUrl : env);
+ _platformKeys = platformKeys ?? RegistryIndex.PlatformKeys();
+ _http = handler is null ? new HttpClient() : new HttpClient(handler);
+ _http.Timeout = Timeout.InfiniteTimeSpan; // big assets; each request carries its own token
+ _http.DefaultRequestHeaders.UserAgent.ParseAdd("Nota-PluginStore");
+ PluginsDir = Path.Combine(root, "VST3");
+ Directory.CreateDirectory(PluginsDir);
+ _installed = LoadInstalled();
+ }
+
+ public string PluginsDir { get; }
+
+ private string CachePath => Path.Combine(_root, "registry-index.json");
+ private string InstalledPath => Path.Combine(_root, "installed.json");
+
+ public IReadOnlyList<InstalledStorePlugin> Installed
+ {
+ get { lock (_gate) return _installed.ToList(); }
+ }
+
+ // ---- registry ---------------------------------------------------------------------
+
+ public async Task<IReadOnlyList<StorePlugin>> FetchAsync(bool refresh = false, CancellationToken ct = default)
+ {
+ string json;
+ if (IsLocal(_indexSource, out var localPath))
+ {
+ json = await File.ReadAllTextAsync(localPath, ct).ConfigureAwait(false);
+ }
+ else if (!refresh && File.Exists(CachePath) && DateTime.UtcNow - File.GetLastWriteTimeUtc(CachePath) < CacheFreshFor)
+ {
+ json = await File.ReadAllTextAsync(CachePath, ct).ConfigureAwait(false);
+ }
+ else
+ {
+ try
+ {
+ using var cts = CancellationTokenSource.CreateLinkedTokenSource(ct);
+ cts.CancelAfter(TimeSpan.FromSeconds(15));
+ json = await _http.GetStringAsync(_indexSource, cts.Token).ConfigureAwait(false);
+ RegistryIndex.Parse(json, _platformKeys); // don't cache something unparseable
+ WriteAtomic(CachePath, json);
+ }
+ catch (Exception e) when (e is HttpRequestException or TaskCanceledException && !ct.IsCancellationRequested
+ || e is JsonException)
+ {
+ if (!File.Exists(CachePath))
+ throw new PluginStoreException("Couldn't reach the plugin registry. Check your internet connection.", e);
+ json = await File.ReadAllTextAsync(CachePath, ct).ConfigureAwait(false);
+ }
+ }
+
+ IReadOnlyList<StorePlugin> plugins;
+ try { plugins = RegistryIndex.Parse(json, _platformKeys); }
+ catch (JsonException e) { throw new PluginStoreException("The plugin registry index is damaged.", e); }
+ lock (_gate) _plugins = plugins;
+ return plugins;
+ }
+
+ public StorePlugin? FindProvider(string pluginIdentifier)
+ {
+ if (RegistryIndex.ParseIdentifier(pluginIdentifier) is not { Format: "VST3" } id) return null;
+ lock (_gate)
+ return _plugins.FirstOrDefault(p => p.Provides.Contains(id.Name, StringComparer.OrdinalIgnoreCase));
+ }
+
+ // ---- install / uninstall ----------------------------------------------------------
+
+ public async Task InstallAsync(StorePlugin plugin, IProgress<StoreProgress>? progress = null, CancellationToken ct = default)
+ {
+ var asset = plugin.Asset ?? throw new PluginStoreException($"{plugin.Name} has no build for this computer.");
+ var work = Directory.CreateTempSubdirectory("nota-plugin-").FullName;
+ try
+ {
+ var file = Path.Combine(work, "asset" + ExtensionOf(asset));
+ await DownloadAsync(plugin, asset, file, progress, ct).ConfigureAwait(false);
+
+ progress?.Report(new StoreProgress(-1, $"Unpacking {plugin.Name}…"));
+ var bundleRoot = await Task.Run(() => Expand(asset, file, work, ct), ct).ConfigureAwait(false);
+
+ progress?.Report(new StoreProgress(-1, $"Installing {plugin.Name}…"));
+ var bundles = await Task.Run(() => Place(plugin.Id, asset, bundleRoot, ct), ct).ConfigureAwait(false);
+
+ lock (_gate)
+ {
+ _installed.RemoveAll(i => i.Id == plugin.Id);
+ _installed.Add(new InstalledStorePlugin(plugin.Id, plugin.Version, asset.Platform, asset.Sha256, bundles, DateTimeOffset.UtcNow));
+ SaveInstalled();
+ }
+ }
+ finally
+ {
+ try { Directory.Delete(work, recursive: true); } catch { /* temp; best-effort */ }
+ }
+ }
+
+ public void Uninstall(string id)
+ {
+ var dir = PluginDir(id);
+ try
+ {
+ if (Directory.Exists(dir)) Directory.Delete(dir, recursive: true);
+ }
+ catch (Exception e) when (e is IOException or UnauthorizedAccessException)
+ {
+ throw new PluginStoreException("Couldn't remove the plugin's files — close any project that uses it and try again.", e);
+ }
+ lock (_gate)
+ {
+ if (_installed.RemoveAll(i => i.Id == id) > 0) SaveInstalled();
+ }
+ }
+
+ private string PluginDir(string id)
+ {
+ // Registry ids are [a-z0-9-]; refuse anything that could walk out of PluginsDir.
+ if (id.Length == 0 || !id.All(c => c is >= 'a' and <= 'z' or >= '0' and <= '9' or '-'))
+ throw new PluginStoreException($"Invalid plugin id \"{id}\".");
+ return Path.Combine(PluginsDir, id);
+ }
+
+ private async Task DownloadAsync(StorePlugin plugin, StoreAsset asset, string file, IProgress<StoreProgress>? progress, CancellationToken ct)
+ {
+ string label = $"Downloading {plugin.Name}…";
+ progress?.Report(new StoreProgress(0, label));
+ using var sha = IncrementalHash.CreateHash(HashAlgorithmName.SHA256);
+ long total = 0;
+ try
+ {
+ Stream src;
+ HttpResponseMessage? resp = null;
+ if (IsLocal(asset.Url, out var localPath)) src = File.OpenRead(localPath);
+ else
+ {
+ resp = await _http.GetAsync(asset.Url, HttpCompletionOption.ResponseHeadersRead, ct).ConfigureAwait(false);
+ resp.EnsureSuccessStatusCode();
+ src = await resp.Content.ReadAsStreamAsync(ct).ConfigureAwait(false);
+ }
+ using (resp)
+ await using (src)
+ await using (var dst = File.Create(file))
+ {
+ var buf = new byte[1 << 16];
+ int n;
+ while ((n = await src.ReadAsync(buf, ct).ConfigureAwait(false)) > 0)
+ {
+ total += n;
+ if (total > asset.Size)
+ throw new PluginStoreException($"The download of {plugin.Name} is larger than the registry says — not installing it.");
+ sha.AppendData(buf, 0, n);
+ await dst.WriteAsync(buf.AsMemory(0, n), ct).ConfigureAwait(false);
+ progress?.Report(new StoreProgress((double)total / asset.Size, label));
+ }
+ }
+ }
+ catch (HttpRequestException e)
+ {
+ throw new PluginStoreException($"Couldn't download {plugin.Name}: {e.Message}", e);
+ }
+
+ var digest = Convert.ToHexStringLower(sha.GetHashAndReset());
+ if (total != asset.Size || digest != asset.Sha256)
+ throw new PluginStoreException($"The download of {plugin.Name} doesn't match the registry's checksum — not installing it.");
+ }
+
+ private static string Expand(StoreAsset asset, string file, string work, CancellationToken ct)
+ {
+ var outer = Path.Combine(work, "outer");
+ ArchiveUnpacker.Unpack(file, asset.Archive, outer, ct);
+ if (asset.Inner is not { } inner) return outer;
+
+ var nested = Resolve(outer, inner);
+ var kind = ArchiveUnpacker.KindOf(inner) ?? throw new PluginStoreException("Unknown nested archive type.");
+ if (!File.Exists(nested) && !Directory.Exists(nested))
+ throw new PluginStoreException($"The download doesn't contain {inner}.");
+ var innerRoot = Path.Combine(work, "inner");
+ ArchiveUnpacker.Unpack(nested, kind, innerRoot, ct);
+ return innerRoot;
+ }
+
+ // Copies the manifest's bundles into VST3/.staging-<id>, then swaps it in as VST3/<id>.
+ private List<string> Place(string id, StoreAsset asset, string bundleRoot, CancellationToken ct)
+ {
+ var final = PluginDir(id);
+ var staging = Path.Combine(PluginsDir, ".staging-" + id);
+ if (Directory.Exists(staging)) Directory.Delete(staging, recursive: true);
+ Directory.CreateDirectory(staging);
+ try
+ {
+ var placed = new List<string>();
+ foreach (var rel in asset.Bundles)
+ {
+ ct.ThrowIfCancellationRequested();
+ var src = Resolve(bundleRoot, rel);
+ if (!Directory.Exists(src) && !File.Exists(src))
+ throw new PluginStoreException($"The download doesn't contain {rel}.");
+ var name = Path.GetFileName(src);
+ ArchiveUnpacker.CopyBundle(src, Path.Combine(staging, name), ct);
+ placed.Add(name);
+ }
+ if (Directory.Exists(final)) Directory.Delete(final, recursive: true);
+ Directory.Move(staging, final);
+ return placed;
+ }
+ catch
+ {
+ try { Directory.Delete(staging, recursive: true); } catch { /* best-effort */ }
+ throw;
+ }
+ }
+
+ /// <summary>A manifest-relative path ("a/b.vst3") under root; refuses paths that escape it.</summary>
+ private static string Resolve(string root, string rel)
+ {
+ var full = Path.GetFullPath(Path.Combine(root, rel.Replace('/', Path.DirectorySeparatorChar)));
+ var prefix = Path.GetFullPath(root) + Path.DirectorySeparatorChar;
+ if (!full.StartsWith(prefix, StringComparison.Ordinal))
+ throw new PluginStoreException($"Unsafe path in the registry entry: {rel}");
+ return full;
+ }
+
+ private static string ExtensionOf(StoreAsset asset)
+ {
+ var name = asset.Url[(asset.Url.LastIndexOf('/') + 1)..].ToLowerInvariant();
+ foreach (var ext in new[] { ".tar.gz", ".tar.xz", ".tar.bz2", ".tgz", ".txz", ".tar", ".zip", ".dmg", ".pkg", ".deb" })
+ if (name.EndsWith(ext)) return ext;
+ return "." + asset.Archive;
+ }
+
+ private static bool IsLocal(string source, out string path)
+ {
+ if (source.StartsWith("file://", StringComparison.OrdinalIgnoreCase)) { path = new Uri(source).LocalPath; return true; }
+ path = source;
+ return !source.Contains("://");
+ }
+
+ // ---- installed.json ---------------------------------------------------------------
+
+ private sealed record InstalledFile(List<InstalledStorePlugin> Plugins);
+
+ private List<InstalledStorePlugin> LoadInstalled()
+ {
+ try
+ {
+ if (!File.Exists(InstalledPath)) return [];
+ var list = JsonSerializer.Deserialize<InstalledFile>(File.ReadAllText(InstalledPath), Json)?.Plugins ?? [];
+ // Drop entries whose files were deleted by hand.
+ return list.Where(i => Directory.Exists(Path.Combine(PluginsDir, i.Id))).ToList();
+ }
+ catch (Exception e) when (e is JsonException or IOException)
+ {
+ return [];
+ }
+ }
+
+ private void SaveInstalled() => WriteAtomic(InstalledPath, JsonSerializer.Serialize(new InstalledFile(_installed), Json));
+
+ private static void WriteAtomic(string path, string text)
+ {
+ var tmp = path + ".tmp";
+ File.WriteAllText(tmp, text);
+ File.Move(tmp, path, overwrite: true);
+ }
+}
diff --git a/src/managed/Nota.Infrastructure/PluginStore/RegistryIndex.cs b/src/managed/Nota.Infrastructure/PluginStore/RegistryIndex.cs
new file mode 100644
index 00000000..b6504421
--- /dev/null
+++ b/src/managed/Nota.Infrastructure/PluginStore/RegistryIndex.cs
@@ -0,0 +1,103 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Parses the plugin registry's index.json (github.com/nota-daw/nota-plugins-registry —
+// its README documents the manifest) and reduces each plugin to the asset the running
+// platform can install.
+
+using System.Runtime.InteropServices;
+using System.Text.Json;
+
+namespace Nota.Infrastructure;
+
+public static class RegistryIndex
+{
+ /// <summary>Highest index schema this build understands.</summary>
+ public const int SupportedSchema = 1;
+
+ /// <summary>Asset keys the running process can load, most specific first. A plugin must match
+ /// the process architecture (an x64 Nota under Rosetta loads x64 plugins).</summary>
+ public static IReadOnlyList<string> PlatformKeys(OSPlatform? os = null, Architecture? arch = null)
+ {
+ var a = arch ?? RuntimeInformation.ProcessArchitecture;
+ bool Is(OSPlatform p) => os is { } o ? o == p : RuntimeInformation.IsOSPlatform(p);
+ string cpu = a == Architecture.Arm64 ? "arm64" : a == Architecture.X64 ? "x64" : "";
+ if (cpu.Length == 0) return [];
+ if (Is(OSPlatform.OSX)) return [$"macos-{cpu}", "macos-universal"];
+ if (Is(OSPlatform.Windows)) return [$"windows-{cpu}"];
+ if (Is(OSPlatform.Linux)) return [$"linux-{cpu}"];
+ return [];
+ }
+
+ public static IReadOnlyList<StorePlugin> Parse(string json, IReadOnlyList<string> platformKeys)
+ {
+ using var doc = JsonDocument.Parse(json);
+ var root = doc.RootElement;
+ int schema = root.TryGetProperty("schema", out var s) && s.TryGetInt32(out var n) ? n : 0;
+ if (schema is < 1 or > SupportedSchema)
+ throw new PluginStoreException("The plugin registry needs a newer version of Nota.");
+
+ var list = new List<StorePlugin>();
+ foreach (var p in root.GetProperty("plugins").EnumerateArray())
+ {
+ try { list.Add(ParsePlugin(p, platformKeys)); }
+ catch (Exception e) when (e is KeyNotFoundException or InvalidOperationException or FormatException)
+ {
+ // One malformed entry must not hide the rest of the registry.
+ }
+ }
+ return list;
+ }
+
+ private static StorePlugin ParsePlugin(JsonElement p, IReadOnlyList<string> platformKeys)
+ {
+ var latest = p.GetProperty("versions")[0];
+ StoreAsset? asset = null;
+ var assets = latest.GetProperty("assets");
+ foreach (var key in platformKeys)
+ {
+ if (!assets.TryGetProperty(key, out var a)) continue;
+ string url = a.GetProperty("url").GetString()!;
+ asset = new StoreAsset(
+ key, url,
+ a.GetProperty("sha256").GetString()!.ToLowerInvariant(),
+ a.GetProperty("size").GetInt64(),
+ Str(a, "archive") ?? ArchiveUnpacker.KindOf(url) ?? throw new FormatException("archive type"),
+ Str(a, "inner"),
+ a.GetProperty("bundles").EnumerateArray().Select(b => b.GetString()!).ToList());
+ break;
+ }
+
+ return new StorePlugin(
+ Id: p.GetProperty("id").GetString()!,
+ Name: p.GetProperty("name").GetString()!,
+ Developer: p.GetProperty("developer").GetString()!,
+ Description: p.GetProperty("description").GetString()!,
+ Kind: p.GetProperty("kind").GetString()!,
+ License: p.GetProperty("license").GetString()!,
+ Repo: p.GetProperty("repo").GetString()!,
+ Homepage: Str(p, "homepage"),
+ Tags: p.TryGetProperty("tags", out var t) ? t.EnumerateArray().Select(x => x.GetString()!).ToList() : [],
+ Provides: p.GetProperty("provides").EnumerateArray()
+ .Where(x => Str(x, "format") == "VST3").Select(x => x.GetProperty("name").GetString()!).ToList(),
+ Version: latest.GetProperty("version").GetString()!,
+ Asset: asset)
+ {
+ Notes = Str(p, "notes"),
+ };
+ }
+
+ private static string? Str(JsonElement e, string name)
+ => e.TryGetProperty(name, out var v) && v.ValueKind == JsonValueKind.String ? v.GetString() : null;
+
+ /// <summary>Splits a hosted-plugin catalog identifier ("VST3-Surge XT-1a2b3c-4d5e6f", i.e.
+ /// format-name-pathhash-uid) into its format and name; null if it isn't one.</summary>
+ public static (string Format, string Name)? ParseIdentifier(string identifier)
+ {
+ int first = identifier.IndexOf('-');
+ int uid = identifier.LastIndexOf('-');
+ int hash = uid > 0 ? identifier.LastIndexOf('-', uid - 1) : -1;
+ if (first <= 0 || hash <= first) return null;
+ return (identifier[..first], identifier[(first + 1)..hash]);
+ }
+}
diff --git a/src/native/nota.engine/pluginhost/PluginHost.cpp b/src/native/nota.engine/pluginhost/PluginHost.cpp
index c4ed87ba..4250ba90 100644
--- a/src/native/nota.engine/pluginhost/PluginHost.cpp
+++ b/src/native/nota.engine/pluginhost/PluginHost.cpp
@@ -99,6 +99,13 @@ juce::KnownPluginList& catalog() {
// Windows -> %APPDATA%\Nota
// Linux -> ~/.config/Nota
juce::File notaSupportDir() {
+ // NOTA_DATA_DIR (tests) relocates the catalog + scan paths, like NotaPaths.DataDir.
+ // Needed because on macOS JUCE resolves the home folder via NSHomeDirectory(), not $HOME.
+ if (const char* over = std::getenv("NOTA_DATA_DIR"); over != nullptr && *over != '\0') {
+ juce::File dir{juce::CharPointer_UTF8(over)};
+ dir.createDirectory();
+ return dir;
+ }
#if JUCE_MAC
auto dir = juce::File::getSpecialLocation(juce::File::userApplicationDataDirectory)
.getChildFile("Application Support")
@@ -219,6 +226,12 @@ extern "C" NOTA_API int32_t nota_pluginhost_scan(const char* worker_path) {
const juce::String workerPath{juce::CharPointer_UTF8(worker_path)};
if (!juce::File(workerPath).existsAsFile()) return -2;
+ // Forget VST3 bundles that are gone from disk (uninstalled, e.g. via Get Plug-ins),
+ // so the browser stops listing them. AU lives in the system registry — left alone.
+ for (const auto& t : catalog().getTypes())
+ if (t.pluginFormatName == "VST3" && !juce::File(t.fileOrIdentifier).exists())
+ catalog().removeType(t);
+
for (const char* formatName : kFormatOrder) {
auto* format = findFormat(formatName);
if (format == nullptr) continue;
@@ -282,6 +295,22 @@ extern "C" NOTA_API int32_t nota_pluginhost_index_of_id(const char* identifier)
const auto types = catalog().getTypes();
for (int i = 0; i < types.size(); ++i)
if (types.getReference(i).createIdentifierString() == want) return i;
+
+ // Fallback: JUCE ids are "<format>-<name>-<hex path hash>-<hex uid>", so the same
+ // plugin at another path (another machine, or Nota's managed plugin folder, whose
+ // path holds the user name) never matches exactly. Match format + name + uid instead.
+ const int uidDash = want.lastIndexOfChar('-');
+ const int hashDash = uidDash > 0 ? want.substring(0, uidDash).lastIndexOfChar('-') : -1;
+ if (hashDash <= 0) return -1;
+ const auto prefix = want.substring(0, hashDash);
+ const auto uid = want.substring(uidDash + 1);
+ for (int i = 0; i < types.size(); ++i) {
+ const auto& t = types.getReference(i);
+ if (t.pluginFormatName + "-" + t.name == prefix
+ && (juce::String::toHexString(t.uniqueId) == uid
+ || juce::String::toHexString(t.deprecatedUid) == uid))
+ return i;
+ }
return -1;
}
diff --git a/tests/Nota.SmokeTest/PluginStoreTests.cs b/tests/Nota.SmokeTest/PluginStoreTests.cs
new file mode 100644
index 00000000..2a8d2a28
--- /dev/null
+++ b/tests/Nota.SmokeTest/PluginStoreTests.cs
@@ -0,0 +1,338 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Get Plug-ins (IPluginStore): registry index parsing + platform choice, identifier
+// matching for missing plugins, and install/uninstall end to end against a local index
+// with generated zip / tar.gz / .deb assets — checksum and path-escape refusals included.
+// Also runnable alone: `dotnet run --project tests/Nota.SmokeTest -- --store`.
+// Opt-in live check against real releases: `-- --store-live <index.json> <id> [<id> …]`
+// (downloads from GitHub; with a scan worker beside the test, loads each bundle too).
+
+using System.Formats.Tar;
+using System.IO.Compression;
+using System.Runtime.InteropServices;
+using System.Security.Cryptography;
+using System.Text;
+using System.Text.Json;
+using Nota.Application;
+using Nota.Infrastructure;
+
+namespace Nota.SmokeTest;
+
+internal static class PluginStoreTests
+{
+ public static IEnumerable<(bool Ok, string Label)> Run()
+ {
+ // ---- platform keys --------------------------------------------------------------
+ yield return (RegistryIndex.PlatformKeys(OSPlatform.OSX, Architecture.Arm64).SequenceEqual(["macos-arm64", "macos-universal"]),
+ "Apple silicon installs arm64 builds, else universal");
+ yield return (RegistryIndex.PlatformKeys(OSPlatform.OSX, Architecture.X64).SequenceEqual(["macos-x64", "macos-universal"]),
+ "Intel Macs install x64 builds, else universal");
+ yield return (RegistryIndex.PlatformKeys(OSPlatform.Windows, Architecture.X64).SequenceEqual(["windows-x64"]),
+ "Windows x64 installs only windows-x64 builds");
+ yield return (RegistryIndex.PlatformKeys(OSPlatform.Linux, Architecture.Arm64).SequenceEqual(["linux-arm64"]),
+ "Linux arm64 never takes an x64 build");
+
+ // ---- identifiers ------------------------------------------------------------------
+ yield return (RegistryIndex.ParseIdentifier("VST3-Surge XT-1a2b3c-4d5e6f") == ("VST3", "Surge XT"),
+ "a catalog id splits into format and name");
+ yield return (RegistryIndex.ParseIdentifier("VST3-GATE-12-ff00-1234") == ("VST3", "GATE-12"),
+ "…keeping dashes inside the plugin name");
+ yield return (RegistryIndex.ParseIdentifier("nonsense") is null, "…and rejects anything else");
+
+ // ---- index parsing ----------------------------------------------------------------
+ var sample = IndexJson(Plugin("dual", "Dual", "effect", "1.0",
+ ("macos-universal", "https://github.com/a/b/releases/download/v1/dual-mac.dmg", new string('a', 64), 10, null, ["Dual.vst3"], "Dual.pkg"),
+ ("linux-x64", "https://github.com/a/b/releases/download/v1/dual-linux.tar.xz", new string('b', 64), 20, null, ["x/Dual.vst3"], null)));
+ var linux = RegistryIndex.Parse(sample, ["linux-x64"]).Single();
+ yield return (linux.Asset is { Platform: "linux-x64", Archive: "tar", Size: 20, Inner: null } a && a.Bundles.SequenceEqual(["x/Dual.vst3"]),
+ "the index yields the running platform's asset, archive type from the URL");
+ var mac = RegistryIndex.Parse(sample, ["macos-arm64", "macos-universal"]).Single();
+ yield return (mac.Asset is { Platform: "macos-universal", Archive: "dmg", Inner: "Dual.pkg" },
+ "…falling back along the platform keys (arm64 → universal), nested archive kept");
+ yield return (RegistryIndex.Parse(sample, ["windows-x64"]).Single().Asset is null,
+ "a plugin without a build for this platform stays listed, with no asset");
+ var broken = sample.Replace("\"plugins\": [", "\"plugins\": [{\"id\": \"half\"},");
+ yield return (RegistryIndex.Parse(broken, ["linux-x64"]).Count == 1, "a malformed entry is skipped, not fatal");
+ bool refused = false;
+ try { RegistryIndex.Parse(sample.Replace("\"schema\": 1", "\"schema\": 99"), ["linux-x64"]); }
+ catch (PluginStoreException) { refused = true; }
+ yield return (refused, "a newer index schema asks for a newer Nota");
+
+ // ---- install / uninstall end to end ------------------------------------------------
+ var tmp = Directory.CreateTempSubdirectory("nota-store-test-").FullName;
+ try
+ {
+ foreach (var r in InstallFlow(tmp)) yield return r;
+ }
+ finally
+ {
+ try { Directory.Delete(tmp, recursive: true); } catch { }
+ }
+ }
+
+ private static IEnumerable<(bool, string)> InstallFlow(string tmp)
+ {
+ const string plat = "test-platform";
+ var assets = Path.Combine(tmp, "assets");
+ Directory.CreateDirectory(assets);
+
+ // zip: a bundle two folders deep, plus a Windows-style entry with backslashes.
+ var zip = Path.Combine(assets, "synth.zip");
+ using (var z = ZipFile.Open(zip, ZipArchiveMode.Create))
+ {
+ Entry(z, "synth-1.0/VST3/Fake Synth.vst3/Contents/Resources/moduleinfo.json", "{}");
+ Entry(z, "synth-1.0/VST3/Fake Synth.vst3/Contents/x86_64-linux/Fake Synth.so", "binary");
+ Entry(z, "synth-1.0\\VST3\\Fake FX.vst3\\Contents\\x86_64-win\\Fake FX.vst3", "dll");
+ Entry(z, "synth-1.0/README.txt", "not a bundle");
+ }
+ // tar.gz and .deb (ar + data.tar.gz) with the bundle under usr/lib/vst3.
+ var tgz = Path.Combine(assets, "verb.tar.gz");
+ WriteTarGz(tgz, ("verb/Fake Verb.vst3/Contents/Resources/info.txt", "verb"));
+ var deb = Path.Combine(assets, "delay.deb");
+ var data = Path.Combine(tmp, "data.tar.gz");
+ WriteTarGz(data, ("usr/lib/vst3/Fake Delay.vst3/Contents/info.txt", "delay"));
+ WriteDeb(deb, File.ReadAllBytes(data));
+ // zip-slip: an entry that climbs out of the extraction folder.
+ var evil = Path.Combine(assets, "evil.zip");
+ using (var z = ZipFile.Open(evil, ZipArchiveMode.Create)) { Entry(z, "../../escaped.txt", "x"); Entry(z, "Evil.vst3/x", "x"); }
+
+ var index = Path.Combine(tmp, "index.json");
+ void WriteIndex(string synthSha, string synthVersion) => File.WriteAllText(index, IndexJson(
+ Plugin("fake-synth", "Fake Synth", "instrument", synthVersion,
+ (plat, zip, synthSha, new FileInfo(zip).Length, null,
+ ["synth-1.0/VST3/Fake Synth.vst3", "synth-1.0/VST3/Fake FX.vst3"], null),
+ provides: ["Fake Synth", "Fake FX"]),
+ Plugin("fake-verb", "Fake Verb", "effect", "2.0", (plat, tgz, Sha(tgz), new FileInfo(tgz).Length, null, ["verb/Fake Verb.vst3"], null)),
+ Plugin("fake-delay", "Fake Delay", "effect", "3.0", (plat, deb, Sha(deb), new FileInfo(deb).Length, null, ["usr/lib/vst3/Fake Delay.vst3"], null)),
+ Plugin("fake-evil", "Fake Evil", "effect", "1.0", (plat, evil, Sha(evil), new FileInfo(evil).Length, null, ["Evil.vst3"], null)),
+ Plugin("fake-escape", "Fake Escape", "effect", "1.0", (plat, zip, Sha(zip), new FileInfo(zip).Length, null, ["../../../etc.vst3"], null))));
+ WriteIndex(Sha(zip), "1.0");
+
+ var root = Path.Combine(tmp, "store");
+ var store = new PluginStore(root, index, [plat]);
+ var plugins = store.FetchAsync().GetAwaiter().GetResult();
+ yield return (plugins.Count == 5 && plugins.All(p => p.Asset is not null), "a local index lists its plugins");
+ StorePlugin P(string id) => store.FetchAsync().GetAwaiter().GetResult().Single(p => p.Id == id);
+
+ var reports = new List<StoreProgress>();
+ store.InstallAsync(P("fake-synth"), new SyncProgress(reports.Add)).GetAwaiter().GetResult();
+ var dir = Path.Combine(store.PluginsDir, "fake-synth");
+ yield return (File.Exists(Path.Combine(dir, "Fake Synth.vst3", "Contents", "x86_64-linux", "Fake Synth.so")),
+ "a zip installs its bundle into the plugin's own folder");
+ yield return (File.Exists(Path.Combine(dir, "Fake FX.vst3", "Contents", "x86_64-win", "Fake FX.vst3")),
+ "…backslash-separated zip entries unpack as folders");
+ yield return (!File.Exists(Path.Combine(dir, "README.txt")) && Directory.GetFileSystemEntries(dir).Length == 2,
+ "…and only the listed bundles are copied");
+ yield return (reports.Any(r => r.Fraction >= 0.99) && reports.Any(r => r.Message.StartsWith("Unpacking")),
+ "install reports download progress, then the unpack stage");
+ yield return (store.Installed.SingleOrDefault(i => i.Id == "fake-synth") is { Version: "1.0" } inst
+ && inst.Bundles.SequenceEqual(["Fake Synth.vst3", "Fake FX.vst3"]),
+ "the install is recorded with its version and bundles");
+ yield return (new PluginStore(root, index, [plat]).Installed.Any(i => i.Id == "fake-synth"),
+ "…and survives a restart (installed.json)");
+
+ store.InstallAsync(P("fake-verb")).GetAwaiter().GetResult();
+ yield return (File.Exists(Path.Combine(store.PluginsDir, "fake-verb", "Fake Verb.vst3", "Contents", "Resources", "info.txt")),
+ "a tar.gz installs through the system tar");
+ store.InstallAsync(P("fake-delay")).GetAwaiter().GetResult();
+ yield return (File.Exists(Path.Combine(store.PluginsDir, "fake-delay", "Fake Delay.vst3", "Contents", "info.txt")),
+ "a .deb's data.tar installs");
+
+ yield return (store.FindProvider("VST3-Fake FX-9c1d-77aa")?.Id == "fake-synth", "a missing plugin's id finds the registry entry that provides it");
+ yield return (store.FindProvider("AudioUnit-Fake FX-9c1d-77aa") is null && store.FindProvider("VST3-Unknown-1-2") is null,
+ "…only for VST3 names the registry lists");
+
+ yield return (Throws(() => store.InstallAsync(P("fake-evil")).GetAwaiter().GetResult())
+ && !File.Exists(Path.Combine(Path.GetTempPath(), "escaped.txt")) && !Directory.Exists(Path.Combine(store.PluginsDir, "fake-evil")),
+ "an archive entry escaping the unpack folder is refused, nothing installed");
+ yield return (Throws(() => store.InstallAsync(P("fake-escape")).GetAwaiter().GetResult())
+ && !Directory.Exists(Path.Combine(store.PluginsDir, "fake-escape")),
+ "a bundle path escaping the archive is refused");
+
+ // Update with a checksum that doesn't match: refused, the installed version stays intact.
+ WriteIndex(new string('0', 64), "1.1");
+ yield return (Throws(() => store.InstallAsync(P("fake-synth")).GetAwaiter().GetResult())
+ && store.Installed.Single(i => i.Id == "fake-synth").Version == "1.0"
+ && File.Exists(Path.Combine(dir, "Fake Synth.vst3", "Contents", "x86_64-linux", "Fake Synth.so")),
+ "a checksum mismatch aborts the update and keeps the installed version");
+ WriteIndex(Sha(zip), "1.1");
+ store.InstallAsync(P("fake-synth")).GetAwaiter().GetResult();
+ yield return (store.Installed.Single(i => i.Id == "fake-synth").Version == "1.1" && Directory.GetFileSystemEntries(dir).Length == 2
+ && !Directory.EnumerateDirectories(store.PluginsDir, ".staging-*").Any(),
+ "an update replaces the plugin's folder atomically");
+
+ store.Uninstall("fake-synth");
+ yield return (!Directory.Exists(dir) && store.Installed.All(i => i.Id != "fake-synth"), "uninstall removes the files and the record");
+ yield return (Throws(() => store.Uninstall("../x")), "uninstall refuses ids that aren't registry ids");
+
+ // Offline: an unreachable registry falls back to the last cached index.
+ var cache = Path.Combine(tmp, "cache-root");
+ Directory.CreateDirectory(cache);
+ File.Copy(index, Path.Combine(cache, "registry-index.json"));
+ File.SetLastWriteTimeUtc(Path.Combine(cache, "registry-index.json"), DateTime.UtcNow.AddDays(-3));
+ var offline = new PluginStore(cache, "http://127.0.0.1:9/index.json", [plat]);
+ yield return (offline.FetchAsync().GetAwaiter().GetResult().Count == 5, "offline, the stale cached index is used");
+ var empty = new PluginStore(Path.Combine(tmp, "no-cache"), "http://127.0.0.1:9/index.json", [plat]);
+ yield return (Throws(() => empty.FetchAsync().GetAwaiter().GetResult()), "offline with no cache is a clear error");
+ }
+
+ /// <summary>Installs real registry plugins into a temp store; with a scan worker, checks each bundle loads.</summary>
+ public static IEnumerable<(bool Ok, string Label)> RunLive(string index, IReadOnlyList<string> ids)
+ {
+ var root = Directory.CreateTempSubdirectory("nota-store-live-").FullName;
+ var store = new PluginStore(root, index);
+ var plugins = store.FetchAsync().GetAwaiter().GetResult();
+ var worker = Path.Combine(AppContext.BaseDirectory, OperatingSystem.IsWindows() ? "nota-scanworker.exe" : "nota-scanworker");
+ if (!File.Exists(worker))
+ worker = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../../src/native/nota.engine/build/nota-scanworker"));
+ foreach (var id in ids)
+ {
+ var p = plugins.SingleOrDefault(x => x.Id == id);
+ if (p?.Asset is null) { yield return (false, $"{id}: in the index with an asset for this platform"); continue; }
+ var sw = System.Diagnostics.Stopwatch.StartNew();
+ string? err = null;
+ try { store.InstallAsync(p).GetAwaiter().GetResult(); }
+ catch (PluginStoreException e) { err = e.Message; }
+ yield return (err is null, $"{id} {p.Version} ({p.Asset.Platform}, {p.Asset.Archive}{(p.Asset.Inner is null ? "" : " → pkg")}) installs in {sw.Elapsed.TotalSeconds:0.0} s {err}");
+ if (err is not null || !File.Exists(worker)) continue;
+ foreach (var bundle in Directory.GetFileSystemEntries(Path.Combine(store.PluginsDir, id)))
+ {
+ var psi = new System.Diagnostics.ProcessStartInfo(worker) { RedirectStandardOutput = true };
+ psi.ArgumentList.Add("VST3");
+ psi.ArgumentList.Add(bundle);
+ using var proc = System.Diagnostics.Process.Start(psi)!;
+ var output = proc.StandardOutput.ReadToEnd();
+ proc.WaitForExit();
+ var names = System.Text.RegularExpressions.Regex.Matches(output, "<PLUGIN name=\"([^\"]+)\"").Select(m => m.Groups[1].Value).ToList();
+ yield return (names.Count > 0 && names.All(n => p.Provides.Contains(n)),
+ $" {Path.GetFileName(bundle)} loads as [{string.Join(", ", names)}], listed in provides");
+ }
+ }
+ Console.WriteLine($" (installed under {root})");
+ }
+
+ /// <summary>Catalog behaviour the store relies on, against a real VST3 bundle: a plugin found at a
+ /// new path still resolves by its old identifier (path hash ignored), and a bundle deleted from
+ /// disk drops out of the catalog on the next scan. Rescans the catalog, so it refuses to run
+ /// unless NOTA_DATA_DIR points at a scratch folder (where the catalog + scan paths then live).</summary>
+ public static IEnumerable<(bool Ok, string Label)> RunCatalog(string bundle, string worker)
+ {
+ // The catalog and its scan paths must live in a scratch data dir (NOTA_DATA_DIR), never the user's.
+ var home = Environment.GetEnvironmentVariable("NOTA_DATA_DIR") ?? "";
+ if (home.Length == 0 || !Path.GetFullPath(home).StartsWith(Path.GetFullPath(Path.GetTempPath()), StringComparison.Ordinal)
+ && !home.StartsWith("/tmp/", StringComparison.Ordinal))
+ {
+ yield return (false, "run with NOTA_DATA_DIR=<scratch dir under /tmp> — this rescans the plugin catalog");
+ yield break;
+ }
+ var a = Path.Combine(home, "plugins-a");
+ var b = Path.Combine(home, "plugins-b");
+ Directory.CreateDirectory(a);
+ Directory.CreateDirectory(b);
+ var name = Path.GetFileName(bundle);
+ ArchiveUnpacker.CopyBundle(bundle, Path.Combine(a, name));
+
+ List<string> Ids() => Enumerable.Range(0, NotaEngine.PluginCount).Select(i => NotaEngine.PluginId(i)!).ToList();
+ NotaEngine.ScanPlugins(worker); // baseline: whatever the system folders hold
+ var baseline = Ids();
+ NotaEngine.AddScanPath(a);
+ NotaEngine.ScanPlugins(worker);
+ var idsA = Ids();
+ var added = idsA.Except(baseline).ToList();
+ yield return (added.Count > 0, $"the bundle scans in ({string.Join(", ", added)})");
+ if (added.Count == 0) yield break;
+ var oldId = added[0];
+
+ // "Another machine": same bundle, different folder → different path hash.
+ Directory.Move(Path.Combine(a, name), Path.Combine(b, name));
+ NotaEngine.RemoveScanPath(0);
+ NotaEngine.AddScanPath(b);
+ NotaEngine.ScanPlugins(worker);
+ var idsB = Ids();
+ yield return (!idsB.Contains(oldId) && idsB.Count == idsA.Count,
+ "a bundle gone from disk drops out of the catalog on rescan");
+ int idx = NotaEngine.PluginIndexOfId(oldId);
+ yield return (idx >= 0 && idsB[idx] != oldId,
+ $"the old identifier still resolves to the moved plugin ({(idx >= 0 ? idsB[idx] : "none")})");
+ yield return (NotaEngine.PluginIndexOfId(oldId[..oldId.LastIndexOf('-')] + "-deadbeef") < 0,
+ "…but not with a different plugin uid");
+ }
+
+ // ---- helpers ----------------------------------------------------------------------------
+
+ private sealed class SyncProgress(Action<StoreProgress> report) : IProgress<StoreProgress>
+ {
+ public void Report(StoreProgress value) => report(value);
+ }
+
+ private static bool Throws(Action a)
+ {
+ try { a(); return false; }
+ catch (PluginStoreException) { return true; }
+ }
+
+ private static string Sha(string path) => Convert.ToHexStringLower(SHA256.HashData(File.ReadAllBytes(path)));
+
+ private static void Entry(ZipArchive z, string name, string text)
+ {
+ using var s = z.CreateEntry(name).Open();
+ s.Write(Encoding.UTF8.GetBytes(text));
+ }
+
+ private static void WriteTarGz(string path, params (string Name, string Text)[] files)
+ {
+ using var fs = File.Create(path);
+ using var gz = new GZipStream(fs, CompressionLevel.Fastest);
+ using var tar = new TarWriter(gz, TarEntryFormat.Pax);
+ foreach (var (name, text) in files)
+ tar.WriteEntry(new PaxTarEntry(TarEntryType.RegularFile, name) { DataStream = new MemoryStream(Encoding.UTF8.GetBytes(text)) });
+ }
+
+ private static void WriteDeb(string path, byte[] dataTarGz)
+ {
+ using var f = File.Create(path);
+ f.Write("!<arch>\n"u8);
+ void Member(string name, byte[] body)
+ {
+ var header = $"{name,-16}{"0",-12}{"0",-6}{"0",-6}{"100644",-8}{body.Length,-10}`\n";
+ f.Write(Encoding.ASCII.GetBytes(header));
+ f.Write(body);
+ if (body.Length % 2 == 1) f.WriteByte((byte)'\n');
+ }
+ Member("debian-binary", "2.0\n"u8.ToArray());
+ Member("control.tar.gz", [0x1f]); // odd length exercises the ar padding
+ Member("data.tar.gz", dataTarGz);
+ }
+
+ private static string IndexJson(params string[] plugins)
+ => $"{{\n\"schema\": 1,\n\"generated\": \"2026-01-01T00:00:00Z\",\n\"plugins\": [{string.Join(",", plugins)}]\n}}";
+
+ private static string Plugin(string id, string name, string kind, string version,
+ (string Platform, string Url, string Sha, long Size, string? Archive, string[] Bundles, string? Inner) asset,
+ string[]? provides = null)
+ => Plugin(id, name, kind, version, [asset], provides);
+
+ private static string Plugin(string id, string name, string kind, string version,
+ (string Platform, string Url, string Sha, long Size, string? Archive, string[] Bundles, string? Inner) a1,
+ (string Platform, string Url, string Sha, long Size, string? Archive, string[] Bundles, string? Inner) a2)
+ => Plugin(id, name, kind, version, [a1, a2], null);
+
+ private static string Plugin(string id, string name, string kind, string version,
+ (string Platform, string Url, string Sha, long Size, string? Archive, string[] Bundles, string? Inner)[] assets,
+ string[]? provides)
+ {
+ var assetObj = assets.ToDictionary(a => a.Platform, a => new Dictionary<string, object?>
+ {
+ ["url"] = a.Url, ["sha256"] = a.Sha, ["size"] = a.Size, ["bundles"] = a.Bundles,
+ ["archive"] = a.Archive, ["inner"] = a.Inner,
+ }.Where(kv => kv.Value is not null).ToDictionary());
+ return JsonSerializer.Serialize(new Dictionary<string, object>
+ {
+ ["id"] = id, ["name"] = name, ["developer"] = "Test", ["description"] = $"{name} for tests.",
+ ["repo"] = "https://github.com/nota-daw/test", ["license"] = "MIT", ["kind"] = kind,
+ ["provides"] = (provides ?? [name]).Select(n => new { format = "VST3", name = n }),
+ ["versions"] = new[] { new { version, assets = assetObj } },
+ });
+ }
+}
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index 1866a3f1..2c6aa1a4 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -100,6 +100,29 @@ if (args.Length >= 1 && args[0] == "--audiocheck")
return f == 0 ? 0 : 1;
}
+// Get Plug-ins alone: `--store`; live installs from a registry index: `--store-live <index> <id>…`.
+if (args.Length >= 1 && args[0] == "--store")
+{
+ Console.WriteLine("-- get plug-ins: registry store --");
+ foreach (var (ok, label) in PluginStoreTests.Run()) Check(ok, label);
+ Console.WriteLine(failures == 0 ? "STORE PASSED" : $"STORE FAILED ({failures})");
+ return failures == 0 ? 0 : 1;
+}
+if (args.Length >= 3 && args[0] == "--store-catalog")
+{
+ Console.WriteLine("-- get plug-ins: catalog identifiers --");
+ foreach (var (ok, label) in PluginStoreTests.RunCatalog(args[1], args[2])) Check(ok, label);
+ Console.WriteLine(failures == 0 ? "STORE CATALOG PASSED" : $"STORE CATALOG FAILED ({failures})");
+ return failures == 0 ? 0 : 1;
+}
+if (args.Length >= 3 && args[0] == "--store-live")
+{
+ Console.WriteLine("-- get plug-ins: live installs --");
+ foreach (var (ok, label) in PluginStoreTests.RunLive(args[1], args[2..])) Check(ok, label);
+ Console.WriteLine(failures == 0 ? "STORE LIVE PASSED" : $"STORE LIVE FAILED ({failures})");
+ return failures == 0 ? 0 : 1;
+}
+
// Browser preset audition alone (fast iteration): `--audition`. Also part of the full run.
if (args.Length >= 1 && args[0] == "--audition")
{
@@ -13554,5 +13577,9 @@ Console.WriteLine("-- background audio import --");
Console.WriteLine("-- browser: preset audition --");
foreach (var (ok, label) in AuditionTests.Run()) Check(ok, label);
+// --- get plug-ins: registry index, install/uninstall from local archives ---
+Console.WriteLine("-- get plug-ins: registry store --");
+foreach (var (ok, label) in PluginStoreTests.Run()) Check(ok, label);
+
Console.WriteLine(failures == 0 ? "SMOKE TEST PASSED" : $"SMOKE TEST FAILED ({failures})");
return failures == 0 ? 0 : 1;