Documentation
¶
Index ¶
- Constants
- Variables
- func IsActiveRunState(raw string) bool
- func NewQueuedTurnID() (string, error)
- func NewRunID() (string, error)
- func NewThreadID() (string, error)
- func RunDesktopModelSourceConnector(ctx context.Context, opts DesktopModelSourceConnectorOptions) error
- func SkillErrorCode(err error) string
- func SkillErrorStatus(err error) int
- type AIRuntimeStatus
- type ActiveThreadRun
- type ActivityChip
- type ActivityDetailRef
- type ActivityGroup
- type ActivityItem
- type ActivitySummary
- type ActivityTargetRef
- type ActivityTimelineBlock
- type AgentLoop
- type AppendThreadMessageRequest
- type BudgetHint
- type ContentPart
- type CoreToolScheduler
- type CreateThreadRequest
- type CreateThreadResponse
- type DefaultModeToolFilter
- type DesktopModelSourceConnectorOptions
- type DesktopModelSourceModel
- type DesktopModelSourceModelSnapshot
- type DesktopModelSourceRPCError
- type DesktopModelSourceRPCFrame
- type DesktopModelSourceSession
- type DesktopModelSourceStartupReport
- type DesktopModelSourceStatus
- type DiffHunkView
- type ExitPlanModeArgs
- type ExitPlanModeResult
- type ExitPlanPromptRef
- type FileEditArgs
- type FileMutationResult
- type FileReadArgs
- type FileReadResult
- type FileWriteArgs
- type FollowupAttachmentView
- type FollowupItemView
- type InMemoryToolRegistry
- type ListFollowupsResponse
- type ListRunEventsQuery
- type ListRunEventsResponse
- type ListThreadMessagesResponse
- type ListThreadsResponse
- type LoopBudget
- type LoopDetector
- type Message
- type ModeFlags
- type ModeToolFilter
- type Model
- type ModelSelectInput
- type ModelSelector
- type ModelsResponse
- type Options
- type PartialToolCall
- type PartialUsage
- type PatchFollowupRequest
- type PatchThreadRequest
- type Provider
- type ProviderControls
- type RealtimeEvent
- type RealtimeEventType
- type RealtimeLifecyclePhase
- type RealtimeStreamKind
- type ReorderFollowupsRequest
- type RequestUserInputAction
- type RequestUserInputAnswer
- type RequestUserInputChoice
- type RequestUserInputPrompt
- type RequestUserInputQuestion
- type RequestUserInputResolvedQuestion
- type RequestUserInputResponse
- type RequestUserInputResponseRecord
- type RequestUserInputSecretAnswer
- type RunAttachmentIn
- type RunCompletionMode
- type RunContext
- type RunEventView
- type RunHistoryMsg
- type RunInput
- type RunOptions
- type RunProtocolProfile
- type RunProtocolSurface
- type RunRequest
- type RunStartRequest
- type RunState
- type RunWaitingMode
- type RuntimeCloseout
- type SendUserTurnRequest
- type SendUserTurnResponse
- type Service
- func (s *Service) ActiveRunCount(endpointID string) int
- func (s *Service) AppendThreadMessage(ctx context.Context, meta *session.Meta, threadID string, role string, ...) error
- func (s *Service) ApproveTool(meta *session.Meta, runID string, toolID string, approved bool) error
- func (s *Service) BrowseSkillFile(skillPath string, file string, encoding string, maxBytes int) (*SkillBrowseFileResult, error)
- func (s *Service) BrowseSkillTree(skillPath string, dir string) (*SkillBrowseTreeResult, error)
- func (s *Service) CancelRun(meta *session.Meta, runID string) error
- func (s *Service) CancelThread(meta *session.Meta, threadID string) error
- func (s *Service) Close() error
- func (s *Service) CreateSkill(scope string, name string, description string, body string) (*SkillCatalog, error)
- func (s *Service) CreateThread(ctx context.Context, meta *session.Meta, title string, modelID string, ...) (*ThreadView, error)
- func (s *Service) DeleteFollowup(ctx context.Context, meta *session.Meta, threadID string, followupID string) error
- func (s *Service) DeleteSkill(scope string, name string) (*SkillCatalog, error)
- func (s *Service) DeleteThread(ctx context.Context, meta *session.Meta, threadID string, force bool) error
- func (s *Service) DesktopModelSourceBindingSnapshot() runtimeservice.Binding
- func (s *Service) DesktopModelSourceBindingStatus(ctx context.Context) runtimeservice.Binding
- func (s *Service) DetachRealtimeSink(streamServer *rpc.Server)
- func (s *Service) DisconnectDesktopModelSource() *AIRuntimeStatus
- func (s *Service) Enabled() bool
- func (s *Service) GetActiveRunSnapshot(meta *session.Meta, threadID string) (string, string, error)
- func (s *Service) GetTerminalToolOutput(ctx context.Context, meta *session.Meta, runID string, toolID string) (*TerminalToolOutput, error)
- func (s *Service) GetThread(ctx context.Context, meta *session.Meta, threadID string) (*ThreadView, error)
- func (s *Service) GetThreadTodos(ctx context.Context, meta *session.Meta, threadID string) (*ThreadTodosView, error)
- func (s *Service) GetToolDetail(ctx context.Context, meta *session.Meta, runID string, toolID string) (*ToolDetail, error)
- func (s *Service) HasActiveThread(threadID string) bool
- func (s *Service) HasActiveThreadForEndpoint(endpointID string, threadID string) bool
- func (s *Service) ImportGitHubSkills(req SkillGitHubImportRequest) (*SkillGitHubImportResult, error)
- func (s *Service) ListActiveThreadRuns(endpointID string) []ActiveThreadRun
- func (s *Service) ListFollowups(ctx context.Context, meta *session.Meta, threadID string, limit int) (*ListFollowupsResponse, error)
- func (s *Service) ListGitHubSkillCatalog(req SkillGitHubCatalogRequest) (*SkillGitHubCatalog, error)
- func (s *Service) ListModels() (*ModelsResponse, error)
- func (s *Service) ListRecentThreadToolCalls(ctx context.Context, meta *session.Meta, threadID string, limit int) ([]threadstore.ToolCallRecord, error)
- func (s *Service) ListRunEvents(ctx context.Context, meta *session.Meta, runID string, limit int) (*ListRunEventsResponse, error)
- func (s *Service) ListRunEventsWithQuery(ctx context.Context, meta *session.Meta, runID string, ...) (*ListRunEventsResponse, error)
- func (s *Service) ListSkillSources() (*SkillSourcesView, error)
- func (s *Service) ListSkillsCatalog() (*SkillCatalog, error)
- func (s *Service) ListThreadMessages(ctx context.Context, meta *session.Meta, threadID string, limit int, ...) (*ListThreadMessagesResponse, error)
- func (s *Service) ListThreads(ctx context.Context, meta *session.Meta, limit int, cursor string) (*ListThreadsResponse, error)
- func (s *Service) OpenUpload(ctx context.Context, endpointID string, uploadID string) (*UploadResponse, string, error)
- func (s *Service) PatchSkillToggles(patches []SkillTogglePatch) (*SkillCatalog, error)
- func (s *Service) PrepareDesktopModelSource(session DesktopModelSourceSession) (*AIRuntimeStatus, error)
- func (s *Service) RegisterRPC(r *rpc.Router, meta *session.Meta, streamServer *rpc.Server)
- func (s *Service) RegisterRPCWithAccessGate(r *rpc.Router, meta *session.Meta, streamServer *rpc.Server, ...)
- func (s *Service) ReinstallSkills(paths []string, overwrite bool) (*SkillReinstallResult, error)
- func (s *Service) ReloadSkillsCatalog() (*SkillCatalog, error)
- func (s *Service) RenameThread(ctx context.Context, meta *session.Meta, threadID string, title string) error
- func (s *Service) ReorderFollowups(ctx context.Context, meta *session.Meta, threadID string, ...) error
- func (s *Service) RuntimeStatus(ctx context.Context) *AIRuntimeStatus
- func (s *Service) SaveUpload(ctx context.Context, endpointID string, r io.Reader, name string, ...) (*UploadResponse, error)
- func (s *Service) SendUserTurn(ctx context.Context, meta *session.Meta, req SendUserTurnRequest) (SendUserTurnResponse, error)
- func (s *Service) ServeDesktopModelSourceRPC(ctx context.Context, session DesktopModelSourceSession, ws *websocket.Conn, ...) error
- func (s *Service) SetCurrentModelID(modelID string, persist func(next *config.AIConfig) error) error
- func (s *Service) SetThreadExecutionMode(ctx context.Context, meta *session.Meta, threadID string, executionMode string) error
- func (s *Service) SetThreadModel(ctx context.Context, meta *session.Meta, threadID string, modelID string) error
- func (s *Service) StartRun(ctx context.Context, meta *session.Meta, runID string, req RunStartRequest, ...) error
- func (s *Service) StartRunDetached(meta *session.Meta, runID string, req RunStartRequest) error
- func (s *Service) StartRunDetachedWithPersisted(meta *session.Meta, runID string, req RunStartRequest, ...) error
- func (s *Service) StopThread(ctx context.Context, meta *session.Meta, threadID string) (StopThreadResponse, error)
- func (s *Service) SubmitStructuredPromptResponse(ctx context.Context, meta *session.Meta, ...) (SubmitStructuredPromptResponseResponse, error)
- func (s *Service) SubscribeSummary(endpointID string, streamServer *rpc.Server) ([]ActiveThreadRun, error)
- func (s *Service) SubscribeThread(endpointID string, threadID string, streamServer *rpc.Server) (string, error)
- func (s *Service) UpdateConfig(next *config.AIConfig, persist func() error) error
- func (s *Service) UpdateFilesystemScope(scope *filesystemscope.Registry) error
- func (s *Service) UpdateFollowup(ctx context.Context, meta *session.Meta, threadID string, followupID string, ...) error
- func (s *Service) ValidateGitHubSkillImport(req SkillGitHubImportRequest) (*SkillGitHubValidateResult, error)
- func (s *Service) ValidateWorkingDir(workingDir string) (string, error)
- type SkillActivation
- type SkillBrowseFileResult
- type SkillBrowseTreeEntry
- type SkillBrowseTreeResult
- type SkillCatalog
- type SkillCatalogEntry
- type SkillCatalogNotice
- type SkillError
- type SkillGitHubAuth
- type SkillGitHubCatalog
- type SkillGitHubCatalogItem
- type SkillGitHubCatalogRequest
- type SkillGitHubCatalogSource
- type SkillGitHubImportItem
- type SkillGitHubImportRequest
- type SkillGitHubImportResult
- type SkillGitHubResolvedSkill
- type SkillGitHubValidateResult
- type SkillMCPDependency
- type SkillMeta
- type SkillReinstallItem
- type SkillReinstallResult
- type SkillSourceRecord
- type SkillSourceType
- type SkillSourcesView
- type SkillTogglePatch
- type SourceRef
- type StepResult
- type StopThreadRequest
- type StopThreadResponse
- type StreamEvent
- type StreamEventType
- type SubmitStructuredPromptResponseRequest
- type SubmitStructuredPromptResponseResponse
- type TerminalToolOutput
- type ThreadTodosView
- type ThreadView
- type TodoItem
- type TodoSummary
- type ToolApprovalRequest
- type ToolCall
- type ToolCallBlock
- type ToolCallStatus
- type ToolDef
- type ToolDetail
- type ToolHandler
- type ToolInterceptor
- type ToolRegistry
- type ToolResult
- type TurnBudgets
- type TurnHook
- type TurnProviderState
- type TurnRequest
- type TurnResult
- type TurnSnapshot
- type TurnUsage
- type UploadResponse
Constants ¶
const ( AskUserReasonUserDecisionRequired = "user_decision_required" AskUserReasonPermissionBlocked = "permission_blocked" AskUserReasonMissingExternalInput = "missing_external_input" AskUserReasonConflictingWork = "conflicting_constraints" AskUserReasonSafetyConfirmation = "safety_confirmation" )
const ( DesktopModelSourceProviderType = "desktop_model_source" DesktopModelSourceProtocolVersion = "redeven-desktop-model-source-rpc-v1" DesktopModelSourceDefaultSource = "desktop_local_environment" )
const ( RunExecutionContractDirectReply = "direct_reply" RunExecutionContractHybridFirstTurn = "hybrid_first_turn" RunExecutionContractAgenticLoop = "agentic_loop" )
const ( RunIntentSocial = "social" RunIntentCreative = "creative" RunIntentTask = "task" RunIntentSourceModel = "model" RunIntentSourceDeterministic = "deterministic_fallback" RunObjectiveModeReplace = "replace" RunObjectiveModeContinue = "continue" )
const ( // Type IDs must stay in sync with // internal/envapp/ui_src/src/ui/protocol/redeven_v1/typeIds.ts. TypeID_AI_SEND_USER_TURN uint32 = 6001 TypeID_AI_RUN_CANCEL uint32 = 6002 TypeID_AI_SUBSCRIBE_SUMMARY uint32 = 6003 TypeID_AI_EVENT_NOTIFY uint32 = 6004 // notify (agent -> client) TypeID_AI_TOOL_APPROVAL uint32 = 6005 TypeID_AI_MESSAGES_LIST uint32 = 6006 TypeID_AI_ACTIVE_RUN_SNAPSHOT uint32 = 6007 TypeID_AI_SUBSCRIBE_THREAD uint32 = 6009 TypeID_AI_STOP_THREAD uint32 = 6011 TypeID_AI_SUBMIT_STRUCTURED_PROMPT_RESPONSE uint32 = 6012 )
const ( ErrCodeAISkillsInvalidScope = "AI_SKILLS_INVALID_SCOPE" ErrCodeAISkillsInvalidSource = "AI_SKILLS_INVALID_SOURCE" ErrCodeAISkillsInvalidPath = "AI_SKILLS_INVALID_PATH" ErrCodeAISkillsPathEscape = "AI_SKILLS_PATH_ESCAPE" ErrCodeAISkillsSkillExists = "AI_SKILLS_SKILL_EXISTS" ErrCodeAISkillsSkillNotFound = "AI_SKILLS_SKILL_NOT_FOUND" ErrCodeAISkillsFrontmatterBad = "AI_SKILLS_FRONTMATTER_INVALID" ErrCodeAISkillsGitHubFetchFailed = "AI_SKILLS_GITHUB_FETCH_FAILED" ErrCodeAISkillsGitFallbackFailed = "AI_SKILLS_GIT_FALLBACK_FAILED" ErrCodeAISkillsArchiveInvalid = "AI_SKILLS_ARCHIVE_INVALID" ErrCodeAISkillsBrowseForbidden = "AI_SKILLS_BROWSE_FORBIDDEN" ErrCodeAISkillsFileTooLarge = "AI_SKILLS_FILE_TOO_LARGE" ErrCodeAISkillsInternal = "AI_SKILLS_INTERNAL_ERROR" )
const ( TaskComplexitySimple = "simple" TaskComplexityStandard = "standard" TaskComplexityComplex = "complex" )
const ( TodoPolicyNone = "none" TodoPolicyRecommended = "recommended" TodoPolicyRequired = "required" )
const ( TodoStatusPending = "pending" TodoStatusInProgress = "in_progress" TodoStatusCompleted = "completed" TodoStatusCancelled = "cancelled" )
Variables ¶
var ( ErrNotConfigured = errors.New("ai not configured") ErrRunActive = errors.New("run already active") ErrThreadBusy = errors.New("thread already active") ErrModelLockViolation = errors.New("model lock violation") ErrModelSwitchRequiresExplicitRestart = errors.New("model switch requires explicit restart") )
var ErrFollowupsRevisionChanged = errors.New("followups revision changed")
var ErrInvalidFollowupLane = errors.New("invalid followup lane")
var ErrRunChanged = errors.New("run changed")
var ErrWaitingPromptChanged = errors.New("waiting prompt changed")
var ErrWaitingUserQueueConflict = errors.New("waiting-user queue request conflicts with waiting response")
Functions ¶
func IsActiveRunState ¶
func NewQueuedTurnID ¶
func NewThreadID ¶
NewThreadID generates a cryptographically random thread id.
func RunDesktopModelSourceConnector ¶ added in v0.6.8
func RunDesktopModelSourceConnector(ctx context.Context, opts DesktopModelSourceConnectorOptions) error
func SkillErrorCode ¶
func SkillErrorStatus ¶
Types ¶
type AIRuntimeStatus ¶ added in v0.6.4
type AIRuntimeStatus struct {
RemoteConfigured bool `json:"remote_configured"`
DesktopModelSource *DesktopModelSourceStatus `json:"desktop_model_source,omitempty"`
}
type ActiveThreadRun ¶
ActiveThreadRun is returned in subscribe snapshots so late subscribers can discover currently running threads before live events arrive.
type ActivityChip ¶ added in v0.6.10
type ActivityDetailRef ¶ added in v0.6.10
type ActivityGroup ¶ added in v0.6.10
type ActivityGroup struct {
GroupID string `json:"groupId"`
Kind string `json:"kind"`
Renderer string `json:"renderer"`
Status string `json:"status"`
Title string `json:"title"`
Subtitle string `json:"subtitle,omitempty"`
Severity string `json:"severity,omitempty"` // quiet|normal|warning|error|blocking
DefaultOpen bool `json:"defaultOpen"`
Items []ActivityItem `json:"items"`
Chips []ActivityChip `json:"chips,omitempty"`
DetailRefs []ActivityDetailRef `json:"detailRefs,omitempty"`
StartedAtUnixMS int64 `json:"startedAtUnixMs,omitempty"`
EndedAtUnixMS int64 `json:"endedAtUnixMs,omitempty"`
}
type ActivityItem ¶ added in v0.6.10
type ActivityItem struct {
ItemID string `json:"itemId"`
GroupID string `json:"groupId,omitempty"`
ToolID string `json:"toolId,omitempty"`
ToolName string `json:"toolName,omitempty"`
Kind string `json:"kind,omitempty"`
Renderer string `json:"renderer,omitempty"`
Status string `json:"status"`
Severity string `json:"severity,omitempty"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
TargetRefs []ActivityTargetRef `json:"targetRefs,omitempty"`
Chips []ActivityChip `json:"chips,omitempty"`
DetailRefs []ActivityDetailRef `json:"detailRefs,omitempty"`
RequiresApproval bool `json:"requiresApproval,omitempty"`
ApprovalState string `json:"approvalState,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
Metrics map[string]any `json:"metrics,omitempty"`
StartedAtUnixMS int64 `json:"startedAtUnixMs,omitempty"`
EndedAtUnixMS int64 `json:"endedAtUnixMs,omitempty"`
}
type ActivitySummary ¶ added in v0.6.10
type ActivityTargetRef ¶ added in v0.6.10
type ActivityTimelineBlock ¶ added in v0.6.10
type ActivityTimelineBlock struct {
Type string `json:"type"` // activity-timeline
SchemaVersion int `json:"schemaVersion"`
RunID string `json:"runId"`
MessageID string `json:"messageId"`
Summary ActivitySummary `json:"summary"`
Groups []ActivityGroup `json:"groups"`
}
type BudgetHint ¶
type BudgetHint struct {
MaxSteps int
}
type ContentPart ¶
type ContentPart struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
FileURI string `json:"file_uri,omitempty"`
MimeType string `json:"mime_type,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
ToolUseID string `json:"tool_use_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
ArgsJSON string `json:"args_json,omitempty"`
JSON []byte `json:"json,omitempty"`
}
type CoreToolScheduler ¶
type CoreToolScheduler struct {
// contains filtered or unexported fields
}
func NewCoreToolScheduler ¶
func NewCoreToolScheduler(reg ToolRegistry, modeFilter ModeToolFilter, interceptors ...ToolInterceptor) (*CoreToolScheduler, error)
func (*CoreToolScheduler) ActiveTools ¶
func (s *CoreToolScheduler) ActiveTools(mode string) []ToolDef
func (*CoreToolScheduler) Dispatch ¶
func (s *CoreToolScheduler) Dispatch(ctx context.Context, mode string, calls []ToolCall) []ToolResult
func (*CoreToolScheduler) HandlePartial ¶
func (s *CoreToolScheduler) HandlePartial(ctx context.Context, partial PartialToolCall) error
type CreateThreadRequest ¶
type CreateThreadResponse ¶
type CreateThreadResponse struct {
Thread ThreadView `json:"thread"`
}
type DefaultModeToolFilter ¶
type DefaultModeToolFilter struct{}
func (DefaultModeToolFilter) FilterToolsForMode ¶
func (f DefaultModeToolFilter) FilterToolsForMode(mode string, all []ToolDef) []ToolDef
type DesktopModelSourceConnectorOptions ¶ added in v0.6.8
type DesktopModelSourceModel ¶ added in v0.6.8
type DesktopModelSourceModel struct {
ID string `json:"id"`
Label string `json:"label,omitempty"`
Provider string `json:"provider,omitempty"`
ContextWindow int `json:"context_window,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
EffectiveContextWindowPercent int `json:"effective_context_window_percent,omitempty"`
InputModalities []string `json:"input_modalities,omitempty"`
SupportsImageInput bool `json:"supports_image_input,omitempty"`
}
type DesktopModelSourceModelSnapshot ¶ added in v0.6.8
type DesktopModelSourceModelSnapshot struct {
Configured bool `json:"configured"`
CurrentModel string `json:"current_model"`
Models []DesktopModelSourceModel `json:"models"`
MissingKeyProviderIDs []string `json:"missing_key_provider_ids,omitempty"`
}
type DesktopModelSourceRPCError ¶ added in v0.6.8
type DesktopModelSourceRPCError struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}
func (*DesktopModelSourceRPCError) Error ¶ added in v0.6.8
func (e *DesktopModelSourceRPCError) Error() string
type DesktopModelSourceRPCFrame ¶ added in v0.6.8
type DesktopModelSourceRPCFrame struct {
ProtocolVersion string `json:"protocol_version,omitempty"`
ID string `json:"id,omitempty"`
Type string `json:"type"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Event *StreamEvent `json:"event,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *DesktopModelSourceRPCError `json:"error,omitempty"`
}
type DesktopModelSourceSession ¶ added in v0.6.8
type DesktopModelSourceStartupReport ¶ added in v0.6.8
type DesktopModelSourceStatus ¶ added in v0.6.8
type DesktopModelSourceStatus struct {
BindingState string `json:"binding_state,omitempty"`
Connected bool `json:"connected"`
Available bool `json:"available"`
ModelSource string `json:"model_source,omitempty"`
SessionID string `json:"session_id,omitempty"`
ExpiresAtUnixMS int64 `json:"expires_at_unix_ms,omitempty"`
ConnectedAtUnixMS int64 `json:"connected_at_unix_ms,omitempty"`
ModelCount int `json:"model_count"`
MissingKeyProviderIDs []string `json:"missing_key_provider_ids,omitempty"`
LastError string `json:"last_error,omitempty"`
}
type DiffHunkView ¶
type ExitPlanModeArgs ¶
type ExitPlanModeArgs struct {
Summary string `json:"summary,omitempty"`
AllowedPrompts []ExitPlanPromptRef `json:"allowed_prompts,omitempty"`
}
type ExitPlanModeResult ¶
type ExitPlanModeResult struct {
WaitingPrompt *RequestUserInputPrompt `json:"waiting_prompt,omitempty"`
Summary string `json:"summary,omitempty"`
}
type ExitPlanPromptRef ¶
type FileEditArgs ¶
type FileMutationResult ¶
type FileMutationResult struct {
FilePath string `json:"file_path"`
ChangeType string `json:"change_type"`
StructuredDiff []DiffHunkView `json:"structured_diff,omitempty"`
OriginalFile string `json:"original_file,omitempty"`
UpdatedFile string `json:"updated_file,omitempty"`
}
type FileReadArgs ¶
type FileReadResult ¶
type FileWriteArgs ¶
type FollowupAttachmentView ¶
type FollowupItemView ¶
type FollowupItemView struct {
FollowupID string `json:"followup_id"`
Lane string `json:"lane"`
MessageID string `json:"message_id"`
Text string `json:"text"`
ModelID string `json:"model_id,omitempty"`
ExecutionMode string `json:"execution_mode,omitempty"`
Position int `json:"position"`
CreatedAtUnixMs int64 `json:"created_at_unix_ms"`
Attachments []FollowupAttachmentView `json:"attachments,omitempty"`
}
type InMemoryToolRegistry ¶
type InMemoryToolRegistry struct {
// contains filtered or unexported fields
}
func NewInMemoryToolRegistry ¶
func NewInMemoryToolRegistry() *InMemoryToolRegistry
func (*InMemoryToolRegistry) Register ¶
func (r *InMemoryToolRegistry) Register(tool ToolDef, handler ToolHandler) error
func (*InMemoryToolRegistry) Snapshot ¶
func (r *InMemoryToolRegistry) Snapshot() []ToolDef
func (*InMemoryToolRegistry) Unregister ¶
func (r *InMemoryToolRegistry) Unregister(name string) error
type ListFollowupsResponse ¶
type ListFollowupsResponse struct {
Revision int64 `json:"revision"`
PausedReason string `json:"paused_reason,omitempty"`
Queued []FollowupItemView `json:"queued"`
Drafts []FollowupItemView `json:"drafts"`
}
type ListRunEventsQuery ¶
type ListRunEventsResponse ¶
type ListRunEventsResponse struct {
Events []RunEventView `json:"events"`
NextCursor int64 `json:"next_cursor,omitempty"`
HasMore bool `json:"has_more,omitempty"`
}
type ListThreadsResponse ¶
type ListThreadsResponse struct {
Threads []ThreadView `json:"threads"`
NextCursor string `json:"next_cursor,omitempty"`
}
type LoopBudget ¶
type LoopDetector ¶
type Message ¶
type Message struct {
Role string `json:"role"`
Content []ContentPart `json:"content"`
}
type ModeToolFilter ¶
type Model ¶
type Model struct {
ID string `json:"id"`
Label string `json:"label,omitempty"`
Source string `json:"source,omitempty"`
SourceLabel string `json:"source_label,omitempty"`
ContextWindow int `json:"context_window,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
InputModalities []string `json:"input_modalities,omitempty"`
SupportsImageInput bool `json:"supports_image_input,omitempty"`
}
type ModelSelectInput ¶
type ModelSelector ¶
type ModelsResponse ¶
type ModelsResponse struct {
CurrentModel string `json:"current_model"`
Models []Model `json:"models"`
Runtime *AIRuntimeStatus `json:"runtime,omitempty"`
}
func NewModelsResponse ¶ added in v0.6.10
func NewModelsResponse(runtime *AIRuntimeStatus) *ModelsResponse
NewModelsResponse keeps the public models contract stable for empty results.
type Options ¶
type Options struct {
Logger *slog.Logger
StateDir string
AgentHomeDir string
Shell string
FilesystemScope *filesystemscope.Registry
Config *config.AIConfig
// PersistOpTimeout is the per-operation timeout for threadstore persistence
// (SQLite reads/writes). It must NOT be tied to a run's overall lifetime, since
// runs can take much longer than persistence should ever be allowed to block.
//
// When zero, it defaults to 10 seconds.
PersistOpTimeout time.Duration
// RunMaxWallTime is the hard cap for a single run's lifetime.
//
// When zero, it defaults to 15 minutes.
RunMaxWallTime time.Duration
// RunIdleTimeout cancels a run if no runtime stream activity is observed for the duration.
//
// When zero, it defaults to 2 minutes.
RunIdleTimeout time.Duration
// ToolApprovalTimeout is the max time a run waits for user approval for high-risk tools.
//
// When zero, it defaults to 10 minutes.
ToolApprovalTimeout time.Duration
// StreamWriteTimeout is the best-effort per-frame write deadline for the NDJSON stream.
//
// When zero, it defaults to 5 seconds.
StreamWriteTimeout time.Duration
// ResolveProviderAPIKey returns the API key for the given provider id.
//
// It should read from a local secrets store, not from config.json.
ResolveProviderAPIKey func(providerID string) (string, bool, error)
// ResolveWebSearchProviderAPIKey returns the API key for a provider-scoped web search backend.
//
// It should read from a local secrets store, not from config.json.
ResolveWebSearchProviderAPIKey func(providerID string) (string, bool, error)
}
type PartialToolCall ¶
type PartialUsage ¶
type PatchFollowupRequest ¶
type PatchFollowupRequest struct {
Text *string `json:"text,omitempty"`
}
type PatchThreadRequest ¶
type Provider ¶
type Provider interface {
StreamTurn(ctx context.Context, req TurnRequest, onEvent func(StreamEvent)) (TurnResult, error)
}
Provider is the normalized runtime adapter contract.
type ProviderControls ¶
type ProviderControls struct {
ThinkingBudgetTokens int `json:"thinking_budget_tokens,omitempty"`
CacheControl string `json:"cache_control,omitempty"`
ResponseFormat string `json:"response_format,omitempty"`
PreviousResponseID string `json:"previous_response_id,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
TopP *float64 `json:"top_p,omitempty"`
}
type RealtimeEvent ¶
type RealtimeEvent struct {
EventType RealtimeEventType `json:"event_type"`
EndpointID string `json:"endpoint_id"`
ThreadID string `json:"thread_id"`
RunID string `json:"run_id"`
AtUnixMs int64 `json:"at_unix_ms"`
StreamKind RealtimeStreamKind `json:"stream_kind,omitempty"`
Phase RealtimeLifecyclePhase `json:"phase,omitempty"`
Diag map[string]any `json:"diag,omitempty"`
StreamEvent any `json:"stream_event,omitempty"`
RunStatus string `json:"run_status,omitempty"`
RunError string `json:"run_error,omitempty"`
WaitingPrompt *RequestUserInputPrompt `json:"waiting_prompt,omitempty"`
// Transcript message events (EventType=transcript_message).
MessageRowID int64 `json:"message_row_id,omitempty"`
MessageJSON json.RawMessage `json:"message_json,omitempty"`
// Thread summary events (EventType=thread_summary).
Title string `json:"title,omitempty"`
UpdatedAtUnixMs int64 `json:"updated_at_unix_ms,omitempty"`
LastMessagePreview string `json:"last_message_preview,omitempty"`
LastMessageAtUnixMs int64 `json:"last_message_at_unix_ms,omitempty"`
ActiveRunID string `json:"active_run_id,omitempty"`
LastContextRunID string `json:"last_context_run_id,omitempty"`
ExecutionMode string `json:"execution_mode,omitempty"`
QueuedTurnCount int `json:"queued_turn_count,omitempty"`
// Transcript reset events (EventType=transcript_reset).
ResetReason string `json:"reset_reason,omitempty"`
ResetCheckpointID string `json:"reset_checkpoint_id,omitempty"`
}
RealtimeEvent is emitted by the agent for cross-session AI chat collaboration.
JSON fields use snake_case because this payload is transported over Redeven RPC wire.
type RealtimeEventType ¶
type RealtimeEventType string
RealtimeEventType defines the high-level AI event category sent over Flowersec RPC notify.
const ( RealtimeEventTypeStream RealtimeEventType = "stream_event" RealtimeEventTypeThreadState RealtimeEventType = "thread_state" RealtimeEventTypeTranscript RealtimeEventType = "transcript_message" RealtimeEventTypeTranscriptReset RealtimeEventType = "transcript_reset" RealtimeEventTypeThreadSummary RealtimeEventType = "thread_summary" )
type RealtimeLifecyclePhase ¶
type RealtimeLifecyclePhase string
RealtimeLifecyclePhase marks lifecycle transitions.
const ( RealtimePhaseStart RealtimeLifecyclePhase = "start" RealtimePhaseStateChange RealtimeLifecyclePhase = "state_change" RealtimePhaseEnd RealtimeLifecyclePhase = "end" RealtimePhaseError RealtimeLifecyclePhase = "error" )
type RealtimeStreamKind ¶
type RealtimeStreamKind string
RealtimeStreamKind is a low-cardinality stream category for diagnostics/UI routing.
const ( RealtimeStreamKindLifecycle RealtimeStreamKind = "lifecycle" RealtimeStreamKindAssistant RealtimeStreamKind = "assistant" RealtimeStreamKindTool RealtimeStreamKind = "tool" RealtimeStreamKindContext RealtimeStreamKind = "context" )
type ReorderFollowupsRequest ¶
type RequestUserInputAction ¶
type RequestUserInputAnswer ¶
type RequestUserInputAnswer struct {
ChoiceID string `json:"choice_id,omitempty"`
Text string `json:"text,omitempty"`
}
func (*RequestUserInputAnswer) UnmarshalJSON ¶
func (a *RequestUserInputAnswer) UnmarshalJSON(data []byte) error
type RequestUserInputChoice ¶
type RequestUserInputPrompt ¶
type RequestUserInputPrompt struct {
PromptID string `json:"prompt_id"`
MessageID string `json:"message_id"`
ToolID string `json:"tool_id"`
ReasonCode string `json:"reason_code,omitempty"`
RequiredFromUser []string `json:"required_from_user,omitempty"`
EvidenceRefs []string `json:"evidence_refs,omitempty"`
InteractionContract interactionContract `json:"interaction_contract,omitempty"`
Questions []RequestUserInputQuestion `json:"questions,omitempty"`
PublicSummary string `json:"public_summary,omitempty"`
ContainsSecret bool `json:"contains_secret,omitempty"`
}
type RequestUserInputQuestion ¶
type RequestUserInputQuestion struct {
ID string `json:"id"`
Header string `json:"header"`
Question string `json:"question"`
IsSecret bool `json:"is_secret"`
ResponseMode string `json:"response_mode,omitempty"`
ChoicesExhaustive *bool `json:"choices_exhaustive,omitempty"`
WriteLabel string `json:"write_label,omitempty"`
WritePlaceholder string `json:"write_placeholder,omitempty"`
Choices []RequestUserInputChoice `json:"choices,omitempty"`
}
type RequestUserInputResolvedQuestion ¶
type RequestUserInputResolvedQuestion struct {
QuestionID string `json:"question_id"`
Header string `json:"header,omitempty"`
Question string `json:"question,omitempty"`
SelectedChoiceID string `json:"selected_choice_id,omitempty"`
SelectedChoiceLabel string `json:"selected_choice_label,omitempty"`
Text string `json:"text,omitempty"`
PublicSummary string `json:"public_summary,omitempty"`
ContainsSecret bool `json:"contains_secret,omitempty"`
}
type RequestUserInputResponse ¶
type RequestUserInputResponse struct {
PromptID string `json:"prompt_id"`
Answers map[string]RequestUserInputAnswer `json:"answers"`
}
type RequestUserInputResponseRecord ¶
type RequestUserInputResponseRecord struct {
PromptID string `json:"prompt_id"`
ToolID string `json:"tool_id,omitempty"`
ReasonCode string `json:"reason_code,omitempty"`
Responses []RequestUserInputResolvedQuestion `json:"responses,omitempty"`
PublicSummary string `json:"public_summary,omitempty"`
ContainsSecret bool `json:"contains_secret,omitempty"`
ResponseMessageID string `json:"response_message_id,omitempty"`
}
type RunAttachmentIn ¶
type RunCompletionMode ¶
type RunCompletionMode string
const ( RunCompletionModeExplicitSignal RunCompletionMode = "explicit_signal" RunCompletionModeRuntimeCloseout RunCompletionMode = "runtime_closeout" )
type RunContext ¶
type RunEventView ¶
type RunHistoryMsg ¶
type RunInput ¶
type RunInput struct {
// MessageID is an optional client-supplied id for the user input message persisted in the transcript.
//
// When set, the agent will prefer this id over generating a new one so the UI can keep a stable
// message id across optimistic rendering, realtime events, and history backfill.
MessageID string `json:"message_id,omitempty"`
Text string `json:"text"`
Attachments []RunAttachmentIn `json:"attachments"`
StructuredResponse *RequestUserInputResponseRecord `json:"-"`
SecretAnswers []RequestUserInputSecretAnswer `json:"-"`
InteractionContractSeed interactionContract `json:"-"`
}
type RunOptions ¶
type RunOptions struct {
MaxSteps int `json:"max_steps"`
// MaxNoToolRounds controls no-tool backpressure rounds before forcing ask_user.
// Default: 3.
MaxNoToolRounds int `json:"max_no_tool_rounds,omitempty"`
// ReasoningOnly relaxes tool-pressure heuristics, but task completion still requires explicit task_complete.
ReasoningOnly bool `json:"reasoning_only,omitempty"`
// RequireUserConfirmOnTaskComplete forces explicit user confirmation when model emits task_complete.
RequireUserConfirmOnTaskComplete bool `json:"require_user_confirm_on_task_complete,omitempty"`
// NoUserInteraction disables ask_user and approval waits for autonomous runs.
NoUserInteraction bool `json:"no_user_interaction,omitempty"`
// ToolAllowlist is an internal runtime guard that limits the visible tool surface
// for the current run. It is intended for runtime-owned callers such as evals and
// subagents rather than general user-facing requests.
ToolAllowlist []string `json:"tool_allowlist,omitempty"`
// ForceReadonlyExec is an internal runtime guard that blocks mutating
// terminal.exec invocations for the current run.
ForceReadonlyExec bool `json:"force_readonly_exec,omitempty"`
// Mode overrides runtime mode for this run (act|plan).
Mode string `json:"mode,omitempty"`
// Intent is classified by the assistant runtime (social|creative|task).
// Clients should not set this field directly.
Intent string `json:"intent,omitempty"`
// ExecutionContract is classified by the runtime (direct_reply|hybrid_first_turn|agentic_loop).
// Clients should not set this field directly.
ExecutionContract string `json:"execution_contract,omitempty"`
// Complexity is classified by the runtime (simple|standard|complex).
// Clients should not set this field directly.
Complexity string `json:"complexity,omitempty"`
// TodoPolicy is classified by the runtime (none|recommended|required).
// Clients should not set this field directly.
TodoPolicy string `json:"todo_policy,omitempty"`
// MinimumTodoItems is enforced when TodoPolicy is required.
// Clients should not set this field directly.
MinimumTodoItems int `json:"minimum_todo_items,omitempty"`
// Provider controls.
ThinkingBudgetTokens int `json:"thinking_budget_tokens,omitempty"`
CacheControl string `json:"cache_control,omitempty"`
ResponseFormat string `json:"response_format,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
TopP *float64 `json:"top_p,omitempty"`
// Optional hard budgets (0 means unset).
MaxInputTokens int `json:"max_input_tokens,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
MaxCostUSD float64 `json:"max_cost_usd,omitempty"`
// CompactionThreshold controls when runtime compaction is triggered.
// Value is a fraction in range [0,1]. 0 means use runtime default.
CompactionThreshold float64 `json:"compaction_threshold,omitempty"`
}
type RunProtocolProfile ¶
type RunProtocolProfile struct {
Surface RunProtocolSurface `json:"surface"`
CompletionMode RunCompletionMode `json:"completion_mode"`
WaitingMode RunWaitingMode `json:"waiting_mode"`
AllowPatchTool bool `json:"allow_patch_tool"`
AllowSignalTools bool `json:"allow_signal_tools"`
}
type RunProtocolSurface ¶
type RunProtocolSurface string
const ( RunProtocolSurfaceLegacySignals RunProtocolSurface = "legacy_signals" RunProtocolSurfaceStructuredFileOps RunProtocolSurface = "structured_fileops" )
type RunRequest ¶
type RunRequest struct {
Model string `json:"model"`
Objective string `json:"objective,omitempty"`
History []RunHistoryMsg `json:"history"`
Input RunInput `json:"input"`
Options RunOptions `json:"options"`
ContextPack contextmodel.PromptPack `json:"-"`
ModelCapability contextmodel.ModelCapability `json:"-"`
InteractionContract interactionContract `json:"-"`
}
RunRequest is the internal run request for Go runtime execution (includes history).
type RunStartRequest ¶
type RunStartRequest struct {
ThreadID string `json:"thread_id"`
Model string `json:"model"`
Input RunInput `json:"input"`
Options RunOptions `json:"options"`
}
RunStartRequest is the HTTP request body for starting an AI run.
Notes: - thread_id is mandatory; the agent builds history from the persisted thread store. - history must NOT be provided by clients (agent is the source of truth).
type RunState ¶
type RunState string
RunState is the normalized state machine for a single AI run.
const ( RunStateIdle RunState = "idle" RunStateAccepted RunState = "accepted" RunStateRunning RunState = "running" RunStateWaitingApproval RunState = "waiting_approval" RunStateRecovering RunState = "recovering" RunStateFinalizing RunState = "finalizing" RunStateWaitingUser RunState = "waiting_user" RunStateSuccess RunState = "success" RunStateFailed RunState = "failed" RunStateCanceled RunState = "canceled" RunStateTimedOut RunState = "timed_out" )
func NormalizeRunState ¶
type RunWaitingMode ¶
type RunWaitingMode string
const ( RunWaitingModeAskUser RunWaitingMode = "ask_user" RunWaitingModeExitPlanMode RunWaitingMode = "exit_plan_mode" )
type RuntimeCloseout ¶
type SendUserTurnRequest ¶
type SendUserTurnRequest struct {
ThreadID string `json:"thread_id"`
Model string `json:"model,omitempty"`
Input RunInput `json:"input"`
Options RunOptions `json:"options"`
ExpectedRunID string `json:"expected_run_id,omitempty"`
QueueAfterWaitingUser bool `json:"queue_after_waiting_user,omitempty"`
SourceFollowupID string `json:"source_followup_id,omitempty"`
}
type SendUserTurnResponse ¶
type SendUserTurnResponse struct {
RunID string `json:"run_id"`
Kind string `json:"kind"` // "start" | "queued"
QueueID string `json:"queue_id,omitempty"`
QueuePosition int `json:"queue_position,omitempty"`
ConsumedWaitingPromptID string `json:"consumed_waiting_prompt_id,omitempty"`
AppliedExecutionMode string `json:"applied_execution_mode,omitempty"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ActiveRunCount ¶
ActiveRunCount returns the number of active runs for the given endpoint.
When endpointID is empty, it returns the global active run count.
func (*Service) AppendThreadMessage ¶
func (*Service) ApproveTool ¶
func (*Service) BrowseSkillFile ¶
func (*Service) BrowseSkillTree ¶
func (s *Service) BrowseSkillTree(skillPath string, dir string) (*SkillBrowseTreeResult, error)
func (*Service) CancelThread ¶
func (*Service) CreateSkill ¶
func (*Service) CreateThread ¶
func (*Service) DeleteFollowup ¶
func (*Service) DeleteSkill ¶
func (s *Service) DeleteSkill(scope string, name string) (*SkillCatalog, error)
func (*Service) DeleteThread ¶
func (*Service) DesktopModelSourceBindingSnapshot ¶ added in v0.6.8
func (s *Service) DesktopModelSourceBindingSnapshot() runtimeservice.Binding
func (*Service) DesktopModelSourceBindingStatus ¶ added in v0.6.8
func (s *Service) DesktopModelSourceBindingStatus(ctx context.Context) runtimeservice.Binding
func (*Service) DetachRealtimeSink ¶
func (*Service) DisconnectDesktopModelSource ¶ added in v0.6.8
func (s *Service) DisconnectDesktopModelSource() *AIRuntimeStatus
func (*Service) GetActiveRunSnapshot ¶
func (*Service) GetTerminalToolOutput ¶
func (*Service) GetThreadTodos ¶
func (*Service) GetToolDetail ¶ added in v0.6.10
func (*Service) HasActiveThread ¶
func (*Service) HasActiveThreadForEndpoint ¶
func (*Service) ImportGitHubSkills ¶
func (s *Service) ImportGitHubSkills(req SkillGitHubImportRequest) (*SkillGitHubImportResult, error)
func (*Service) ListActiveThreadRuns ¶
func (s *Service) ListActiveThreadRuns(endpointID string) []ActiveThreadRun
func (*Service) ListFollowups ¶
func (*Service) ListGitHubSkillCatalog ¶
func (s *Service) ListGitHubSkillCatalog(req SkillGitHubCatalogRequest) (*SkillGitHubCatalog, error)
func (*Service) ListModels ¶
func (s *Service) ListModels() (*ModelsResponse, error)
func (*Service) ListRecentThreadToolCalls ¶
func (s *Service) ListRecentThreadToolCalls(ctx context.Context, meta *session.Meta, threadID string, limit int) ([]threadstore.ToolCallRecord, error)
func (*Service) ListRunEvents ¶
func (*Service) ListRunEventsWithQuery ¶
func (s *Service) ListRunEventsWithQuery(ctx context.Context, meta *session.Meta, runID string, query ListRunEventsQuery) (*ListRunEventsResponse, error)
func (*Service) ListSkillSources ¶
func (s *Service) ListSkillSources() (*SkillSourcesView, error)
func (*Service) ListSkillsCatalog ¶
func (s *Service) ListSkillsCatalog() (*SkillCatalog, error)
func (*Service) ListThreadMessages ¶
func (*Service) ListThreads ¶
func (*Service) OpenUpload ¶
func (*Service) PatchSkillToggles ¶
func (s *Service) PatchSkillToggles(patches []SkillTogglePatch) (*SkillCatalog, error)
func (*Service) PrepareDesktopModelSource ¶ added in v0.6.8
func (s *Service) PrepareDesktopModelSource(session DesktopModelSourceSession) (*AIRuntimeStatus, error)
func (*Service) RegisterRPC ¶
func (*Service) RegisterRPCWithAccessGate ¶
func (*Service) ReinstallSkills ¶
func (s *Service) ReinstallSkills(paths []string, overwrite bool) (*SkillReinstallResult, error)
func (*Service) ReloadSkillsCatalog ¶
func (s *Service) ReloadSkillsCatalog() (*SkillCatalog, error)
func (*Service) RenameThread ¶
func (*Service) ReorderFollowups ¶
func (*Service) RuntimeStatus ¶ added in v0.6.4
func (s *Service) RuntimeStatus(ctx context.Context) *AIRuntimeStatus
func (*Service) SaveUpload ¶
func (*Service) SendUserTurn ¶
func (s *Service) SendUserTurn(ctx context.Context, meta *session.Meta, req SendUserTurnRequest) (SendUserTurnResponse, error)
func (*Service) ServeDesktopModelSourceRPC ¶ added in v0.6.8
func (*Service) SetCurrentModelID ¶
func (s *Service) SetCurrentModelID(modelID string, persist func(next *config.AIConfig) error) error
SetCurrentModelID updates current_model_id while keeping the provider/model registry unchanged.
Unlike UpdateConfig, this method is lightweight and allowed while runs are active because it only changes the current model for future chats.
func (*Service) SetThreadExecutionMode ¶
func (*Service) SetThreadModel ¶
func (*Service) StartRun ¶
func (s *Service) StartRun(ctx context.Context, meta *session.Meta, runID string, req RunStartRequest, w http.ResponseWriter) error
func (*Service) StartRunDetached ¶
func (*Service) StartRunDetachedWithPersisted ¶
func (*Service) StopThread ¶
func (*Service) SubmitStructuredPromptResponse ¶
func (s *Service) SubmitStructuredPromptResponse(ctx context.Context, meta *session.Meta, req SubmitStructuredPromptResponseRequest) (SubmitStructuredPromptResponseResponse, error)
func (*Service) SubscribeSummary ¶
func (*Service) SubscribeThread ¶
func (*Service) UpdateConfig ¶
UpdateConfig updates the in-memory AI config after persisting it via the provided callback.
Active runs keep their existing run-local config snapshot. The updated config applies to runs created after this method returns.
func (*Service) UpdateFilesystemScope ¶ added in v0.6.8
func (s *Service) UpdateFilesystemScope(scope *filesystemscope.Registry) error
UpdateFilesystemScope refreshes the in-memory filesystem roots for future runs.
func (*Service) UpdateFollowup ¶
func (*Service) ValidateGitHubSkillImport ¶
func (s *Service) ValidateGitHubSkillImport(req SkillGitHubImportRequest) (*SkillGitHubValidateResult, error)
type SkillActivation ¶
type SkillActivation struct {
ActivationID string `json:"activation_id"`
Name string `json:"name"`
RootDir string `json:"root_dir"`
Priority int `json:"priority"`
Content string `json:"content"`
ContentRef string `json:"content_ref"`
ModeHints []string `json:"mode_hints,omitempty"`
Dependencies []SkillMCPDependency `json:"dependencies,omitempty"`
ActivatedAt int64 `json:"activated_at_unix_ms"`
}
type SkillBrowseFileResult ¶
type SkillBrowseTreeEntry ¶
type SkillBrowseTreeResult ¶
type SkillBrowseTreeResult struct {
Root string `json:"root"`
Dir string `json:"dir"`
Entries []SkillBrowseTreeEntry `json:"entries"`
}
type SkillCatalog ¶
type SkillCatalog struct {
CatalogVersion int64 `json:"catalog_version"`
Skills []SkillCatalogEntry `json:"skills"`
Conflicts []SkillCatalogNotice `json:"conflicts,omitempty"`
Errors []SkillCatalogNotice `json:"errors,omitempty"`
}
type SkillCatalogEntry ¶
type SkillCatalogEntry struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Path string `json:"path"`
Scope string `json:"scope"`
Priority int `json:"priority,omitempty"`
ModeHints []string `json:"mode_hints,omitempty"`
AllowImplicitInvocation bool `json:"allow_implicit_invocation"`
Dependencies []SkillMCPDependency `json:"dependencies,omitempty"`
DependencyState string `json:"dependency_state,omitempty"`
Enabled bool `json:"enabled"`
Effective bool `json:"effective"`
ShadowedBy string `json:"shadowed_by,omitempty"`
}
type SkillCatalogNotice ¶
type SkillError ¶
type SkillError struct {
// contains filtered or unexported fields
}
func AsSkillError ¶
func AsSkillError(err error) (*SkillError, bool)
func (*SkillError) Code ¶
func (e *SkillError) Code() string
func (*SkillError) Error ¶
func (e *SkillError) Error() string
func (*SkillError) HTTPStatus ¶
func (e *SkillError) HTTPStatus() int
func (*SkillError) Unwrap ¶
func (e *SkillError) Unwrap() error
type SkillGitHubAuth ¶
type SkillGitHubCatalog ¶
type SkillGitHubCatalog struct {
Source SkillGitHubCatalogSource `json:"source"`
Skills []SkillGitHubCatalogItem `json:"skills"`
}
type SkillGitHubCatalogItem ¶
type SkillGitHubImportItem ¶
type SkillGitHubImportItem struct {
Name string `json:"name"`
Scope string `json:"scope"`
SkillPath string `json:"skill_path"`
SourceType SkillSourceType `json:"source_type"`
SourceID string `json:"source_id"`
InstallMode string `json:"install_mode"`
InstalledCommit string `json:"installed_commit,omitempty"`
}
type SkillGitHubImportRequest ¶
type SkillGitHubImportRequest struct {
Scope string `json:"scope"`
Repo string `json:"repo,omitempty"`
Ref string `json:"ref,omitempty"`
Paths []string `json:"paths,omitempty"`
URL string `json:"url,omitempty"`
Overwrite bool `json:"overwrite,omitempty"`
Auth SkillGitHubAuth `json:"auth,omitempty"`
}
type SkillGitHubImportResult ¶
type SkillGitHubImportResult struct {
Catalog SkillCatalog `json:"catalog"`
Imports []SkillGitHubImportItem `json:"imports"`
}
type SkillGitHubResolvedSkill ¶
type SkillGitHubResolvedSkill struct {
Name string `json:"name"`
Description string `json:"description"`
Scope string `json:"scope,omitempty"`
Repo string `json:"repo"`
Ref string `json:"ref"`
RepoPath string `json:"repo_path"`
TargetDir string `json:"target_dir"`
TargetSkillPath string `json:"target_skill_path"`
AlreadyExists bool `json:"already_exists"`
}
type SkillGitHubValidateResult ¶
type SkillGitHubValidateResult struct {
Resolved []SkillGitHubResolvedSkill `json:"resolved"`
}
type SkillMCPDependency ¶
type SkillMeta ¶
type SkillMeta struct {
Name string `json:"name"`
Description string `json:"description"`
Path string `json:"path"`
Scope string `json:"scope"`
Priority int `json:"priority,omitempty"`
ModeHints []string `json:"mode_hints,omitempty"`
AllowImplicitInvocation bool `json:"allow_implicit_invocation"`
Dependencies []SkillMCPDependency `json:"dependencies,omitempty"`
}
type SkillReinstallItem ¶
type SkillReinstallResult ¶
type SkillReinstallResult struct {
Catalog SkillCatalog `json:"catalog"`
Reinstalled []SkillReinstallItem `json:"reinstalled"`
}
type SkillSourceRecord ¶
type SkillSourceRecord struct {
SkillPath string `json:"skill_path"`
SourceType SkillSourceType `json:"source_type"`
SourceID string `json:"source_id"`
Repo string `json:"repo,omitempty"`
Ref string `json:"ref,omitempty"`
RepoPath string `json:"repo_path,omitempty"`
InstallMode string `json:"install_mode,omitempty"`
InstalledCommit string `json:"installed_commit,omitempty"`
InstalledAtUnixMs int64 `json:"installed_at_unix_ms,omitempty"`
LastCheckedAtUnixMs int64 `json:"last_checked_at_unix_ms,omitempty"`
}
type SkillSourceType ¶
type SkillSourceType string
const ( SkillSourceTypeLocalManual SkillSourceType = "local_manual" SkillSourceTypeGitHub SkillSourceType = "github_import" SkillSourceTypeSystem SkillSourceType = "system_bundle" )
type SkillSourcesView ¶
type SkillSourcesView struct {
Items []SkillSourceRecord `json:"items"`
}
type SkillTogglePatch ¶
type StepResult ¶
type StepResult struct {
Round int
TurnResult TurnResult
ToolResults []ToolResult
FinishReason string
}
type StopThreadRequest ¶
type StopThreadRequest struct {
ThreadID string `json:"thread_id"`
}
type StopThreadResponse ¶
type StopThreadResponse struct {
OK bool `json:"ok"`
RecoveredFollowups []FollowupItemView `json:"recovered_followups,omitempty"`
}
type StreamEvent ¶
type StreamEvent struct {
Type StreamEventType `json:"type"`
Text string `json:"text,omitempty"`
ToolCall *PartialToolCall `json:"tool_call,omitempty"`
Usage *PartialUsage `json:"usage,omitempty"`
FinishHint string `json:"finish_hint,omitempty"`
}
type StreamEventType ¶
type StreamEventType string
StreamEventType is the normalized stream event kind produced by provider adapters.
const ( StreamEventTextDelta StreamEventType = "text_delta" StreamEventToolCallStart StreamEventType = "tool_call_start" StreamEventToolCallDelta StreamEventType = "tool_call_delta" StreamEventToolCallEnd StreamEventType = "tool_call_end" StreamEventThinkingDelta StreamEventType = "thinking_delta" StreamEventUsage StreamEventType = "usage" StreamEventFinishReason StreamEventType = "finish_reason" )
type SubmitStructuredPromptResponseRequest ¶
type SubmitStructuredPromptResponseRequest struct {
ThreadID string `json:"thread_id"`
Model string `json:"model,omitempty"`
Response RequestUserInputResponse `json:"response"`
Input RunInput `json:"input"`
Options RunOptions `json:"options"`
ExpectedRunID string `json:"expected_run_id,omitempty"`
SourceFollowupID string `json:"source_followup_id,omitempty"`
}
type TerminalToolOutput ¶
type TerminalToolOutput struct {
RunID string `json:"run_id"`
ToolID string `json:"tool_id"`
ToolName string `json:"tool_name"`
Status string `json:"status"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
DurationMS int64 `json:"duration_ms"`
TimedOut bool `json:"timed_out"`
Truncated bool `json:"truncated"`
Cwd string `json:"cwd,omitempty"`
TimeoutMS int64 `json:"timeout_ms,omitempty"`
RequestedTimeoutMS int64 `json:"requested_timeout_ms,omitempty"`
TimeoutSource string `json:"timeout_source,omitempty"`
RawResult string `json:"raw_result,omitempty"`
}
type ThreadTodosView ¶
type ThreadView ¶
type ThreadView struct {
ThreadID string `json:"thread_id"`
Title string `json:"title"`
ModelID string `json:"model_id"`
ModelLocked bool `json:"model_locked"`
ExecutionMode string `json:"execution_mode"`
WorkingDir string `json:"working_dir"`
QueuedTurnCount int `json:"queued_turn_count"`
RunStatus string `json:"run_status"`
RunUpdatedAtUnixMs int64 `json:"run_updated_at_unix_ms"`
RunError string `json:"run_error,omitempty"`
WaitingPrompt *RequestUserInputPrompt `json:"waiting_prompt,omitempty"`
LastContextRunID string `json:"last_context_run_id,omitempty"`
CreatedAtUnixMs int64 `json:"created_at_unix_ms"`
UpdatedAtUnixMs int64 `json:"updated_at_unix_ms"`
LastMessageAtUnixMs int64 `json:"last_message_at_unix_ms"`
LastMessagePreview string `json:"last_message_preview"`
}
type TodoSummary ¶
type ToolApprovalRequest ¶
type ToolCallBlock ¶
type ToolCallBlock struct {
Type string `json:"type"` // tool-call
ToolName string `json:"toolName"`
ToolID string `json:"toolId"`
Args map[string]any `json:"args"`
RequiresApproval bool `json:"requiresApproval,omitempty"`
ApprovalState string `json:"approvalState,omitempty"` // required|approved|rejected
Status ToolCallStatus `json:"status"`
Result any `json:"result,omitempty"`
Error string `json:"error,omitempty"`
ErrorDetails *aitools.ToolError `json:"errorDetails,omitempty"`
Children []any `json:"children,omitempty"`
StartedAt *time.Time `json:"-"`
}
type ToolCallStatus ¶
type ToolCallStatus string
const ( ToolCallStatusPending ToolCallStatus = "pending" ToolCallStatusRunning ToolCallStatus = "running" ToolCallStatusRecovering ToolCallStatus = "recovering" ToolCallStatusSuccess ToolCallStatus = "success" ToolCallStatusError ToolCallStatus = "error" )
type ToolDef ¶
type ToolDef struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema json.RawMessage `json:"input_schema,omitempty"`
ParallelSafe bool `json:"parallel_safe,omitempty"`
Mutating bool `json:"mutating,omitempty"`
RequiresApproval bool `json:"requires_approval,omitempty"`
Presentation aitools.ToolPresentationSpec `json:"presentation,omitempty"`
Source string `json:"source,omitempty"`
Namespace string `json:"namespace,omitempty"`
Priority int `json:"priority,omitempty"`
}
type ToolDetail ¶ added in v0.6.10
type ToolDetail struct {
RunID string `json:"run_id"`
ToolID string `json:"tool_id"`
ToolName string `json:"tool_name"`
Status string `json:"status"`
Args map[string]any `json:"args,omitempty"`
Result any `json:"result,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
Retryable bool `json:"retryable,omitempty"`
RecoveryAction string `json:"recovery_action,omitempty"`
StartedAtUnixMs int64 `json:"started_at_unix_ms,omitempty"`
EndedAtUnixMs int64 `json:"ended_at_unix_ms,omitempty"`
LatencyMS int64 `json:"latency_ms,omitempty"`
RawArgs string `json:"raw_args,omitempty"`
RawResult string `json:"raw_result,omitempty"`
}
type ToolHandler ¶
type ToolInterceptor ¶
type ToolRegistry ¶
type ToolResult ¶
type ToolResult struct {
ToolID string `json:"tool_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
Status string `json:"status"`
Summary string `json:"summary,omitempty"`
Details string `json:"details,omitempty"`
Data any `json:"data,omitempty"`
Error *aitools.ToolError `json:"error,omitempty"`
Truncated bool `json:"truncated,omitempty"`
ContentRef string `json:"content_ref,omitempty"`
}
type TurnBudgets ¶
type TurnHook ¶
type TurnHook interface {
BeforeTurn(ctx context.Context, run *RunContext) error
AfterTurn(ctx context.Context, run *RunContext, step StepResult) error
}
type TurnProviderState ¶
type TurnRequest ¶
type TurnRequest struct {
Model string `json:"model"`
Messages []Message `json:"messages"`
Tools []ToolDef `json:"tools"`
Budgets TurnBudgets `json:"budgets"`
ModeFlags ModeFlags `json:"mode_flags"`
ProviderControls ProviderControls `json:"provider_controls,omitempty"`
WebSearchMode string `json:"web_search_mode,omitempty"`
}
type TurnResult ¶
type TurnResult struct {
FinishReason string `json:"finish_reason"`
Text string `json:"text,omitempty"`
Reasoning string `json:"reasoning,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
Sources []SourceRef `json:"sources,omitempty"`
Usage TurnUsage `json:"usage,omitempty"`
ProviderState *TurnProviderState `json:"provider_state,omitempty"`
RawProviderDiag map[string]any `json:"raw_provider_diag,omitempty"`
StreamEvents []StreamEvent `json:"stream_events,omitempty"`
ToolResults []ToolResult `json:"tool_results,omitempty"`
}
type TurnSnapshot ¶
type TurnSnapshot struct {
ToolCalls []ToolCall
ToolResults []ToolResult
FinishReason string
Assistant string
}
Source Files
¶
- active_run_snapshot.go
- activity_timeline.go
- agent_contracts.go
- ask_user_signal.go
- builtin_tool_handlers.go
- checkpoints.go
- completion_contract.go
- core_tool_scheduler.go
- desktop_model_source.go
- execution_contract.go
- fallback_policy.go
- intent_router.go
- interaction_contract.go
- interaction_contract_resolution.go
- limited_buffers.go
- native_runtime.go
- permissions.go
- persist_types.go
- persist_user.go
- prompt_builder.go
- prompt_local_time.go
- prompt_profiles.go
- prompt_workspace_context.go
- protocol_profile.go
- queued_turns.go
- realtime_sink.go
- reply_completion.go
- rpc.go
- run.go
- run_capability_contract.go
- run_extensions.go
- run_todos.go
- runtime_closeout.go
- send_user_turn.go
- service.go
- signal_policy.go
- skill_manager.go
- skill_manager_remote.go
- stop_thread.go
- stream.go
- structured_classifier.go
- structured_tools.go
- subagent_manager.go
- task_complexity.go
- terminal_exec_proc_unix.go
- text_utils.go
- thread_actor.go
- thread_title.go
- threads.go
- todos.go
- todos_closeout_waiting_user.go
- tool_filters.go
- tool_output.go
- types.go
- unified_diff_apply.go
- upload_lifecycle.go
- uploads.go
- waiting_prompt.go
- waiting_prompt_recovery.go
- workspace_checkpoint.go