util

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 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,
	firstEvents <-chan api.Event,
	firstCancel context.CancelFunc,
	thread *conversation.Thread,
	temperature float32,
	maxTokens int,
	sandboxCfg *sandbox.ToolSandboxConfig,
	showThinking bool,
) error

ConsumeEvents drives the completion + tool-call loop for CLI commands. It consumes events from an initial step, auto-approves tool calls, executes them, and continues with subsequent steps until a response has no tool calls or all tools are rejected.

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