services/admin/admin
Admin command dispatch — shared logic for REPL and TCP transports. Parses slash commands and JSON, executes against the live DB. Used by both the CLI REPL (agent.gleam) and the TCP admin listener (agent_app.gleam in daemon mode).
Types
pub type AdminCommand {
DbStats
DbCost
DbWipe(target: String)
SessionsList
SessionsShow(key: String)
SessionsDelete(key: String)
SessionsSearch(query: String)
SessionsRename(key: String, title: String)
SessionsExport(key: String)
SessionsExportAll
SessionsSetTitle(title: String)
SessionsNew(title: String)
SessionsResume(query: String)
SessionsContinue
DbPruneSessions(days: Int)
GatewaysList
GatewaysStatus
ModelsList
ModelsPrimary
DndStatus
DndSet(start: String, end: String)
DndIndefinite
DndClear
AdminHelp
}
Constructors
-
DbStats -
DbCost -
DbWipe(target: String) -
SessionsList -
SessionsShow(key: String) -
SessionsDelete(key: String) -
SessionsSearch(query: String) -
SessionsRename(key: String, title: String) -
SessionsExport(key: String) -
SessionsExportAll -
SessionsSetTitle(title: String) -
SessionsNew(title: String) -
SessionsResume(query: String) -
SessionsContinue -
DbPruneSessions(days: Int) -
GatewaysList -
GatewaysStatus -
ModelsList -
ModelsPrimary -
DndStatus -
DndSet(start: String, end: String) -
DndIndefinite -
DndClear -
AdminHelp
pub type AdminResult {
AdminOk(data: String)
AdminError(message: String)
}
Constructors
-
AdminOk(data: String) -
AdminError(message: String)
Values
pub fn execute(
cmd: AdminCommand,
conn: sqlight.Connection,
) -> AdminResult
Execute an admin command against the live database. Reads config/env for gateway and model information.
pub fn parse(input: String) -> Result(AdminCommand, String)
Parse a slash command or JSON command string into an AdminCommand. Tries JSON first; falls back to slash-command parsing.
pub fn service(port: Int, host: String) -> shapes.Service
Service shape — supervised: True. In Wave 4 the TCP listener becomes an OTP-supervised actor. Here, start validates the port is bindable and health checks that the port is reachable.