Documentation
¶
Overview ¶
Package chat implements shared persisted chat orchestration for Kodelet UIs.
Index ¶
- Constants
- func AddEnvironmentCommandDisplay(thread llmtypes.Thread, result agentenv.CommandResult)
- func AddExtensionCommandDisplay(thread llmtypes.Thread, result *extensions.RoutedCommandResult)
- func AddGoalDisplay(thread llmtypes.Thread, update *goals.CommandUpdate)
- func AddSlashCommandDisplay(thread llmtypes.Thread, expansion *slashcommands.Expansion)
- func ApplyCommandRestrictions(ctx context.Context, llmConfig *llmtypes.Config, result agentenv.CommandResult)
- func ApplyFragmentRestrictions(ctx context.Context, llmConfig *llmtypes.Config, ...)
- func BuildState(ctx context.Context, llmConfig llmtypes.Config, sessionID string, ...) (*tools.BasicState, error)
- func ExpandCWDInput(query, defaultCWD string) (string, error)
- func ExpandSlashCommand(ctx context.Context, message string, cwd string) (string, *slashcommands.Expansion, error)
- func IsNaturalDirectoryQuery(query string) bool
- func NormalizeEnvironmentProfile(profile string) string
- func NormalizeRequest(req ChatRequest) (string, []string, error)
- func NormalizeRequestedProfile(profile string) string
- func ResolveConfig(ctx context.Context, ...) (llmtypes.Config, string, error)
- func ResolveConfigForExistingConversation(record *conversationservice.GetConversationResponse, ...) (llmtypes.Config, error)
- func ResolveConfigForNewConversation(requestedProfile string, requestedReasoningEfforts ...string) (llmtypes.Config, error)
- func ResolveConfigWithReasoning(ctx context.Context, ...) (llmtypes.Config, string, error)
- func ResolveConfiguredDefaultCWD(configuredCWD string) (string, error)
- func ResolveExtensionCallContext(ctx context.Context, conversationID, cwd string, config llmtypes.Config) (extensions.ExtensionCallContext, error)
- func ResolveRemoteConfigWithReasoning(ctx context.Context, ...) (llmtypes.Config, error)
- func ResolveRemoteConfigWithReasoningAndEnvironmentProfile(ctx context.Context, ...) (llmtypes.Config, string, error)
- func RunDefaultChat(ctx context.Context, req ChatRequest, sink ChatEventSink, defaultCWD string, ...) (string, error)
- func TransformSlashCommand(ctx context.Context, message string, cwd string) (string, *slashcommands.Expansion, *goals.CommandUpdate, error)
- func TransformSlashCommandIfNeeded(ctx context.Context, message string, cwd string, enabled bool) (string, *slashcommands.Expansion, *goals.CommandUpdate, error)
- func TryExtensionCommand(ctx context.Context, message string, extensionRuntime *extensions.Runtime, ...) (*extensions.RoutedCommandResult, bool, error)
- func ValidateConversationAdoptionConfig(record *conversations.GetConversationResponse) (llmtypes.Config, error)
- type AnthropicAccountMutation
- type AnthropicAccountSummary
- type AnthropicAccountUsage
- type AnthropicAccounts
- type AnthropicLogin
- type AnthropicUsageWindow
- type ChatClientCapabilities
- type ChatContentBlock
- type ChatEvent
- type ChatEventSink
- type ChatImageSource
- type ChatImageURLSource
- type ChatRequest
- type ChatRunner
- type CodexStatus
- type ControlPlaneChatRunner
- func (r *ControlPlaneChatRunner) AdoptConversation(ctx context.Context, id string, params ConversationAdoptionRequest) (ConversationAdoptionResult, error)
- func (r *ControlPlaneChatRunner) AnthropicAccountUsage(ctx context.Context, alias string) (AnthropicAccountUsage, error)
- func (r *ControlPlaneChatRunner) AnthropicAccounts(ctx context.Context) (AnthropicAccounts, error)
- func (r *ControlPlaneChatRunner) CancelAnthropicLogin(ctx context.Context, id string) error
- func (r *ControlPlaneChatRunner) CancelProviderDeviceLogin(ctx context.Context, provider, id string) error
- func (r *ControlPlaneChatRunner) ChatSettings(ctx context.Context, profile string) (ControlPlaneChatSettings, error)
- func (r *ControlPlaneChatRunner) CodexStatus(ctx context.Context) (CodexStatus, error)
- func (r *ControlPlaneChatRunner) CompleteAnthropicLogin(ctx context.Context, id, code, alias string) (AnthropicLogin, error)
- func (r *ControlPlaneChatRunner) CreateCommit(ctx context.Context, target WorkspaceTarget, ...) (protocol.WorkspaceGitCommitResult, error)
- func (r *ControlPlaneChatRunner) DeleteConversation(ctx context.Context, conversationID string) error
- func (r *ControlPlaneChatRunner) DiscoverWorkspace(ctx context.Context, target WorkspaceTarget) (protocol.WorkspaceDiscoverResult, error)
- func (r *ControlPlaneChatRunner) ExecuteWorkspaceShortcut(ctx context.Context, request WorkspaceShortcutRequest) (runnerpayload.ShortcutExecuteResult, error)
- func (r *ControlPlaneChatRunner) ForkConversation(ctx context.Context, conversationID string) (string, error)
- func (r *ControlPlaneChatRunner) GetTurnReceipt(ctx context.Context, conversationID, turnID string) (TurnReceipt, error)
- func (r *ControlPlaneChatRunner) InspectWorkspace(ctx context.Context, target WorkspaceTarget, ...) (protocol.WorkspaceInspectResult, error)
- func (r *ControlPlaneChatRunner) ListConversations(ctx context.Context, limit int) ([]convtypes.ConversationSummary, error)
- func (r *ControlPlaneChatRunner) ListConversationsInCWD(ctx context.Context, limit int, cwd string) ([]convtypes.ConversationSummary, error)
- func (r *ControlPlaneChatRunner) LoadConversation(ctx context.Context, conversationID string) (ConversationHistory, error)
- func (r *ControlPlaneChatRunner) LoadConversationRecord(ctx context.Context, conversationID string) (convtypes.ConversationRecord, error)
- func (r *ControlPlaneChatRunner) MutateAnthropicAccount(ctx context.Context, mutation AnthropicAccountMutation) error
- func (r *ControlPlaneChatRunner) PrepareCommit(ctx context.Context, target WorkspaceTarget) (protocol.WorkspaceGitCommitSnapshot, error)
- func (r *ControlPlaneChatRunner) ProviderConnection(ctx context.Context, provider string) (ProviderConnection, error)
- func (r *ControlPlaneChatRunner) ProviderDeviceLogin(ctx context.Context, provider, id string) (ProviderDeviceLogin, error)
- func (r *ControlPlaneChatRunner) QueryConversations(ctx context.Context, options conversations.ListConversationsRequest) (conversations.ListConversationsResponse, error)
- func (r *ControlPlaneChatRunner) Run(ctx context.Context, request ChatRequest, sink ChatEventSink) (string, error)
- func (r *ControlPlaneChatRunner) StartAnthropicLogin(ctx context.Context) (AnthropicLogin, error)
- func (r *ControlPlaneChatRunner) StartProviderDeviceLogin(ctx context.Context, provider string) (ProviderDeviceLogin, error)
- func (r *ControlPlaneChatRunner) SteerConversation(ctx context.Context, conversationID, message string, images []string) (bool, error)
- func (r *ControlPlaneChatRunner) StopConversation(ctx context.Context, conversationID string) error
- func (r *ControlPlaneChatRunner) StopConversationTurn(ctx context.Context, conversationID, turnID string) error
- func (r *ControlPlaneChatRunner) StreamConversation(ctx context.Context, conversationID string, sink ChatEventSink) error
- func (r *ControlPlaneChatRunner) TakeUIOwnership(ctx context.Context, conversationID string) error
- func (r *ControlPlaneChatRunner) WorkspaceCWDSuggestions(ctx context.Context, target WorkspaceTarget, query string) (protocol.WorkspaceCWDHintsResult, error)
- func (r *ControlPlaneChatRunner) WorkspaceRunners(ctx context.Context) ([]runnerregistry.Runner, error)
- type ControlPlaneChatSettings
- type ControlPlaneHTTPError
- type ControlPlaneProfileOption
- type ControlPlaneStreamProtocolError
- type ConversationAdoptionRequest
- type ConversationAdoptionResult
- type ConversationHistory
- type ConversationSource
- type ConversationStreamLifecycleSink
- type ConversationStreamer
- type DefaultChatRunner
- func (r *DefaultChatRunner) Close() error
- func (r *DefaultChatRunner) CloseConversation(conversationID string) error
- func (r *DefaultChatRunner) DefaultCWD() string
- func (r *DefaultChatRunner) ExtensionRuntimeProvider() ExtensionRuntimeProvider
- func (r *DefaultChatRunner) Run(ctx context.Context, req ChatRequest, sink ChatEventSink) (string, error)
- func (r *DefaultChatRunner) SetEnvironmentResolver(resolver EnvironmentResolver)
- type EnvironmentResolver
- type ExtensionRuntimeProvider
- type ProviderConnection
- type ProviderDeviceLogin
- type ServiceStoreAdapter
- func (s ServiceStoreAdapter) Close() error
- func (s ServiceStoreAdapter) Delete(context.Context, string) error
- func (s ServiceStoreAdapter) Load(ctx context.Context, id string) (convtypes.ConversationRecord, error)
- func (s ServiceStoreAdapter) Query(context.Context, convtypes.QueryOptions) (convtypes.QueryResult, error)
- func (s ServiceStoreAdapter) Save(context.Context, convtypes.ConversationRecord) error
- type TurnPendingError
- type TurnReceipt
- type UIConfirmEvent
- type UIInputEvent
- type UINotifyEvent
- type UIPersistentAck
- type UIPersistentEvent
- type UIPersistentInput
- type UISelectEvent
- type UIWidgetEvent
- type UncertainSubmissionError
- type WorkspaceShortcutRequest
- type WorkspaceTarget
Constants ¶
const ( // ConversationStreamActiveHeader reports whether a conversation was active when a live stream attached. ConversationStreamActiveHeader = "X-Kodelet-Conversation-Active" // ClientIDHeader identifies one attached UI client, independently of its user login. ClientIDHeader = "X-Kodelet-Client-ID" // UICapabilitiesHeader declares UI features supported by a watching client. UICapabilitiesHeader = "X-Kodelet-UI-Capabilities" )
const ( // RunnerIDMetadataKey identifies the remote runner that owns a conversation environment. RunnerIDMetadataKey = convtypes.RunnerIDMetadataKey // EnvironmentProfileMetadataKey stores the runner-owned profile independently from model policy. EnvironmentProfileMetadataKey = convtypes.RunnerEnvironmentProfileMetadataKey )
Variables ¶
This section is empty.
Functions ¶
func AddEnvironmentCommandDisplay ¶
func AddEnvironmentCommandDisplay(thread llmtypes.Thread, result agentenv.CommandResult)
AddEnvironmentCommandDisplay stores the compact display for an environment-routed command.
func AddExtensionCommandDisplay ¶
func AddExtensionCommandDisplay(thread llmtypes.Thread, result *extensions.RoutedCommandResult)
func AddGoalDisplay ¶
func AddGoalDisplay(thread llmtypes.Thread, update *goals.CommandUpdate)
func AddSlashCommandDisplay ¶
func AddSlashCommandDisplay(thread llmtypes.Thread, expansion *slashcommands.Expansion)
func ApplyCommandRestrictions ¶
func ApplyCommandRestrictions(ctx context.Context, llmConfig *llmtypes.Config, result agentenv.CommandResult)
ApplyCommandRestrictions applies model/tool restrictions returned by an environment command.
func BuildState ¶
func ExpandCWDInput ¶
ExpandCWDInput expands user-entered working-directory text relative to a default cwd.
func ExpandSlashCommand ¶
func IsNaturalDirectoryQuery ¶
IsNaturalDirectoryQuery reports whether query is a bare directory name.
func NormalizeEnvironmentProfile ¶
NormalizeEnvironmentProfile maps blank and the reserved default name to runner base configuration.
func NormalizeRequest ¶
func NormalizeRequest(req ChatRequest) (string, []string, error)
func ResolveConfig ¶
func ResolveConfigForExistingConversation ¶
func ResolveConfigForExistingConversation(record *conversationservice.GetConversationResponse, requestedReasoningEfforts ...string) (llmtypes.Config, error)
func ResolveConfiguredDefaultCWD ¶
ResolveConfiguredDefaultCWD resolves a configured default working directory.
func ResolveExtensionCallContext ¶
func ResolveExtensionCallContext(ctx context.Context, conversationID, cwd string, config llmtypes.Config) (extensions.ExtensionCallContext, error)
ResolveExtensionCallContext builds the extension context for an interactive operation, including the persisted origin of a resumed conversation.
func ResolveRemoteConfigWithReasoning ¶
func ResolveRemoteConfigWithReasoning(ctx context.Context, conversationID, requestedProfile, requestedReasoningEffort string) (llmtypes.Config, error)
ResolveRemoteConfigWithReasoning resolves only control-plane provider settings. The runner manifest supplies the authoritative workspace path and environment configuration.
func ResolveRemoteConfigWithReasoningAndEnvironmentProfile ¶
func ResolveRemoteConfigWithReasoningAndEnvironmentProfile(ctx context.Context, conversationID, requestedProfile, requestedReasoningEffort, requestedEnvironmentProfile string) (llmtypes.Config, string, error)
ResolveRemoteConfigWithReasoningAndEnvironmentProfile resolves central model policy and the independently locked runner profile.
func RunDefaultChat ¶
func RunDefaultChat(ctx context.Context, req ChatRequest, sink ChatEventSink, defaultCWD string, extensionRuntimes ExtensionRuntimeProvider) (string, error)
RunDefaultChat executes a single persisted chat turn and streams events to the sink.
func TransformSlashCommand ¶
func TransformSlashCommand(ctx context.Context, message string, cwd string) (string, *slashcommands.Expansion, *goals.CommandUpdate, error)
func TryExtensionCommand ¶
func TryExtensionCommand( ctx context.Context, message string, extensionRuntime *extensions.Runtime, llmConfig llmtypes.Config, conversationID string, workingDir string, ) (*extensions.RoutedCommandResult, bool, error)
func ValidateConversationAdoptionConfig ¶
func ValidateConversationAdoptionConfig(record *conversations.GetConversationResponse) (llmtypes.Config, error)
ValidateConversationAdoptionConfig checks stored model semantics against live daemon policy and locally available credentials, without a provider request, credential refresh, or thread construction. It does not rewrite the snapshot.
Types ¶
type AnthropicAccountMutation ¶
type AnthropicAccountMutation struct {
Action string `json:"action"`
Alias string `json:"alias,omitempty"`
NewAlias string `json:"newAlias,omitempty"`
}
func (AnthropicAccountMutation) Validate ¶
func (m AnthropicAccountMutation) Validate() error
type AnthropicAccountSummary ¶
type AnthropicAccountSummary struct {
Alias string `json:"alias"`
Email string `json:"email"`
ExpiresAt int64 `json:"expiresAt"`
IsDefault bool `json:"isDefault"`
}
AnthropicAccountSummary never contains provider tokens or credentials.
type AnthropicAccountUsage ¶
type AnthropicAccountUsage struct {
Account string `json:"account"`
Email string `json:"email"`
Window5h AnthropicUsageWindow `json:"window_5h"`
Window7d AnthropicUsageWindow `json:"window_7d"`
}
type AnthropicAccounts ¶
type AnthropicAccounts struct {
Accounts []AnthropicAccountSummary `json:"accounts"`
}
type AnthropicLogin ¶
type AnthropicUsageWindow ¶
type ChatClientCapabilities ¶
type ChatClientCapabilities struct {
InteractiveUI bool `json:"interactiveUI"`
PersistentWidgets bool `json:"persistentWidgets"`
PersistentSurfaces bool `json:"persistentSurfaces"`
}
ChatClientCapabilities describes UI behavior supported by the client attached to a chat run.
type ChatContentBlock ¶
type ChatContentBlock struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Command string `json:"command,omitempty"`
Source *ChatImageSource `json:"source,omitempty"`
ImageURL *ChatImageURLSource `json:"image_url,omitempty"`
}
ChatContentBlock represents a typed chat content block.
func ContentBlocksForUserInput ¶
func ContentBlocksForUserInput(text string, imageInputs []string) []ChatContentBlock
type ChatEvent ¶
type ChatEvent struct {
Kind string `json:"kind"`
ConversationID string `json:"conversation_id,omitempty"`
ConversationName string `json:"conversation_name,omitempty"`
CWD string `json:"cwd,omitempty"`
Role string `json:"role,omitempty"`
Delta string `json:"delta,omitempty"`
Content any `json:"content,omitempty"`
Usage *llmtypes.Usage `json:"usage,omitempty"`
ToolName string `json:"tool_name,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Input string `json:"input,omitempty"`
ToolOutput string `json:"tool_output,omitempty"`
ToolResult *tooltypes.StructuredToolResult `json:"tool_result,omitempty"`
UIInput *UIInputEvent `json:"ui_input,omitempty"`
UIConfirm *UIConfirmEvent `json:"ui_confirm,omitempty"`
UISelect *UISelectEvent `json:"ui_select,omitempty"`
UINotify *UINotifyEvent `json:"ui_notify,omitempty"`
UIRequestID string `json:"ui_request_id,omitempty"`
UIWidget *UIWidgetEvent `json:"ui_widget,omitempty"`
UIWidgets []UIWidgetEvent `json:"ui_widgets,omitempty"`
UIWidgetRevision string `json:"ui_widget_revision,omitempty"`
UIPersistent *UIPersistentEvent `json:"ui_persistent,omitempty"`
Cancelled bool `json:"cancelled,omitempty"`
Error string `json:"error,omitempty"`
Result *string `json:"result,omitempty"`
}
ChatEvent is a single streaming chat event.
type ChatEventSink ¶
ChatEventSink receives streamed chat events.
type ChatImageSource ¶
ChatImageSource represents embedded image data.
func ParseDataURL ¶
func ParseDataURL(dataURL string) (*ChatImageSource, bool)
ParseDataURL parses a base64 data URL into a chat image source.
type ChatImageURLSource ¶
type ChatImageURLSource struct {
URL string `json:"url"`
}
ChatImageURLSource represents URL-based image input.
type ChatRequest ¶
type ChatRequest struct {
Message string `json:"message"`
Content []ChatContentBlock `json:"content,omitempty"`
ConversationID string `json:"conversationId,omitempty"`
TurnID string `json:"turnId,omitempty"`
RunnerID string `json:"runnerId,omitempty"`
Profile string `json:"profile,omitempty"`
EnvironmentProfile string `json:"environmentProfile,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
CWD string `json:"cwd,omitempty"`
Options *llmtypes.ExecutionOptions `json:"options,omitempty"`
ClientCapabilities *ChatClientCapabilities `json:"clientCapabilities,omitempty"`
}
ChatRequest is the payload for a streamed chat turn.
func (*ChatRequest) UnmarshalJSON ¶
func (r *ChatRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON keeps the optional execution-options envelope strict too: the standard JSON decoder otherwise bypasses ExecutionOptions.UnmarshalJSON when assigning null to a pointer. Invalid requests leave the receiver untouched.
type ChatRunner ¶
type ChatRunner interface {
Run(ctx context.Context, req ChatRequest, sink ChatEventSink) (string, error)
}
ChatRunner executes a single persisted chat turn.
type CodexStatus ¶
type CodexStatus struct {
Connected bool `json:"connected"`
Authentication string `json:"authentication,omitempty"`
AccountID string `json:"accountId,omitempty"`
ExpiresAt int64 `json:"expiresAt,omitempty"`
CanRefresh bool `json:"canRefresh,omitempty"`
Usage *auth.CodexUsageStats `json:"usage,omitempty"`
UsageMessage string `json:"usageMessage,omitempty"`
}
CodexStatus is the server's account and live-usage view. It never contains tokens.
type ControlPlaneChatRunner ¶
type ControlPlaneChatRunner struct {
// contains filtered or unexported fields
}
ControlPlaneChatRunner streams chat turns and conversation history through kodelet serve.
func NewControlPlaneChatRunner ¶
func NewControlPlaneChatRunner(server, authToken, runnerID string) (*ControlPlaneChatRunner, error)
NewControlPlaneChatRunner creates a TUI-compatible control-plane transport with an optional runner selection.
func (*ControlPlaneChatRunner) AdoptConversation ¶
func (r *ControlPlaneChatRunner) AdoptConversation(ctx context.Context, id string, params ConversationAdoptionRequest) (ConversationAdoptionResult, error)
AdoptConversation previews or confirms a daemon-owned legacy conversation. It never retries a mutation after an uncertain transport outcome.
func (*ControlPlaneChatRunner) AnthropicAccountUsage ¶
func (r *ControlPlaneChatRunner) AnthropicAccountUsage(ctx context.Context, alias string) (AnthropicAccountUsage, error)
func (*ControlPlaneChatRunner) AnthropicAccounts ¶
func (r *ControlPlaneChatRunner) AnthropicAccounts(ctx context.Context) (AnthropicAccounts, error)
func (*ControlPlaneChatRunner) CancelAnthropicLogin ¶
func (r *ControlPlaneChatRunner) CancelAnthropicLogin(ctx context.Context, id string) error
func (*ControlPlaneChatRunner) CancelProviderDeviceLogin ¶
func (r *ControlPlaneChatRunner) CancelProviderDeviceLogin(ctx context.Context, provider, id string) error
func (*ControlPlaneChatRunner) ChatSettings ¶
func (r *ControlPlaneChatRunner) ChatSettings(ctx context.Context, profile string) (ControlPlaneChatSettings, error)
ChatSettings fetches control-plane model profiles and reasoning policy.
func (*ControlPlaneChatRunner) CodexStatus ¶
func (r *ControlPlaneChatRunner) CodexStatus(ctx context.Context) (CodexStatus, error)
func (*ControlPlaneChatRunner) CompleteAnthropicLogin ¶
func (r *ControlPlaneChatRunner) CompleteAnthropicLogin(ctx context.Context, id, code, alias string) (AnthropicLogin, error)
CompleteAnthropicLogin explicitly selects an alias (empty means derive from the returned email) rather than overwriting the browser's default account.
func (*ControlPlaneChatRunner) CreateCommit ¶
func (r *ControlPlaneChatRunner) CreateCommit(ctx context.Context, target WorkspaceTarget, approval protocol.WorkspaceGitCommitParams) (protocol.WorkspaceGitCommitResult, error)
CreateCommit submits one explicit approval without retrying an uncertain mutation.
func (*ControlPlaneChatRunner) DeleteConversation ¶
func (r *ControlPlaneChatRunner) DeleteConversation(ctx context.Context, conversationID string) error
DeleteConversation deletes persisted history on the daemon. Active executions are rejected by the server; transport failures are never retried implicitly.
func (*ControlPlaneChatRunner) DiscoverWorkspace ¶
func (r *ControlPlaneChatRunner) DiscoverWorkspace(ctx context.Context, target WorkspaceTarget) (protocol.WorkspaceDiscoverResult, error)
DiscoverWorkspace validates the target and discovers its slash commands on the runner without starting a model turn or a workspace run lease.
func (*ControlPlaneChatRunner) ExecuteWorkspaceShortcut ¶
func (r *ControlPlaneChatRunner) ExecuteWorkspaceShortcut(ctx context.Context, request WorkspaceShortcutRequest) (runnerpayload.ShortcutExecuteResult, error)
ExecuteWorkspaceShortcut performs one bounded runner-side invocation. Stream loss cancels this invocation; it never cancels an active conversation turn.
func (*ControlPlaneChatRunner) ForkConversation ¶
func (r *ControlPlaneChatRunner) ForkConversation(ctx context.Context, conversationID string) (string, error)
ForkConversation creates a centrally persisted copy with normal lineage and affinity.
func (*ControlPlaneChatRunner) GetTurnReceipt ¶
func (r *ControlPlaneChatRunner) GetTurnReceipt(ctx context.Context, conversationID, turnID string) (TurnReceipt, error)
GetTurnReceipt queries durable status without submitting or restarting work.
func (*ControlPlaneChatRunner) InspectWorkspace ¶
func (r *ControlPlaneChatRunner) InspectWorkspace(ctx context.Context, target WorkspaceTarget, params protocol.WorkspaceInspectParams) (protocol.WorkspaceInspectResult, error)
func (*ControlPlaneChatRunner) ListConversations ¶
func (r *ControlPlaneChatRunner) ListConversations(ctx context.Context, limit int) ([]convtypes.ConversationSummary, error)
ListConversations returns control-plane conversations visible to this client.
func (*ControlPlaneChatRunner) ListConversationsInCWD ¶
func (r *ControlPlaneChatRunner) ListConversationsInCWD(ctx context.Context, limit int, cwd string) ([]convtypes.ConversationSummary, error)
ListConversationsInCWD lists history using runner-host CWD semantics. The daemon applies the workspace filter before pagination, so follow never picks a turn from another workspace merely because it was updated more recently.
func (*ControlPlaneChatRunner) LoadConversation ¶
func (r *ControlPlaneChatRunner) LoadConversation(ctx context.Context, conversationID string) (ConversationHistory, error)
LoadConversation returns normalized history from the control plane.
func (*ControlPlaneChatRunner) LoadConversationRecord ¶
func (r *ControlPlaneChatRunner) LoadConversationRecord(ctx context.Context, conversationID string) (convtypes.ConversationRecord, error)
LoadConversationRecord returns the lossless export shape, not rendered UI history.
func (*ControlPlaneChatRunner) MutateAnthropicAccount ¶
func (r *ControlPlaneChatRunner) MutateAnthropicAccount(ctx context.Context, mutation AnthropicAccountMutation) error
func (*ControlPlaneChatRunner) PrepareCommit ¶
func (r *ControlPlaneChatRunner) PrepareCommit(ctx context.Context, target WorkspaceTarget) (protocol.WorkspaceGitCommitSnapshot, error)
PrepareCommit reads a bounded, immutable staged diff on the selected runner.
func (*ControlPlaneChatRunner) ProviderConnection ¶
func (r *ControlPlaneChatRunner) ProviderConnection(ctx context.Context, provider string) (ProviderConnection, error)
func (*ControlPlaneChatRunner) ProviderDeviceLogin ¶
func (r *ControlPlaneChatRunner) ProviderDeviceLogin(ctx context.Context, provider, id string) (ProviderDeviceLogin, error)
func (*ControlPlaneChatRunner) QueryConversations ¶
func (r *ControlPlaneChatRunner) QueryConversations(ctx context.Context, options conversations.ListConversationsRequest) (conversations.ListConversationsResponse, error)
QueryConversations applies history filters centrally, without requiring an online runner. CWD filters match canonical persisted runner-host paths.
func (*ControlPlaneChatRunner) Run ¶
func (r *ControlPlaneChatRunner) Run(ctx context.Context, request ChatRequest, sink ChatEventSink) (string, error)
Run posts one chat request and forwards NDJSON events to the TUI sink.
func (*ControlPlaneChatRunner) StartAnthropicLogin ¶
func (r *ControlPlaneChatRunner) StartAnthropicLogin(ctx context.Context) (AnthropicLogin, error)
func (*ControlPlaneChatRunner) StartProviderDeviceLogin ¶
func (r *ControlPlaneChatRunner) StartProviderDeviceLogin(ctx context.Context, provider string) (ProviderDeviceLogin, error)
func (*ControlPlaneChatRunner) SteerConversation ¶
func (r *ControlPlaneChatRunner) SteerConversation(ctx context.Context, conversationID, message string, images []string) (bool, error)
SteerConversation queues steering content in the control plane that owns the active provider loop.
func (*ControlPlaneChatRunner) StopConversation ¶
func (r *ControlPlaneChatRunner) StopConversation(ctx context.Context, conversationID string) error
StopConversation requests cancellation of central and runner work before the client stream closes.
func (*ControlPlaneChatRunner) StopConversationTurn ¶
func (r *ControlPlaneChatRunner) StopConversationTurn(ctx context.Context, conversationID, turnID string) error
StopConversationTurn requests cancellation of one specific control-plane turn.
func (*ControlPlaneChatRunner) StreamConversation ¶
func (r *ControlPlaneChatRunner) StreamConversation(ctx context.Context, conversationID string, sink ChatEventSink) error
StreamConversation follows live events for one control-plane conversation across turns.
func (*ControlPlaneChatRunner) TakeUIOwnership ¶
func (r *ControlPlaneChatRunner) TakeUIOwnership(ctx context.Context, conversationID string) error
TakeUIOwnership explicitly selects this attached client for future prompts. Existing prompts are dismissed, not replayed. StreamConversation must remain attached.
func (*ControlPlaneChatRunner) WorkspaceCWDSuggestions ¶
func (r *ControlPlaneChatRunner) WorkspaceCWDSuggestions(ctx context.Context, target WorkspaceTarget, query string) (protocol.WorkspaceCWDHintsResult, error)
WorkspaceCWDSuggestions resolves directory hints using runner-host paths.
func (*ControlPlaneChatRunner) WorkspaceRunners ¶
func (r *ControlPlaneChatRunner) WorkspaceRunners(ctx context.Context) ([]runnerregistry.Runner, error)
WorkspaceRunners lists the available targets using this client's server and credential.
type ControlPlaneChatSettings ¶
type ControlPlaneChatSettings struct {
CurrentProfile string `json:"currentProfile,omitempty"`
Profiles []ControlPlaneProfileOption `json:"profiles"`
ReasoningEffort string `json:"reasoningEffort"`
ReasoningEffortOptions []string `json:"reasoningEffortOptions"`
DefaultCWD string `json:"defaultCWD,omitempty"`
DefaultRunnerID string `json:"defaultRunnerId,omitempty"`
DefaultRunnerHostID string `json:"defaultRunnerHostId,omitempty"`
DefaultRunnerReady bool `json:"defaultRunnerReady"`
}
ControlPlaneChatSettings contains server-owned settings for a new conversation.
type ControlPlaneHTTPError ¶
ControlPlaneHTTPError reports a non-successful control-plane response.
func (*ControlPlaneHTTPError) Error ¶
func (e *ControlPlaneHTTPError) Error() string
func (*ControlPlaneHTTPError) Retryable ¶
func (e *ControlPlaneHTTPError) Retryable() bool
Retryable reports whether retrying the request may succeed without user action.
type ControlPlaneProfileOption ¶
type ControlPlaneProfileOption struct {
Name string `json:"name"`
Scope string `json:"scope"`
Active bool `json:"active,omitempty"`
}
ControlPlaneProfileOption describes one model-policy profile advertised by the server.
type ControlPlaneStreamProtocolError ¶
type ControlPlaneStreamProtocolError struct {
// contains filtered or unexported fields
}
ControlPlaneStreamProtocolError reports invalid data from a control-plane event stream.
func (*ControlPlaneStreamProtocolError) Error ¶
func (e *ControlPlaneStreamProtocolError) Error() string
func (*ControlPlaneStreamProtocolError) Retryable ¶
func (e *ControlPlaneStreamProtocolError) Retryable() bool
Retryable reports that reconnecting cannot repair deterministic stream data errors.
func (*ControlPlaneStreamProtocolError) Unwrap ¶
func (e *ControlPlaneStreamProtocolError) Unwrap() error
type ConversationAdoptionRequest ¶
type ConversationAdoptionRequest struct {
RunnerID string `json:"runnerId"`
EnvironmentProfile string `json:"environmentProfile,omitempty"`
Confirmation string `json:"confirmation,omitempty"`
}
ConversationAdoptionRequest selects an explicit environment. Confirmation is the digest returned by a prior preview, not permission to replace a record.
type ConversationAdoptionResult ¶
type ConversationAdoptionResult struct {
ConversationID string `json:"conversationId"`
RunnerID string `json:"runnerId"`
RunnerName string `json:"runnerName,omitempty"`
HostInstanceID string `json:"hostInstanceId"`
Hostname string `json:"hostname"`
Generation int64 `json:"generation"`
CWD string `json:"cwd"`
EnvironmentProfile string `json:"environmentProfile,omitempty"`
ModelProfile string `json:"modelProfile"`
Provider string `json:"provider"`
Model string `json:"model"`
Confirmation string `json:"confirmation"`
Adopted bool `json:"adopted"`
}
ConversationAdoptionResult contains no credentials or raw conversation data.
type ConversationHistory ¶
type ConversationHistory struct {
ID string
CWD string
Title string
Provider string
Profile string
ReasoningEffort string
RunnerID string
EnvironmentProfile string
UpdatedAt time.Time
Usage llmtypes.Usage
Messages []conversationservice.StreamableMessage
}
ConversationHistory is the client-facing persisted state needed to resume a conversation.
type ConversationSource ¶
type ConversationSource interface {
ListConversations(ctx context.Context, limit int) ([]convtypes.ConversationSummary, error)
LoadConversation(ctx context.Context, conversationID string) (ConversationHistory, error)
}
ConversationSource supplies persisted conversation summaries and normalized history to a chat client.
type ConversationStreamLifecycleSink ¶
ConversationStreamLifecycleSink receives connection state for a persistent conversation stream.
type ConversationStreamer ¶
type ConversationStreamer interface {
StreamConversation(ctx context.Context, conversationID string, sink ChatEventSink) error
}
ConversationStreamer follows live events for a persisted conversation across turns.
type DefaultChatRunner ¶
type DefaultChatRunner struct {
// contains filtered or unexported fields
}
DefaultChatRunner executes chat turns using the same LLM/tool stack as the CLI.
func NewDefaultChatRunner ¶
func NewDefaultChatRunner(defaultCWD string, extensionRuntimes ...ExtensionRuntimeProvider) *DefaultChatRunner
NewDefaultChatRunner creates a default chat runner.
func (*DefaultChatRunner) Close ¶
func (r *DefaultChatRunner) Close() error
Close releases cached conversation threads and their persistent transports.
func (*DefaultChatRunner) CloseConversation ¶
func (r *DefaultChatRunner) CloseConversation(conversationID string) error
CloseConversation releases a cached thread when its conversation is removed.
func (*DefaultChatRunner) DefaultCWD ¶
func (r *DefaultChatRunner) DefaultCWD() string
DefaultCWD returns the runner's configured default working directory.
func (*DefaultChatRunner) ExtensionRuntimeProvider ¶
func (r *DefaultChatRunner) ExtensionRuntimeProvider() ExtensionRuntimeProvider
ExtensionRuntimeProvider returns the runner's configured extension runtime provider.
func (*DefaultChatRunner) Run ¶
func (r *DefaultChatRunner) Run(ctx context.Context, req ChatRequest, sink ChatEventSink) (string, error)
Run executes a single persisted chat turn and streams events to the sink.
func (*DefaultChatRunner) SetEnvironmentResolver ¶
func (r *DefaultChatRunner) SetEnvironmentResolver(resolver EnvironmentResolver)
SetEnvironmentResolver configures remote environment selection for subsequent requests.
type EnvironmentResolver ¶
type EnvironmentResolver interface {
ResolveEnvironment(ctx context.Context, req ChatRequest, conversationID string, config llmtypes.Config, resolvedCWD string) (agentenv.Environment, error)
}
EnvironmentResolver optionally selects a non-local environment for a chat request.
type ExtensionRuntimeProvider ¶
type ExtensionRuntimeProvider interface {
Runtime(ctx context.Context, cwd string) (*extensions.Runtime, error)
}
ExtensionRuntimeProvider supplies extension runtimes for chat turns.
type ProviderConnection ¶
type ProviderConnection struct {
Provider string `json:"provider"`
Connected bool `json:"connected"`
}
ProviderConnection contains only daemon connection status, never credentials.
type ProviderDeviceLogin ¶
type ProviderDeviceLogin struct {
ID string `json:"id"`
Status string `json:"status"`
VerificationURL string `json:"verificationUrl,omitempty"`
UserCode string `json:"userCode,omitempty"`
Message string `json:"message,omitempty"`
}
ProviderDeviceLogin is the public part of a daemon-owned device login.
type ServiceStoreAdapter ¶
type ServiceStoreAdapter struct {
Service conversationservice.ConversationServiceInterface
}
func (ServiceStoreAdapter) Close ¶
func (s ServiceStoreAdapter) Close() error
func (ServiceStoreAdapter) Delete ¶
func (s ServiceStoreAdapter) Delete(context.Context, string) error
func (ServiceStoreAdapter) Load ¶
func (s ServiceStoreAdapter) Load(ctx context.Context, id string) (convtypes.ConversationRecord, error)
func (ServiceStoreAdapter) Query ¶
func (s ServiceStoreAdapter) Query(context.Context, convtypes.QueryOptions) (convtypes.QueryResult, error)
func (ServiceStoreAdapter) Save ¶
func (s ServiceStoreAdapter) Save(context.Context, convtypes.ConversationRecord) error
type TurnPendingError ¶
type TurnPendingError struct{ Receipt TurnReceipt }
TurnPendingError means the daemon already owns this exact submission.
func (*TurnPendingError) Error ¶
func (e *TurnPendingError) Error() string
func (*TurnPendingError) Retryable ¶
func (e *TurnPendingError) Retryable() bool
Retryable is false because the daemon already owns this submission.
type TurnReceipt ¶
type TurnReceipt struct {
ConversationID string `json:"conversationId" db:"conversation_id"`
TurnID string `json:"turnId" db:"turn_id"`
RunID string `json:"runId,omitempty" db:"run_id"`
Status string `json:"status" db:"status"`
CancelRequested bool `json:"cancelRequested,omitempty" db:"cancel_requested"`
Result *string `json:"result,omitempty" db:"result"`
Error string `json:"error,omitempty" db:"error"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
TurnReceipt reconciles an ordinary persisted conversation submission. It is not an instruction to retry execution or replay transient tool/UI events.
func (TurnReceipt) Terminal ¶
func (r TurnReceipt) Terminal() bool
Terminal reports an authoritative outcome, including interrupted execution.
type UIConfirmEvent ¶
type UIConfirmEvent struct {
ID string `json:"id"`
Title string `json:"title"`
Message string `json:"message,omitempty"`
ConfirmButtonText string `json:"confirmButtonText,omitempty"`
CancelButtonText string `json:"cancelButtonText,omitempty"`
}
UIConfirmEvent describes an extension-requested confirmation prompt.
type UIInputEvent ¶
type UIInputEvent struct {
ID string `json:"id"`
Title string `json:"title"`
HelpText string `json:"helpText,omitempty"`
Message string `json:"message,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
DefaultValue string `json:"defaultValue,omitempty"`
SubmitButtonText string `json:"submitButtonText,omitempty"`
CancelButtonText string `json:"cancelButtonText,omitempty"`
Required bool `json:"required,omitempty"`
Secret bool `json:"secret,omitempty"`
}
UIInputEvent describes an extension-requested input prompt.
type UINotifyEvent ¶
UINotifyEvent describes an extension-requested notification.
type UIPersistentAck ¶
type UIPersistentAck struct {
RequestID string `json:"requestId"`
Response extensions.UIFrameResponse `json:"response"`
}
type UIPersistentEvent ¶
type UIPersistentEvent struct {
RequestID string `json:"requestId,omitempty"`
RouteID string `json:"routeId,omitempty"`
Epoch string `json:"epoch,omitempty"`
Method string `json:"method"`
RunnerID string `json:"runnerId,omitempty"`
RunnerGeneration int64 `json:"runnerGeneration,omitempty"`
Owner runnerpayload.ExtensionOwner `json:"owner"`
Request json.RawMessage `json:"request,omitempty"`
}
UIPersistentEvent is an owner-targeted, acknowledged native UI operation. RouteID is opaque input authority; clients never select a runner or run ID.
type UIPersistentInput ¶
type UIPersistentInput struct {
RouteID string `json:"routeId"`
Method string `json:"method"`
Request json.RawMessage `json:"request"`
}
type UISelectEvent ¶
type UISelectEvent struct {
ID string `json:"id"`
Title string `json:"title"`
Message string `json:"message,omitempty"`
Options []string `json:"options"`
SubmitButtonText string `json:"submitButtonText,omitempty"`
CancelButtonText string `json:"cancelButtonText,omitempty"`
}
UISelectEvent describes an extension-requested single-choice prompt.
type UIWidgetEvent ¶
type UIWidgetEvent struct {
Key string `json:"key"`
ExtensionID string `json:"extension_id"`
Generation string `json:"generation"`
ID string `json:"id"`
Placement string `json:"placement,omitempty"`
Frame extensions.UIFrame `json:"frame"`
Removed bool `json:"removed,omitempty"`
}
UIWidgetEvent carries one persistent extension widget snapshot or removal.
type UncertainSubmissionError ¶
UncertainSubmissionError retains the identities needed for safe reconciliation. Unwrap preserves transport/cancellation errors for existing callers.
func (*UncertainSubmissionError) Error ¶
func (e *UncertainSubmissionError) Error() string
func (*UncertainSubmissionError) Retryable ¶
func (e *UncertainSubmissionError) Retryable() bool
Retryable forbids execution retry; callers can make a read-only status query.
func (*UncertainSubmissionError) Unwrap ¶
func (e *UncertainSubmissionError) Unwrap() error
type WorkspaceShortcutRequest ¶
type WorkspaceShortcutRequest struct {
Target WorkspaceTarget `json:"target"`
RunID string `json:"runId,omitempty"`
Digest string `json:"digest"`
Shortcut protocol.ShortcutDescriptor `json:"shortcut"`
}
WorkspaceShortcutRequest binds an advertised shortcut to its discovery scope. RunID is present only for discovery of an active, pinned environment.
func (*WorkspaceShortcutRequest) UnmarshalJSON ¶
func (r *WorkspaceShortcutRequest) UnmarshalJSON(data []byte) error
func (WorkspaceShortcutRequest) Validate ¶
func (r WorkspaceShortcutRequest) Validate() error
type WorkspaceTarget ¶
type WorkspaceTarget struct {
Profile string `json:"profile,omitempty"`
RunnerID string `json:"runnerId,omitempty"`
CWD string `json:"cwd,omitempty"`
EnvironmentProfile string `json:"environmentProfile,omitempty"`
ConversationID string `json:"conversationId,omitempty"`
Options *llmtypes.ExecutionOptions `json:"options,omitempty"`
}
WorkspaceTarget selects runner-owned discovery without interpreting paths on the client. Profile selects the daemon model profile independently of the runner's EnvironmentProfile; blank inherits the daemon default, while "default" explicitly selects the base profile. ConversationID pins discovery to persisted runner/CWD affinity and the stored model profile; clients should omit Profile when discovering a saved conversation.