turnloop

package
v2026.1001.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxOrchestrateCompileAttempts = 3

MaxOrchestrateCompileAttempts is the maximum number of compile failures tolerated for one orchestrate request.

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 CompileRetryState added in v2026.924.0

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

CompileRetryState tracks compile failures for one orchestrate request.

func (*CompileRetryState) Observe added in v2026.924.0

func (s *CompileRetryState) Observe(result any) (bool, string)

func (*CompileRetryState) Reset added in v2026.924.0

func (s *CompileRetryState) Reset()

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)
	RecordRejectedToolCalls(turn llm.AssistantTurnResult, turnIndex int, reason string)
	HandleRejectedNativeToolCall() error
	HandleNativeToolError(err error) 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
	StampToolCallCheckpoint(toolIdx, cpSeq int, branchKey string)
	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