A Zulip bot agent to sit in our Black Sun. Ever evolving
at main 35 lines 1.7 kB view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2026 Anil Madhavapeddy <anil@recoil.org>. All rights reserved. 3 SPDX-License-Identifier: ISC 4 ---------------------------------------------------------------------------*) 5 6(** Command parsing for Poe bot. 7 8 This module provides deterministic command parsing for the Poe Zulip bot. 9 Unrecognized commands are passed through to Claude for interpretation. *) 10 11(** Admin sub-commands for storage and broadcast management. *) 12type admin_command = 13 | Last_broadcast (** Show last broadcast time *) 14 | Reset_broadcast of string (** Reset broadcast time to ISO timestamp *) 15 | Storage_keys (** List all storage keys *) 16 | Storage_get of string (** Get value for a storage key *) 17 | Storage_delete of string (** Delete a storage key *) 18 19(** Parsed bot commands. *) 20type command = 21 | Help (** Show help message *) 22 | Status (** Show bot configuration status *) 23 | Broadcast (** Broadcast new changes *) 24 | Refresh (** Pull from remote, regenerate changes, and broadcast *) 25 | Clear_session (** Clear conversation session for this channel/DM *) 26 | Admin of admin_command (** Admin commands (require authorization) *) 27 | Unknown of string (** Unrecognized command - pass to Claude *) 28 29val parse : string -> command 30(** [parse content] parses a message into a command. 31 The input should be trimmed and lowercased. *) 32 33val admin_parse : string -> admin_command option 34(** [admin_parse args] parses admin sub-command arguments. 35 Returns [None] if the arguments don't match any admin command. *)