Files
Dmitry Verkhoturov 07c7926453 Update backend dependencies to latest
Update all Go modules in backend/ and backend/_example/memory_store/ to
their latest versions (chroma 2.27, go-redis 9.21, bbolt 1.5, slack 0.27,
golang.org/x/* and others); re-tidy and re-vendor, keep the example module
in sync.

Hold github.com/go-chi/chi/v5 at v5.2.5: v5.3.0 deprecates
middleware.RealIP (IP-spoofing advisories). Switching off RealIP changes
how the client IP is derived for rate limiting and votes, which is a
security decision better made on its own rather than inside a dependency
bump.

go test -race, go vet, golangci-lint and govulncheck all clean on both
modules.
2026-06-30 18:35:31 +01:00

58 lines
1.4 KiB
Go

package slack
// PlanBlock defines a block of type plan used by AI agents
// to group multiple task cards under a shared title.
//
// More Information: https://docs.slack.dev/reference/block-kit/blocks/plan-block/
type PlanBlock struct {
Type MessageBlockType `json:"type"`
BlockID string `json:"block_id,omitempty"`
Title string `json:"title"`
Tasks []TaskCardBlock `json:"tasks,omitempty"`
}
// BlockType returns the type of the block
func (s PlanBlock) BlockType() MessageBlockType {
return s.Type
}
// ID returns the ID of the block
func (s PlanBlock) ID() string {
return s.BlockID
}
// PlanBlockOption allows configuration of options for a new plan block
type PlanBlockOption func(*PlanBlock)
// PlanBlockOptionBlockID sets the block ID for the plan block
func PlanBlockOptionBlockID(blockID string) PlanBlockOption {
return func(block *PlanBlock) {
block.BlockID = blockID
}
}
// NewPlanBlock returns a new instance of a plan block
func NewPlanBlock(title string, options ...PlanBlockOption) *PlanBlock {
block := PlanBlock{
Type: MBTPlan,
Title: title,
}
for _, option := range options {
if option != nil {
option(&block)
}
}
return &block
}
// WithTasks sets the tasks for the PlanBlock
func (s *PlanBlock) WithTasks(tasks ...*TaskCardBlock) *PlanBlock {
s.Tasks = make([]TaskCardBlock, len(tasks))
for i, t := range tasks {
s.Tasks[i] = *t
}
return s
}