turnloop

package
v2026.622.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnterStreaming

func EnterStreaming()

func FlushPendingSystem

func FlushPendingSystem(w io.Writer)

func LeaveStreaming

func LeaveStreaming(w io.Writer)

func Run

func Run(ctx context.Context, h Host) error

func StopForTest

func StopForTest(stopErr error)

func WriteSystemDeferred

func WriteSystemDeferred(w io.Writer, message string)

Types

type Host

type Host interface {
	WaitProviderReady(ctx context.Context) error
	EnsureCursorSidecar(ctx context.Context) error
	MachineMode() bool
	Out() io.Writer
	Config() *config.Root
	Provider() *config.Provider
	ModelName() string
	Backend() llm.CompletionBackend
	EphemeralSession() bool
	CompactionThreshold() int64
	MutateSession(fn func(*chatstore.Session))
	PersistSessionOrLog(context string)
	PersistSession() error
	SystemPrompt(disableThinking bool) (string, error)
	SystemPromptBtw(disableThinking bool) (string, error)
	BtwLinePrefixes() (userPrefix, assistantPrefix string)
	ReadBtwInput(out io.Writer, userPrefix, initial string) (string, error)
	LegacyToolsEnabled() bool
	LegacyToolsForced() bool
	ToolParams() ([]openai.ChatCompletionToolUnionParam, error)
	SessionMessagesSnapshot() ([]chatstore.Message, map[int]string)
	CITurn() int
	SetCITurn(int)
	CIEmit(cievents.Event)
	SetCIFinalContent(string)
	ToolCallsForCI([]chatstore.ToolCall) []map[string]any
	AllowedToolNames() (map[string]struct{}, error)
	NewLegacyStreamWriter(out io.Writer, enabled bool, allowed map[string]struct{}) (*tooling.LegacyStreamWriter, io.Writer)
	StreamOptsWithRetry(showThinking bool, reasonSink io.Writer) llm.StreamOpts
	StreamOptsCI(turnIdx int) llm.StreamOpts
	WrapLLMErr(err error) error
	ExternalToolBridge() bool
	StripCursorProxyInlineErrors(content string) (cleaned, fallback string)
	ResolveTurnInvocations(turn llm.AssistantTurnResult, legacySW *tooling.LegacyStreamWriter) ([]tooling.Invocation, []string, bool, error)
	HandleRejectedNativeToolCall() error
	HandleMalformedLegacyTool(err error) error
	SyncLegacyToolCallsToLastAssistant(invs []tooling.Invocation)
	SlashDeps(ctx context.Context) commands.Deps
	HandleProxyToolCorrection(msg string) error
	PrintToolInvocation(toolIdx int, name string, rawArgs json.RawMessage) int
	SetCurrentToolCpSeq(seq int)
	ExecTool(ctx context.Context, inv tooling.Invocation) (any, error)
	ApplyToolOutput(res any, toolName, toolCallID string) any
	NoteCIToolResult(res any)
	UserStopGeneration() error
	GenerationStoppedMessage() string
	ShowGenerationStopped(out io.Writer)
	IsMalformedLegacyToolErr(err error) bool
	BindTurnOut(w io.Writer) func()
}

Jump to

Keyboard shortcuts

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