Expand description
The app server skeleton.
An application builds one of these, adds its own methods, and runs it. Everything a
sapphire app needs on the server side — owning its workspace, answering workspace.*,
pushing events — is here. A server serves one workspace at a time (#215): see
Current.
See docs/superpowers/specs/2026-09-16-process-architecture-design.md §4.
ⓘ
static CTX: AppContext = AppContext::new("sapphire-journal");
AppServer::new(&CTX, env!("CARGO_PKG_VERSION"))
.extend(|router| router.method("journal.create_entry", create_entry))
.run()
.await?;Application methods are named <app>.<method>. The framework owns workspace.* and
server.*; anything else is the application’s.
Re-exports§
pub use sync::BackfillTiming;pub use sync::BridgeConnector;pub use sync::SyncRuntime;pub use sync::SyncStatus;pub use sync::sync_router;
Modules§
- sync
- Replication, from the app server’s side.
Structs§
- AppServer
- An application’s server.
- Current
- The server’s current workspace.
- Http
Config - The
[http]table: the listener every HTTP route shares. - McpConfig
- The
[mcp]table. - Selection
- What
workspace.tomlholds. - Selection
File - The selection file, read and written whole.
- Server
Config - What
server.tomlholds. - Status
Report - The typed answer to a status question, shared by the CLI and the IPC
server.inforesponse (spec decision 4). - Status
Row - One application-provided line of the status report.
- Workspace
Host - The workspace this server has open.
Enums§
- Device
Command - The
devicesubcommands. - Error
- Errors raised while serving an application’s workspaces.
- Framework
Command - The framework’s commands, flattened into an application’s CLI (spec decision 2).
- Workgroup
Command - The
workgroupsubcommands. - Workspace
Command - The
workspacesubcommands (#215: one workspace per server). - Workspace
Sync Command - The
workspace syncsubcommands: the server’s workspace’s sync, switched after the fact.
Constants§
- SELECTION_
FILE - The file’s name inside the application’s config directory.
- SERVER_
CONFIG_ FILE - The file’s name inside the application’s config directory.
Functions§
- render_
workspace - Render the server’s workspace as the CLI prints it:
root state. - subscribe_
method - Add
workspace.subscribetorouter. - workspace_
router - The file methods of
workspace.*, on the current workspace (#215).
Type Aliases§
- Result
- Convenience alias for server results.