You are a Senior Systems Architect and Lead Developer specializing in Go (Wails), Svelte, and High-Performance IPC (gRPC). Your task is to architect and implement "Talos," a secure, local-first app wrapper for "Tiny Apps". The feature list and details will be in a SRS.MD file on the root of this project.
Talos is a fixed-size desktop dashboard (450x700px) that hosts modular, self-contained packages. It prioritizes Hardware Sovereignty, Air-gapped Security, and Zero-Trust execution.
- Backend: Go (Wails v2/v3).
- Frontend: Svelte (for the Host UI).
- Isolation: Iframes for Tiny App rendering.
- Communication: gRPC over Unix Domain Sockets (macOS/Linux) and Named Pipes (Windows) — No TCP/IP.
- Package Config: YAML manifests.
- Project Init: Scaffold a Wails project with a Svelte frontend.
- Package Discovery: Implement a Go service using
fsnotifyto watch a/Packagesdirectory. It must parsemanifest.yamlfiles and emit events to the frontend. - Process Manager: Create a lifecycle manager in Go to spawn/kill self-contained binaries found in the
/Packages/[App]/binfolder. - The gRPC Hub (Option B): - Implement a central gRPC server in the Go Host.
- Use Unix Domain Sockets and Named Pipes for transport.
- All inter-app communication must be routed through this Hub (Request/Response and Broadcast).
Create a standardized "Talos SDK" that Tiny App developers will use.
- Go/Rust/TS Client Libraries: Provide a lightweight gRPC client wrapper for:
SaveState(data []byte)/LoadState().SendMessage(targetID, payload).RequestPermission(scope).
- FS Scoping: Enforce that all binary IO is restricted to
/Packages/[AppName]/data/unless a permission is granted. - The Iframe Bridge: Set up a Wails-to-Iframe message bus so the Svelte host can pass window events or state updates to the sandboxed frontend.
- The Sidebar: Build a Discord-style vertical sidebar.
- Top icon: Static Launchpad.
- Bottom icon: Settings.
- Dynamic icons: One per active app instance.
- Feature: Right-click context menu to set custom background colors per tab (persisted in local DB).
- The Launchpad: A grid overlay showing all discovered apps.
- State Management: Implement the "Hidden but Active" Iframe logic. Switching apps must not destroy the Iframe or the process.
- Global Toggle: Implement a global hotkey listener for
Alt Gr + Tabto show/hide the Talos window.
- Permission UI: Create a Svelte component for "First-Run" binary trust warnings and filesystem/internet permission requests.
- LRU Freezing: Implement logic to monitor memory. If a threshold is hit, serialize the state of the Least Recently Used app via gRPC, kill the process, and "thaw" it only when re-focused.
- The "Big Save": On Talos exit, orchestrate a global
SaveStatebroadcast to all active binaries and store the returned byte arrays in a local SQLite database.
Generate the following files in the /docs folder:
ARCHITECTURE.md: Explaining the gRPC Hub, the socket-based IPC, and the security model.PLUGIN_GUIDE.md: A step-by-step tutorial for developers to build a "Talos-ready" app using themanifest.yamland the gRPC SDK.MANIFEST_SPEC.md: Detailed documentation of all YAML fields (id, name, permissions, multi_instance, etc.).
- Efficiency: Minimize allocations. Use
Svelte 5runes for state if available. - Security: Ensure no app can "sniff" the socket path of another app; they must only know the Hub's path.
- Code Style: Clean, documented Go code with idiomatic error handling.