format

package
v0.0.1-rc99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentList

func AgentList(agents []AgentInfo, currentBotUserID string) string

AgentList formats discovered agents as a numbered list for LLM-facing text. When currentBotUserID matches an agent's ID, a marker line is added for that row.

func AuthoredPost

func AuthoredPost(post *model.Post, username string) string

AuthoredPost formats a post body with the username of its author for LLM consumption.

func BuildPostIndex

func BuildPostIndex(posts []*model.Post) map[string]int

BuildPostIndex creates a map from post ID to its 1-based display index. Used to generate "(reply to Post N)" annotations.

func MemberRole

func MemberRole(schemeAdmin, schemeGuest, schemeUser bool) string

MemberRole converts scheme booleans to a readable role string. Works for both channel and team members.

func PostBody

func PostBody(post *model.Post) string

func ThreadData

func ThreadData(data *mmapi.ThreadData) string

func WriteChannel

func WriteChannel(w *strings.Builder, entry ChannelEntry)

WriteChannel writes a formatted channel entry to the builder.

func WritePost

func WritePost(w *strings.Builder, entry PostEntry)

FormatPost writes a single formatted post entry to the builder.

func WriteTeam

func WriteTeam(w *strings.Builder, entry TeamEntry)

WriteTeam writes a formatted team entry to the builder.

func WriteUser

func WriteUser(w *strings.Builder, entry UserEntry)

WriteUser writes a formatted user entry to the builder.

Types

type AgentInfo

type AgentInfo struct {
	ID          string
	DisplayName string
	Username    string
}

AgentInfo holds display fields for formatting an AI agent list (e.g. MCP tool output).

type ChannelEntry

type ChannelEntry struct {
	HeaderLabel string         // e.g. "Channel Information:", "1. **General**"; empty to omit
	Channel     *model.Channel // the source channel
	TeamName    string         // resolved team display name
	TeamID      string         // team ID (shown when TeamName is empty but TeamID is set)
	MemberCount int64          // -1 means don't show
	Role        string         // requesting user's role: "admin" | "member" | "guest" | "not_member" | "" (omit)
}

ChannelEntry holds data for formatting a single channel.

type PostEntry

type PostEntry struct {
	// Header components
	HeaderLabel     string  // e.g. "Post 1", "Result 3"
	Username        string  // resolved username; "" → "Unknown User"
	Score           float32 // >0 means show "(Score: X.XX)" — search only
	ReplyAnnotation string  // e.g. "(reply to Post 2)" — appended to header

	// The source post
	Post *model.Post

	// Optional context metadata (search results show per-result channel info)
	ChannelName string
	TeamName    string
	ShowChannel bool // show Channel ID line

}

PostEntry holds pre-resolved data for formatting a single post. Used by MCP tools and other callers that need structured post output.

type TeamEntry

type TeamEntry struct {
	Team        *model.Team // the source team
	MemberCount int64       // -1 means don't show
}

TeamEntry holds data for formatting a single team.

type UserEntry

type UserEntry struct {
	HeaderLabel string      // e.g. "User 1"; empty for member lists
	User        *model.User // the source user
	Role        string      // "admin", "member", "guest", "" — from MemberRole
}

UserEntry holds data for formatting a single user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL