MnemoApp.SDK 1.0.0

dotnet add package MnemoApp.SDK --version 1.0.0
                    
NuGet\Install-Package MnemoApp.SDK -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MnemoApp.SDK" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MnemoApp.SDK" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MnemoApp.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MnemoApp.SDK --version 1.0.0
                    
#r "nuget: MnemoApp.SDK, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MnemoApp.SDK@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MnemoApp.SDK&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MnemoApp.SDK&version=1.0.0
                    
Install as a Cake Tool

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

  1. 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;
}
  1. 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"]
}
  1. Package and distribute your extension as a .mnemoext file.

API Documentation

The MnemoApp SDK is organized into several API modules:

Core APIs

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();

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:

License

MIT License - See LICENSE file for details

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.