util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureThread

func ConfigureThread(ctx *lmcli.Context, thread *conversation.Thread) error

ConfigureThread sets the thread's Agent, Model, and Effort from the application context.

func ConsumeEvents

func ConsumeEvents(ctx *lmcli.Context, events <-chan api.Event, approval chan<- []api.ToolConfirmation, thread *conversation.Thread, showThinking bool) error

ConsumeEvents iterates events from Thread.Run, streaming output to stdout with a wait animation and auto-approving tool calls. Tool calls and their results are rendered inline as they occur. If thread.Persistent is true, produced messages are appended to the thread and persisted after each round.

func FormatForExternalPrompt

func FormatForExternalPrompt(messages []conversation.Message, system bool) string

func LookupConversation

func LookupConversation(ctx *lmcli.Context, shortName string) *conversation.Conversation

lookupConversation either returns the conversation found by the short name or exits the program

func LookupConversationE

func LookupConversationE(ctx *lmcli.Context, shortName string) (*conversation.Conversation, error)

func NewSandboxConfig

func NewSandboxConfig(ctx *lmcli.Context, conv *conversation.Conversation) (*sandbox.ToolSandboxConfig, error)

NewSandboxConfig builds a ToolSandboxConfig from the application context and an optional conversation. The workspace is resolved from the conversation's Workspace field or the current working directory.

func RenderConversation

func RenderConversation(ctx *lmcli.Context, messages []conversation.Message, spaceForResponse bool)

RenderConversation renders the given messages to TTY, with optional space for a subsequent message. spaceForResponse controls how many '\n' characters are printed immediately after the final message (1 if false, 2 if true). Message blocks are built in parallel for faster rendering.

func RenderMessage

func RenderMessage(ctx *lmcli.Context, m *conversation.Message)

func StartThread

func StartThread(cmd *cobra.Command, ctx *lmcli.Context, thread *conversation.Thread)

StartThread configures the thread from the application context, renders existing messages, runs the completion loop (streaming output to stdout with auto-approved tool calls), and persists all produced messages.

Types

This section is empty.

Jump to

Keyboard shortcuts

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