Documentation
¶
Index ¶
- Constants
- func ExecuteCronAdd(store *cronjob.Store, ...) (cronjob.Job, string)
- func ExecuteCronRemove(store *cronjob.Store, threadKey, id string) string
- func ExecuteHelp() string
- func ExecuteInfo(pool *acp.SessionPool, threadKey string, voice *VoiceInfo) string
- func ExecuteMode(pool *acp.SessionPool, threadKey, arg string) string
- func ExecuteModel(pool *acp.SessionPool, threadKey, arg string) string
- func ExecutePicker(pool *acp.SessionPool, picker sessionpicker.Picker, ...) string
- func ExecuteReset(pool *acp.SessionPool, threadKey string) string
- func ExecuteResume(pool *acp.SessionPool, threadKey string) string
- func ExecuteSessions(pool *acp.SessionPool) string
- func ExecuteStop(pool *acp.SessionPool, threadKey string) string
- func ListCronJobs(store *cronjob.Store, threadKey string) []cronjob.Job
- func LoadPickerByID(pool *acp.SessionPool, picker sessionpicker.Picker, threadKey, id string) string
- func LoadPickerByIndex(pool *acp.SessionPool, threadKey string, n int) string
- func ParseCronArgs(args string) (sub, schedule, prompt string, err error)
- type Command
- type ModeListing
- type ModelListing
- type PickerListing
- type VoiceInfo
Constants ¶
const ( CmdSessions = "sessions" CmdReset = "reset" CmdResume = "resume" CmdInfo = "info" CmdStop = "stop" CmdPicker = "pick" CmdMode = "mode" CmdModel = "model" CmdHelp = "help" CmdCron = "cron" )
Variables ¶
This section is empty.
Functions ¶
func ExecuteCronAdd ¶ added in v0.30.0
func ExecuteCronAdd(store *cronjob.Store, threadKey, senderID, senderName, scheduleExpr, prompt string, maxPerThread int, minInterval time.Duration, tz *time.Location) (cronjob.Job, string)
ExecuteCronAdd validates the schedule, persists the job, and returns a human-readable confirmation. cfg is read for MinIntervalSeconds, Timezone, MaxPerThread.
func ExecuteCronRemove ¶ added in v0.30.0
ExecuteCronRemove deletes a job by id; returns chat-friendly text.
func ExecuteHelp ¶
func ExecuteHelp() string
ExecuteHelp returns a markdown summary of every supported bot command. Used as a discoverability fallback in chat surfaces where the platform does not render the manifest's command list — most notably Microsoft Teams channels, where the suggestion side-panel only fires in personal-scope chats.
func ExecuteInfo ¶
func ExecuteInfo(pool *acp.SessionPool, threadKey string, voice *VoiceInfo) string
ExecuteInfo returns detailed info for a specific session.
func ExecuteMode ¶
func ExecuteMode(pool *acp.SessionPool, threadKey, arg string) string
ExecuteMode sets the thread's active mode. Accepts either a mode id (exact match against Available) or a 1-based index from the most recent listing. Returns a user-facing confirmation / error string.
func ExecuteModel ¶
func ExecuteModel(pool *acp.SessionPool, threadKey, arg string) string
ExecuteModel sets the thread's active model. Accepts either a model id (exact match against Available) or a 1-based index from the most recent listing.
func ExecutePicker ¶
func ExecutePicker(pool *acp.SessionPool, picker sessionpicker.Picker, threadKey, args, cwdFilter string) string
ExecutePicker handles /pick for a chat thread. args is the trimmed argument string after the command name; cwdFilter is usually the agent pool's working_dir so the default listing stays scoped to the current project.
Supported shapes:
/pick → list up to 10 sessions matching cwdFilter /pick all → list up to 20 sessions across all cwds /pick <N> → load session at index N from the last listing /pick load <id> → load the session with that exact ID
When picker is nil (agent backend unsupported), a friendly message is returned without touching the pool.
func ExecuteReset ¶
func ExecuteReset(pool *acp.SessionPool, threadKey string) string
ExecuteReset kills the current session and returns a status message.
func ExecuteResume ¶
func ExecuteResume(pool *acp.SessionPool, threadKey string) string
ExecuteResume attempts to restore a previous session for this thread.
func ExecuteSessions ¶
func ExecuteSessions(pool *acp.SessionPool) string
ExecuteSessions returns a formatted list of all active sessions.
func ExecuteStop ¶
func ExecuteStop(pool *acp.SessionPool, threadKey string) string
ExecuteStop sends session/cancel to the agent for this thread. The current prompt stops producing output but the session (and its conversation history) is preserved — the next message keeps the context.
func ListCronJobs ¶ added in v0.30.0
ListCronJobs returns the jobs in the given thread.
func LoadPickerByID ¶
func LoadPickerByID(pool *acp.SessionPool, picker sessionpicker.Picker, threadKey, id string) string
LoadPickerByID is the shared resume-by-full-id path. Used by `/pick load <id>` and by Discord SelectMenu values (which carry the full id directly).
func LoadPickerByIndex ¶
func LoadPickerByIndex(pool *acp.SessionPool, threadKey string, n int) string
LoadPickerByIndex is the shared resume-by-cached-index path. Used by both the text `/pick <N>` and platform callbacks that carry an index in the callback data.
func ParseCronArgs ¶ added in v0.30.0
ParseCronArgs splits the tail of "/cron <sub> <rest>" into a subcommand, a schedule expression, and a prompt body. The schedule token-count varies by form:
- "0 9 * * *" — 5 tokens
- "every 5m" — 2 tokens
- "in 30m" — 2 tokens
- "at HH:MM" — 2 tokens
- "at YYYY-MM-DD HH:MM" — 3 tokens
Schedule tokens are not parsed for validity here — that is the responsibility of cronjob.ParseSchedule. We only need to know how many tokens to consume so the rest can be treated as the prompt body.
Types ¶
type Command ¶
func ParseCommand ¶
ParseCommand checks if text is a known bot command.
type ModeListing ¶
type ModeListing struct {
Message string // human-readable fallback text
Current string // current mode id (may be "")
Available []acp.ModeInfo
// Err is non-nil when the listing could not be produced (no
// session, no modes advertised, agent unresponsive). Platform
// handlers should surface this via Message and skip any UI.
Err error
}
ModeListing is the data the platform handlers need to render an interactive picker for /mode. When interactive UI is not available the text-only summary (`Message`) is shown instead.
func ListModes ¶
func ListModes(pool *acp.SessionPool, threadKey string) ModeListing
ListModes returns the mode catalogue for a thread so the platform handler can render either a text list or a select/keyboard. It performs no mutation — use ExecuteMode to actually switch.
type ModelListing ¶
ModelListing is the data the platform handlers need to render an interactive picker for /model. Mirror of ModeListing.
func ListModels ¶
func ListModels(pool *acp.SessionPool, threadKey string) ModelListing
ListModels returns the model catalogue for a thread so the platform handler can render either a text list or a select/keyboard.
type PickerListing ¶
type PickerListing struct {
Message string // human-readable listing (also used as text fallback)
Sessions []sessionpicker.Session // the actual candidates, zero-indexed
AgentType string // e.g. "kiro-cli", "claude-agent-acp"
CWD string // the cwd filter used (empty when bypassed)
BypassCWD bool // true when `all` was requested
// Err is non-nil when the listing could not be produced (picker
// unsupported or list call failed). Platforms should surface
// Message and skip rendering the picker.
Err error
}
PickerListing is the data the platform handlers need to render an interactive session picker for /pick. Platforms that can't render a widget can still show `Message` as a text fallback.
func ListPickerSessions ¶
func ListPickerSessions(picker sessionpicker.Picker, threadKey, cwdFilter string, bypassCWD bool) PickerListing
ListPickerSessions is the data-only counterpart to ExecutePicker's list path. It caches the result so a subsequent /pick <N> (or a callback-data tap carrying an index) resolves to the same session list. When picker is nil, a PickerListing with Err set and a friendly Message is returned — platforms should render the text and skip the widget.