chat

package
v5.24.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package chat provides an interactive Bubbletea TUI for conversing with GitHub Copilot. It renders assistant responses as markdown with syntax highlighting using glamour.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(
	ctx context.Context,
	session *copilot.Session,
	timeout time.Duration,
) error

Run starts the chat TUI and returns a permission handler for integration with the Copilot SDK. The returned handler can be used with SessionConfig.OnPermissionRequest to enable interactive permission prompting within the TUI.

func RunWithEventChannel

func RunWithEventChannel(
	ctx context.Context,
	session *copilot.Session,
	timeout time.Duration,
	eventChan chan tea.Msg,
) error

RunWithEventChannel starts the chat TUI with a pre-created event channel. This allows external code (like permission handlers) to send events to the TUI.

Types

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the Bubbletea model for the chat TUI.

func New

func New(session *copilot.Session, timeout time.Duration) *Model

New creates a new chat TUI model.

func NewWithEventChannel

func NewWithEventChannel(
	session *copilot.Session,
	timeout time.Duration,
	eventChan chan tea.Msg,
) *Model

NewWithEventChannel creates a new chat TUI model with an optional pre-existing event channel. If eventChan is nil, a new channel is created. This allows external code to send events to the TUI (e.g., permission requests).

func (*Model) GetEventChannel

func (m *Model) GetEventChannel() chan tea.Msg

GetEventChannel returns the model's event channel for external use. This is useful for creating permission handlers that can send events to the TUI.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the model and returns an initial command.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates the model.

func (*Model) View

func (m *Model) View() string

View renders the TUI.

type ToolOutputChunkMsg

type ToolOutputChunkMsg struct {
	ToolID string
	Chunk  string
}

ToolOutputChunkMsg is the exported version of toolOutputChunkMsg for external use.

Jump to

Keyboard shortcuts

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