Documentation
¶
Overview ¶
Package chat provides an interactive conversational PM interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PlanConversation ¶ added in v0.0.7
func PlanConversation(history []PlanMessage, msg string) string
PlanConversation renders the earlier turns and the new message as the prompt. Turns in any role but user and assistant are dropped.
func PlanSystemPrompt ¶ added in v0.0.7
func PlanSystemPrompt(ps *state.ProjectState) string
PlanSystemPrompt describes the project to the plan assistant: its goal, progress, and every task with its status, priority, dependencies and annotations. A nil state, or one without a plan, says so.
Types ¶
type Action ¶
type Action struct {
Type ActionType
Args []string // parsed arguments
Raw string // original directive line
}
Action represents a PM directive embedded in an AI response.
func ParseActions ¶
ParseActions scans AI output for embedded PM directives. Directives look like: ACTION:TASK_DONE:3 or ACTION:TASK_CREATE:Title:Description:2
type ActionResult ¶
ActionResult records what happened when an action was applied.
type ActionType ¶
type ActionType string
ActionType identifies the kind of PM action the AI wants to take.
const ( ActionTaskDone ActionType = "TASK_DONE" ActionTaskFail ActionType = "TASK_FAIL" ActionTaskSkip ActionType = "TASK_SKIP" ActionTaskStart ActionType = "TASK_START" ActionTaskCreate ActionType = "TASK_CREATE" ActionNote ActionType = "NOTE" ActionGoalDone ActionType = "GOAL_COMPLETE" )
type PlanMessage ¶ added in v0.0.7
PlanMessage is one earlier turn of a plan-assistant conversation, as the dashboard keeps it.
func RecentPlanHistory ¶ added in v0.0.7
func RecentPlanHistory(history []PlanMessage, maxBytes int) []PlanMessage
RecentPlanHistory keeps the latest turns whose contents together fit in maxBytes, in their order. The conversation travels to the executor as an argument, which the kernel bounds, so a long one is cut from its start: the assistant sees the most recent exchange, which is what the question is about. A turn that alone exceeds the budget ends the window.
type Session ¶
type Session struct {
State *state.ProjectState
Memory *memory.Memory
History []Turn
Provider provider.Provider
Model string
Timeout time.Duration
// OnToken, if set, enables streaming mode. Each token chunk is passed
// to this callback as the AI generates its response.
OnToken func(token string)
// Action callbacks — called when AI emits a PM directive.
OnTaskUpdate func(taskID int, status pm.TaskStatus) error
OnTaskCreate func(title, description string, priority int) (*pm.Task, error)
OnNote func(text string) error
}
Session holds the state of an interactive chat session.
func NewSession ¶
func NewSession(s *state.ProjectState, mem *memory.Memory, prov provider.Provider, model string) *Session
NewSession creates a new chat session.