Documentation
¶
Index ¶
- Variables
- func AddAccountIDs(params url.Values, accountIDs string)
- func AddCSVParam(params url.Values, key, csv string)
- func ChatTypeToAPI(value string) string
- func ConfirmPrompt(r io.Reader, w io.Writer, prompt string) (bool, error)
- func ExtractBracketedTokenValue(input, key string) (string, bool)
- func ExtractChatIDFromString(input string) (string, bool)
- func ExtractMessageIDFromString(input string) (string, bool)
- func FilterChats(chats []api.Chat, unreadOnly, mutedOnly, pinnedOnly, archivedOnly bool, ...) []api.Chat
- func FilterUnreadMessages(messages []api.Message, unreadOnly bool) []api.Message
- func FormatHandle(kind string, index int) string
- func FormatMessageLine(m api.Message, otherName string) string
- func FormatTime(t time.Time) string
- func IsReservedKeyword(input string) bool
- func IsSelfMessage(senderID string) bool
- func LimitReplyDepth(messages []api.Message, maxDepth int) []api.Message
- func LimitSlice[T any](items []T, limit int) []T
- func LooksLikeChatID(s string) bool
- func MessageDisplayText(m api.Message) string
- func MessageSender(m api.Message) string
- func MessageSenderDisplay(m api.Message, otherName string) string
- func MinInt(a, b int) int
- func NewestSortKey(messages []api.Message) string
- func NormalizeDateAfter(value string) string
- func OffsetSlice[T any](items []T, offset int) []T
- func OldestSortKey(messages []api.Message) string
- func OtherChatName(chat api.Chat) string
- func PaginateSlice[T any](items []T, offset, limit int) []T
- func ParseRelativeTime(s string, now time.Time) (time.Time, error)
- func Poll(ctx context.Context, interval time.Duration, fn func(context.Context) error, ...) error
- func PrintMessageLine(w io.Writer, m api.Message, otherName string)
- func ReadFile(path string) (string, error)
- func ReadStdin(r io.Reader) (string, error)
- func ResolveChatByName(ctx context.Context, client *api.Client, accountIDs string, name string, ...) (string, error)
- func ResolveChatIDFromArgOrFlag(ctx context.Context, client *api.Client, accountIDs string, args []string, ...) (string, error)
- func ResolveChatIDFromFlags(ctx context.Context, client *api.Client, accountIDs string, ...) (string, error)
- func ResolveChatIdentifier(input string, aliases map[string]string, noteToSelfID string) (string, error)
- func ResolveMessageInput(text string, stdin bool, file string, in io.Reader) (string, error)
- func SenderName(senderID string) string
- func SortMessagesByTime(messages []api.Message) []api.Message
- func StripShellEscape(s string) string
- func TailSlice[T any](items []T, limit int) []T
- func Truncate(s string, max int) string
- type ChatAmbiguityError
- type ChatResolveOptions
- type HandleRef
- type NameFlags
Constants ¶
This section is empty.
Variables ¶
ReservedKeywords contains keywords that cannot be used as aliases. These resolve to special chats (e.g., "myself", "self", "me" -> Note to Self).
Functions ¶
func AddAccountIDs ¶
func AddCSVParam ¶
func ChatTypeToAPI ¶ added in v0.2.5
ChatTypeToAPI translates user-facing chat type to API value. The CLI uses "dm" for user friendliness, but the API expects "single".
func ExtractBracketedTokenValue ¶ added in v0.2.6
ExtractBracketedTokenValue extracts the value from a bracketed token like:
"... [chat:!abc] ..." "... [id:$msg123] ..."
It returns the content after "key:" up to the closing "]".
func ExtractChatIDFromString ¶ added in v0.2.6
ExtractChatIDFromString extracts a chat ID from common agent output tokens. Supported forms:
"[chat:!abc]" anywhere in the string "chat:!abc" as a standalone value
func ExtractMessageIDFromString ¶ added in v0.2.6
ExtractMessageIDFromString extracts a message ID from common agent output tokens. Supported forms:
"[id:$msg]" anywhere in the string "id:$msg" as a standalone value "↩$msg" reply indicator copied from agent output
func FilterChats ¶
func FilterUnreadMessages ¶
func FormatHandle ¶ added in v0.2.5
FormatHandle formats a handle token for output.
func FormatTime ¶
func IsReservedKeyword ¶ added in v0.2.1
IsReservedKeyword returns true if the input is a reserved keyword.
func IsSelfMessage ¶ added in v0.2.3
IsSelfMessage returns true if the senderID belongs to the current user.
func LimitReplyDepth ¶ added in v0.2.1
LimitReplyDepth truncates reply chains beyond maxDepth. depth 0 = unlimited, depth 1 = no replies, depth 2 = one level of replies, etc.
func LimitSlice ¶
func LooksLikeChatID ¶
LooksLikeChatID returns true if the string looks like a chat ID rather than a name.
func MessageDisplayText ¶
func MessageSender ¶
func NewestSortKey ¶
func NormalizeDateAfter ¶
func OffsetSlice ¶ added in v0.2.1
OffsetSlice skips the first n items from a slice.
func OldestSortKey ¶
func OtherChatName ¶
func PaginateSlice ¶ added in v0.2.1
PaginateSlice applies offset and limit to a slice.
func ParseRelativeTime ¶ added in v0.2.1
ParseRelativeTime parses human-friendly time expressions. Supports: "2h ago", "yesterday", "monday", "next tue", "30m", RFC3339, YYYY-MM-DD.
func Poll ¶
func Poll(ctx context.Context, interval time.Duration, fn func(context.Context) error, onError func(error) bool) error
Poll runs fn every interval until the context is canceled. If onError is nil, any error from fn stops polling. If onError returns true, polling continues after an error.
func ResolveChatByName ¶
func ResolveChatByName(ctx context.Context, client *api.Client, accountIDs string, name string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatByName searches for a chat by name and returns its ID. If multiple matches are found, it errors unless First is set.
func ResolveChatIDFromArgOrFlag ¶
func ResolveChatIDFromArgOrFlag(ctx context.Context, client *api.Client, accountIDs string, args []string, flagValue, flagName string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatIDFromArgOrFlag resolves a chat ID using either a flag value (chat name) or a positional chat ID argument.
func ResolveChatIDFromFlags ¶
func ResolveChatIDFromFlags(ctx context.Context, client *api.Client, accountIDs string, nameFlag, idFlag, nameLabel, idLabel string, opts ChatResolveOptions, warn io.Writer) (string, error)
ResolveChatIDFromFlags resolves a chat ID using either a chat name or explicit chat ID flag.
func ResolveChatIdentifier ¶ added in v0.2.1
func ResolveChatIdentifier(input string, aliases map[string]string, noteToSelfID string) (string, error)
ResolveChatIdentifier resolves a chat identifier to a chat ID. Resolution order: 1. Reserved keywords (myself, self, me) -> Note to Self chat 2. Literal chat ID (starts with !) -> return as-is 3. Alias lookup -> resolved ID 4. Error
func ResolveMessageInput ¶
func SenderName ¶
func StripShellEscape ¶ added in v0.2.7
StripShellEscape removes shell-escaped backslashes from chat IDs. In zsh (macOS default), "!" inside double quotes is escaped to "\!", so a user typing --chat "!abc:server" actually passes "\!abc:server". This strips the leading backslash to recover the real chat ID.
Types ¶
type ChatAmbiguityError ¶ added in v0.2.3
type ChatAmbiguityError struct {
Query string
Matches []api.Chat
// contains filtered or unexported fields
}
func (*ChatAmbiguityError) Error ¶ added in v0.2.3
func (e *ChatAmbiguityError) Error() string
type ChatResolveOptions ¶
type HandleRef ¶ added in v0.2.5
HandleRef identifies a handle token like @chat:1 or @msg:2.
func ExtractHandleRefFromString ¶ added in v0.2.6
ExtractHandleRefFromString finds a handle reference either as a standalone token ("@chat:1") or embedded in brackets within a longer string ("... [@chat:1] ...").
func ParseHandleRef ¶ added in v0.2.5
ParseHandleRef parses handle tokens such as @chat:1, @msg:2, @contact:3.