MnemoApp.SDK
1.0.0
dotnet add package MnemoApp.SDK --version 1.0.0
NuGet\Install-Package MnemoApp.SDK -Version 1.0.0
<PackageReference Include="MnemoApp.SDK" Version="1.0.0" />
<PackageVersion Include="MnemoApp.SDK" Version="1.0.0" />
<PackageReference Include="MnemoApp.SDK" />
paket add MnemoApp.SDK --version 1.0.0
#r "nuget: MnemoApp.SDK, 1.0.0"
#:package MnemoApp.SDK@1.0.0
#addin nuget:?package=MnemoApp.SDK&version=1.0.0
#tool nuget:?package=MnemoApp.SDK&version=1.0.0
MnemoApp SDK
Official SDK for developing extensions and themes for MnemoApp — a privacy-first, extensible learning platform.
Overview
The MnemoApp SDK provides developers with a comprehensive set of APIs to create custom extensions and themes that integrate seamlessly with the application.
- Extensions - Add custom features and functionality
- Themes - Create custom visual styles
- Full API Access - Leverage AI, storage, UI, navigation, and more
Installation
Add the SDK package to your extension project:
dotnet add package MnemoApp.SDK --version 1.0.0
Or include it directly:
dotnet add reference ../SDK/MnemoApp.SDK.csproj
Quick Start
Creating Your First Extension
- Implement
IMnemoExtension:
using MnemoApp.SDK.Core.Extensions;
using MnemoApp.SDK.APIs;
public class MyExtension : IMnemoExtension
{
public async Task OnLoadAsync(IExtensionContext context)
{
// Initialize your extension
context.Logger.LogInfo("Extension loaded!");
// Access the MnemoApp API
await context.API.UI.Toast.Show("Hello from my extension!");
}
public Task OnUnloadAsync() => Task.CompletedTask;
public Task OnEnableAsync() => Task.CompletedTask;
public Task OnDisableAsync() => Task.CompletedTask;
}
- Create
manifest.json:
{
"id": "my-extension",
"name": "My Extension",
"version": "1.0.0",
"description": "A sample extension",
"author": "Your Name",
"type": "Extension",
"minimumAppVersion": "1.0.0",
"requestedPermissions": ["UIAccess"]
}
- Package and distribute your extension as a
.mnemoextfile.
API Documentation
The MnemoApp SDK is organized into several API modules:
Core APIs
Navigation API (api.Navigate)
Control app navigation and breadcrumbs.
// Navigate to view model
api.Navigate.Navigate<MyViewModel>();
// Navigate with breadcrumb
api.Navigate.Navigate(viewModel, "My Page", clearBreadcrumbs: true);
// Go back
api.Navigate.GoBack();
Sidebar API (api.Sidebar)
Register custom navigation items.
api.Sidebar.Register(
"My Feature",
typeof(MyViewModel),
"Extensions",
"avares://MyExtension/icon.svg"
);
UI APIs
Toast Notifications (api.UI.Toast)
Display temporary notifications.
api.UI.Toast.Show("Success!", "Operation completed", ToastType.Success);
// Status toast with progress
var toastId = api.UI.Toast.ShowStatus("Processing...", ToastType.Process);
api.UI.Toast.UpdateStatus(toastId, progress: 0.5);
api.UI.Toast.CompleteStatus(toastId);
Overlays (api.UI.Overlay)
Show modal dialogs and overlays.
// Show confirmation dialog
var result = await api.UI.Overlay.CreateDialogAsync(
"Confirm Action",
"Are you sure?",
"Yes",
"No"
);
// Show custom overlay
var control = new MyCustomControl();
var result = await api.UI.Overlay.ShowAsync<bool>(control);
Themes (api.UI.Themes)
Access and manage application themes.
var themes = await api.UI.Themes.GetAllThemesAsync();
await api.UI.Themes.SetThemeAsync("Dark");
Languages (api.UI.Language)
Localization and language management.
var current = api.UI.Language.GetCurrentLanguage();
var text = api.UI.Language.Get("Common", "Save");
await api.UI.Language.SetLanguageAsync("es-ES");
Data & Storage APIs
Data API (api.Data)
Persistent data storage.
// Store data
api.Data.SetProperty("myKey", myValue);
// Retrieve data
var value = api.Data.GetProperty<MyType>("myKey");
// Check existence
if (api.Data.HasProperty("myKey"))
{
api.Data.RemoveProperty("myKey");
}
Settings API (api.Settings)
Application settings.
api.Settings.SetString("preference", "value");
var pref = api.Settings.GetString("preference", "default");
api.Settings.SetBool("enabled", true);
var enabled = api.Settings.GetBool("enabled");
AI APIs (api.AI)
Integrate AI model inference.
// Get available models
var models = await api.AI.GetAllModelsAsync();
// Create inference request
var request = api.AI.CreateRequest("gpt-3.5-turbo", "Hello world");
// Perform inference
var response = await api.AI.InferAsync(request);
// Streaming inference
await foreach (var token in api.AI.InferStreamAsync(request))
{
Console.Write(token);
}
Task APIs (api.Tasks)
Schedule background tasks.
// Schedule custom task
var taskId = api.Tasks.ScheduleTaskAsync(myTask);
// Track progress
api.Tasks.TaskProgressChanged += (s, e) =>
{
Console.WriteLine($"Progress: {e.Progress.Percent}%");
};
// Schedule AI generation
var genId = api.Tasks.ScheduleAIGeneration(
"Write a story",
"Story Generation"
);
File APIs (api.Files)
Process files in various formats.
// Check file support
if (api.Files.IsFileSupported("document.pdf"))
{
var content = await api.Files.ProcessFileAsync("document.pdf");
}
// Get supported extensions
var exts = api.Files.GetSupportedExtensions();
// Register custom processor
api.Files.RegisterProcessor(new MyFileProcessor());
LaTeX API (api.Latex)
Render mathematical expressions.
// Render LaTeX
var control = await api.Latex.RenderAsync("\\frac{a}{b}");
// Validate syntax
if (api.Latex.IsValid("\\sum_{i=1}^{n} i"))
{
var symbols = api.Latex.GetAvailableSymbols();
}
Extension Management (api.Extensions)
Manage extensions programmatically.
// List installed extensions
var installed = api.Extensions.ListInstalled();
// Enable/disable extensions
await api.Extensions.EnableAsync("extension-id");
await api.Extensions.DisableAsync("extension-id");
// Install from path
var result = await api.Extensions.InstallAsync("path/to/extension.mnemoext");
Extension Permissions
Extensions can request specific permissions:
public enum ExtensionPermission
{
FileAccess, // Read/write files
NetworkAccess, // HTTP and network
UIAccess, // Register UI components
ApiRegistration, // Custom API endpoints
FullTrust // Complete access
}
Check permissions:
if (context.HasPermission(ExtensionPermission.FileAccess))
{
// Perform file operations
}
// Request at runtime
bool granted = await context.RequestPermissionAsync(ExtensionPermission.NetworkAccess);
Extension Manifest
Define your extension with manifest.json:
{
"id": "com.example.my-extension",
"name": "My Extension",
"version": "1.0.0",
"description": "What my extension does",
"author": "Your Name",
"type": "Extension",
"minimumAppVersion": "1.0.0",
"requestedPermissions": ["UIAccess", "FileAccess"],
"custom": {
"website": "https://example.com",
"repository": "https://github.com/example/my-extension"
}
}
Best Practices
1. Request Minimal Permissions
Only request the permissions you actually need.
2. Handle Errors Gracefully
try
{
await context.API.AI.InferAsync(request);
}
catch (Exception ex)
{
context.Logger.LogError("Inference failed", ex);
}
3. Namespace Storage Keys
Prevent conflicts with other extensions:
string key = $"{context.StoragePrefix}_myKey";
api.Data.SetProperty(key, value);
4. Clean Up Resources
Properly dispose resources in OnUnloadAsync:
public async Task OnUnloadAsync()
{
// Unregister UI components
api.Sidebar.Unregister("My Feature", "Extensions");
// Clean up resources
// ...
}
5. Use Async Methods
Always prefer async methods for better performance:
// Good
await api.AI.InferAsync(request);
// Avoid synchronous calls
6. Validate Input
Never trust external data:
if (string.IsNullOrEmpty(input) || input.Length > 1000)
{
throw new ArgumentException("Invalid input");
}
7. Log Properly
Use the logger provided by context:
context.Logger.LogInfo("Extension initialized");
context.Logger.LogWarning("This might be an issue");
context.Logger.LogError("Something failed", ex);
Extension Types
Standard Extensions
Add custom features to MnemoApp:
public class FeatureExtension : IMnemoExtension
{
public async Task OnLoadAsync(IExtensionContext context)
{
// Register custom views
context.API.Sidebar.Register(...);
// Add topbar buttons
context.API.UI.Topbar.AddButton(...);
}
}
Theme Extensions
Create custom visual themes:
{
"id": "my-theme",
"name": "My Theme",
"type": "Theme",
"requestedPermissions": ["UIAccess"]
}
Troubleshooting
Permission Denied
Check that your extension requests the required permissions in manifest.json.
API Not Available
Ensure the service is registered. Check the extension state and logs.
UI Not Showing
Verify you have UIAccess permission and components are properly registered.
Storage Errors
Check that you're using the correct StorageScope and prefixing keys with context.StoragePrefix.
Examples
Example 1: Simple Notification Extension
public class NotificationExtension : IMnemoExtension
{
public async Task OnLoadAsync(IExtensionContext context)
{
context.API.UI.Toast.Show(
"Welcome!",
"Notification extension loaded",
ToastType.Success
);
}
public Task OnUnloadAsync() => Task.CompletedTask;
public Task OnEnableAsync() => Task.CompletedTask;
public Task OnDisableAsync() => Task.CompletedTask;
}
Example 2: AI-Powered Extension
public class AIExtension : IMnemoExtension
{
public async Task OnLoadAsync(IExtensionContext context)
{
var models = await context.API.AI.GetAllModelsAsync();
if (models.Any())
{
var request = context.API.AI.CreateRequest(
models.First().Name,
"Summarize this text: ..."
);
var result = await context.API.AI.InferAsync(request);
context.API.UI.Toast.Show("Summary", result);
}
}
public Task OnUnloadAsync() => Task.CompletedTask;
public Task OnEnableAsync() => Task.CompletedTask;
public Task OnDisableAsync() => Task.CompletedTask;
}
Support
For issues, questions, or contributions:
- GitHub: https://github.com/ShadowCCS/mnemoapp
- Documentation: See
/docs/EXTENSION_API_DOCUMENTATION.md
License
MIT License - See LICENSE file for details
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Avalonia (>= 11.3.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 224 | 11/1/2025 |
Initial release of MnemoApp SDK. Provides complete API surface for extension and theme development.