Skip to content

M3x Mesh and Extensions

Puzzak edited this page Nov 20, 2026 · 1 revision

M3x Mesh Ecosystem & Extensions

PAIOS connects to built-in tools and external sibling apps locally over M3x Mesh (packages/m3x_mesh), an on-device Android IPC layer built on ContentProvider endpoints (*.mesh) and JSON-RPC—with zero cloud relays.


Inter-App IPC Architecture (content://page.puzzak.paios.mesh)

External apps and PAIOS communicate over Android ContentProvider authorities following the <package>.mesh convention:

1. External Apps -> PAIOS (page.puzzak.paios)

External M3x Mesh clients target content://page.puzzak.paios.mesh (resolved automatically for 'paios' or legacy 'geminilocal' identifiers) to query on-device AI:

  • query_local_ai: Invokes headless or interactive Gemini Nano inference via MainActivity.registerHeadlessMeshHandler -> MeshOverlayActivity (Mode A silent RPC pill or Mode B interactive sheet when open_assistant_bubble / interactive_bubble: true is passed).
  • get_ai_status: Probes model readiness and engine availability (M3xMeshClient.checkAppStatus).

2. PAIOS -> Sibling Extensions

PAIOS discovers installed *.mesh providers on the device (up to a 2-second discovery timeout per app and 16-second IPC execution timeout in M3xMeshClient.callTool), allowing Gemini Nano to chain up to 6 tool turns per user message.

  • Schema Compaction: InternalToolsHelper.getMeshToolSchemaPrompt compacts tool definitions and drops redundant "description" bloat so enabled tool schemas fit comfortably inside Gemini Nano's context window (3500 chars budget on Nano v4, 2200 chars on Nano v3).
  • Tool Registry Synchronization: AIEngine._syncInternalToolRegistrations keeps toolRegistry synchronized with Settings -> Extensions toggles on init and setExtensionEnabled, ensuring disabled tools are omitted from prompts, M3xMesh discovery, and execution.
  • Permission Model:
    • First-party Puzzak extensions (page.puzzak.*, com.puzzak.*) are enabled by default.
    • Third-party extensions are disabled by default until toggled on individually or via "Allow all new extensions" in Settings -> Extensions, which also includes a live parameter schema inspector.

Compatible Sibling Apps (mesh_proposals.json)

App Package ID Mesh Authority Capabilities Status
PTK (Puzzak's ToolKit) page.puzzak.ptk content://page.puzzak.ptk.mesh Server telemetry, Statuspage incident monitoring, TCP ping & subnet diagnostics Available (Play Store)
Alerts page.puzzak.alerts content://page.puzzak.alerts.mesh Ukraine air raid alerts and map status Available (Play Store)
Speech Services (TinyASR & TTS) page.puzzak.speech content://page.puzzak.speech.mesh Standalone offline STT (Rust TinyASR + Silero VAD) & neural TTS over android.speech.RecognitionService + M3x Mesh, with multi-language packs including Ukrainian & English Planned (Roadmap)

Why Speech Services (page.puzzak.speech) Is a Standalone Companion APK

Rather than bundling heavy Rust ASR runtimes, VAD models, and TTS voice packs directly inside page.puzzak.paios, voice input/output is architected as a dedicated M3x Mesh companion app implementing android.speech.RecognitionService, TextToSpeech, and an offline Live Voice loop over M3xMesh. This keeps PAIOS dependency-light and modular while enabling shared offline speech services across the Puzzak ecosystem.


Built-in Extension Modules

PAIOS ships five built-in modules implemented identically across Dart (InternalToolsService) and native Kotlin (InternalToolsHelper.kt) so tools behave consistently in both ChatPage and MeshOverlayActivity:

Offline Default-ON Modules

Module ID Tool Name(s) Behavior
paios.docs query_aicore_documentation (aliases: about_paios, paios_info, get_paios_info) Searches bundled & cached PAIOS, AICore, and ML Kit GenAI documentation offline (including PAIOS self-knowledge sections).
paios.device get_battery_status Reads live battery percentage, charging status, and power state. Explicitly guarded against triggering on visual/screenshot questions.
Overlay Built-in inspect_screen (app: "paios") Available inside MeshOverlayActivity for lazy 3-turn TTL screenshot + AssistStructure inspection.

Opt-In Online Default-OFF Modules

All online modules are disabled by default for strict offline privacy and return clean offline errors (checkOnline() parallel DNS/TCP checks) when unreachable:

Module ID Tool Name(s) Provider & Notes
paios.wikipedia wikipedia_summary, wikipedia_details Fetches Wikipedia REST summaries and section-ranked article details (with 25s timeout fallback and wikipedia_details -> wikipedia_summary fallback).
paios.search duckduckgo_search Queries DuckDuckGo Instant Answer API for quick definitions and snippets (gates wikipedia_summary hints on paios.wikipedia enablement).
paios.weather weather_forecast Retrieves current weather conditions, WMO weather codes, and 2-day forecasts via Open-Meteo.

Related Pages: Offline Tooling & Built-in Documentation · System Assistant Overlay & Screen Inspection · Architecture & Model Variants

Clone this wiki locally