Documentation
¶
Index ¶
- Constants
- func CalculateRequestCost(provider string, input, output int) float64
- func CalculateRequestCostWithCache(provider string, usage api.Usage) float64
- func CheckBeforeImplementation(input string) string
- func ExtractDefinitionNames(input string) []string
- func FormatFileSize(bytes int64) string
- func FormatNumber(n int) string
- func FormatTokens(n int) string
- func GetFileLanguage(filePath string) string
- func GetSessionFileSize(sessionPath string) (int64, error)
- func IsAPIKeyAvailable(provider string) bool
- func IsCodeModificationRequest(input string) bool
- func IsDangerousTool(toolName string) bool
- func RunInteractive(model string, provider api.Provider, autoApprove bool)
- func RunInteractiveWithResume(model string, provider api.Provider, autoApprove bool)
- func RunOnceWithImage(query string, model string, provider api.Provider, imagePath string, ...)
- func ShouldConfirmTool(toolName string, level string) bool
- func ValidateConfirmLevel(level string) bool
- type Agent
- func (a *Agent) AddGitHubHint(input string) string
- func (a *Agent) Cleanup()
- func (a *Agent) CompressHistory(keepRecent int) error
- func (a *Agent) CompressWithCompactAPI(ctx context.Context) error
- func (a *Agent) EstimateHistoryTokens() int
- func (a *Agent) EstimateSystemPromptTokens() int
- func (a *Agent) EstimateTokens() int
- func (a *Agent) GetCompactedItems() []api.InputItem
- func (a *Agent) GetLSPClient() *lsp.Client
- func (a *Agent) GetTokenUsagePercentage() float64
- func (a *Agent) HasGitHubMCP() bool
- func (a *Agent) IsCompactedMode() bool
- func (a *Agent) PrintStatusFooter()
- func (a *Agent) RestoreCompactedState(session *history.Session)
- func (a *Agent) RunPlanMode(ctx context.Context, userRequest string) error
- func (a *Agent) SetStatus(state AgentState, reasonEN, reasonJP, nextEN, nextJP string)
- func (a *Agent) SwitchProvider(providerName string) error
- type AgentState
- type AgentStatus
- type CodeCheckResult
- type CommandType
- type ConfirmLevel
- type ErrorInfo
- type EscalationNeeded
- type HeadlessResult
- func NewErrorResult(provider, model string, errType, errMsg string, durationMs int64) *HeadlessResult
- func NewSuccessResult(provider, model, response string, toolCalls []ToolCallResult, durationMs int64) *HeadlessResult
- func RunHeadless(query string, model string, provider api.Provider) *HeadlessResult
- type InvestigationQuery
- type InvestigationResult
- type PricingInfo
- type ResponseIDCapable
- type SessionStats
- func (s *SessionStats) AddTokens(input, output int)
- func (s *SessionStats) AddToolExecution(toolName string)
- func (s *SessionStats) AddUsage(usage api.Usage)
- func (s *SessionStats) ElapsedTime() time.Duration
- func (s *SessionStats) EstimatedCost() float64
- func (s *SessionStats) FormatElapsedTime() string
- func (s *SessionStats) TotalMessages() int
- func (s *SessionStats) TotalTokens() int
- func (s *SessionStats) TotalToolExecutions() int
- type SharedContext
- func (sc *SharedContext) AddError(err WorkerError)
- func (sc *SharedContext) AddFileChange(stepID int, change tools.FileChange)
- func (sc *SharedContext) AddInvestigationResult(query, result string)
- func (sc *SharedContext) AddStepResult(stepID int, result string)
- func (sc *SharedContext) Clear()
- func (sc *SharedContext) GetAllFileChanges() []tools.FileChange
- func (sc *SharedContext) GetAllInvestigationResults() map[string]string
- func (sc *SharedContext) GetCompletedStepIDs() []int
- func (sc *SharedContext) GetContextForStep(step *plan.PlanStep) string
- func (sc *SharedContext) GetErrors() []WorkerError
- func (sc *SharedContext) GetFileChanges(stepID int) []tools.FileChange
- func (sc *SharedContext) GetInvestigationResult(query string) (string, bool)
- func (sc *SharedContext) GetStepResult(stepID int) (string, bool)
- func (sc *SharedContext) IsStepCompleted(stepID int) bool
- func (sc *SharedContext) MarkStepCompleted(stepID int)
- type StepFailure
- type StepTimeout
- type Supervisor
- type TokenUsage
- type ToolCache
- func (c *ToolCache) Clear()
- func (c *ToolCache) ClearSearchCache()
- func (c *ToolCache) GetDir(path string) (string, bool)
- func (c *ToolCache) GetFile(path string) (string, bool)
- func (c *ToolCache) GetSearch(pattern, path string) (string, bool)
- func (c *ToolCache) InvalidateDir(path string)
- func (c *ToolCache) InvalidateFile(path string)
- func (c *ToolCache) SetDir(path, result string)
- func (c *ToolCache) SetFile(path, content string)
- func (c *ToolCache) SetSearch(pattern, path, result string)
- func (c *ToolCache) Stats() (files, dirs, searches int)
- type ToolCallResult
- type Worker
- type WorkerCommand
- type WorkerError
- type WorkerPool
- func (wp *WorkerPool) CollectResults(expected int) []WorkerResult
- func (wp *WorkerPool) ExecuteInvestigationsWithUI(ctx context.Context, queries []string) []WorkerResult
- func (wp *WorkerPool) ExecuteStepsWithUI(ctx context.Context, steps []*plan.PlanStep, confirmLevel string) []WorkerResult
- func (wp *WorkerPool) GetActiveWorkerCount() int
- func (wp *WorkerPool) GetWorkerStatuses() []WorkerStatus
- func (wp *WorkerPool) Start(ctx context.Context)
- func (wp *WorkerPool) Stop()
- func (wp *WorkerPool) SubmitInvestigation(query string)
- func (wp *WorkerPool) SubmitStep(step *plan.PlanStep, confirmLevel string)
- type WorkerResult
- type WorkerStatus
Constants ¶
const ( IconWaiting = "⏸️" // 待機中(依存解決待ち) IconRunning = "⏳" // 実行中 IconCompleted = "✅" // 完了 IconFailed = "❌" // 失敗 IconRetrying = "🔄" // リトライ中 IconEscalated = "⬆️" // エスカレーション )
UI表示用のステータスアイコン
const GeneratedHelpText = `` /* 2679-byte string literal not displayed */
GeneratedHelpText は自動生成されたヘルプテキスト
const MaxFileCacheSize = 1024 * 1024
MaxFileCacheSize はキャッシュする最大ファイルサイズ (1MB)
Variables ¶
This section is empty.
Functions ¶
func CalculateRequestCost ¶ added in v0.46.0
CalculateRequestCost は単一リクエストのコストを計算(キャッシュなし想定)
func CalculateRequestCostWithCache ¶ added in v0.46.0
CalculateRequestCostWithCache は単一リクエストのコストを計算(キャッシュ対応)
func CheckBeforeImplementation ¶ added in v0.31.0
CheckBeforeImplementation は実装前に既存定義をチェック 戻り値: 警告メッセージ(問題なければ空文字列)
func ExtractDefinitionNames ¶ added in v0.31.0
ExtractDefinitionNames は入力テキストから関数/型/変数名を抽出
func FormatFileSize ¶ added in v0.29.0
FormatFileSize はファイルサイズを人間が読める形式で返す
func FormatNumber ¶ added in v0.46.0
FormatNumber は数値にカンマを追加してフォーマット
func FormatTokens ¶ added in v0.46.0
FormatTokens は K/M 形式でトークン数をフォーマット
func GetFileLanguage ¶ added in v0.31.0
GetFileLanguage はファイル拡張子から言語を判定
func GetSessionFileSize ¶ added in v0.29.0
GetSessionFileSize はセッションファイルのサイズを返す(bytes)
func IsAPIKeyAvailable ¶ added in v0.29.0
IsAPIKeyAvailable は指定されたプロバイダーのAPIキーが利用可能かチェック
func IsCodeModificationRequest ¶ added in v0.31.0
IsCodeModificationRequest はコード変更を伴うリクエストかどうかを判定
func IsDangerousTool ¶ added in v0.46.0
IsDangerousTool は危険なツールかを判定
func RunInteractive ¶
RunInteractive はインタラクティブモードでエージェントを実行
func RunInteractiveWithResume ¶
RunInteractiveWithResume は前回のセッションを再開してインタラクティブモードを実行
func RunOnceWithImage ¶ added in v0.31.0
func RunOnceWithImage(query string, model string, provider api.Provider, imagePath string, autoApprove bool)
RunOnceWithImage は画像付きの単一クエリを実行(CLIフラグ -i/--image 用)
func ShouldConfirmTool ¶ added in v0.46.0
ShouldConfirmTool はツール実行前に確認が必要か判定 注: 計画承認は常にあり、これは実行中の確認のみ
func ValidateConfirmLevel ¶ added in v0.46.0
ValidateConfirmLevel は確認レベルが有効かを判定
Types ¶
type Agent ¶
type Agent struct {
Model string // 初期モデル(後方互換性のため保持)
CurrentModel string // 現在のモデル(再起動なしで切り替え可能)
CurrentProvider api.Provider
ProviderName string
History []api.Message
SystemPrompt string
AutoApprove bool // --auto-approve フラグ
Stats *SessionStats // セッション統計情報
PlanModeEnabled bool // Plan Mode ON/OFF(デフォルト: false)
ToolCache *ToolCache // ツール結果キャッシュ(read_file, list_dir)
// contains filtered or unexported fields
}
Agent はCLIエージェント
func (*Agent) AddGitHubHint ¶ added in v0.31.0
AddGitHubHint はGitHub関連リクエストにシステムヒントを追加する
func (*Agent) CompressHistory ¶ added in v0.29.0
CompressHistory は会話履歴を圧縮する
func (*Agent) CompressWithCompactAPI ¶ added in v0.31.0
CompressWithCompactAPI は OpenAI Compact API で会話履歴を圧縮
func (*Agent) EstimateHistoryTokens ¶ added in v0.31.0
EstimateHistoryTokens は会話履歴のトークン数を推定
func (*Agent) EstimateSystemPromptTokens ¶ added in v0.31.0
EstimateSystemPromptTokens はシステムプロンプトのトークン数を推定
func (*Agent) EstimateTokens ¶ added in v0.31.0
EstimateTokens は現在のトークン使用量を推定
func (*Agent) GetCompactedItems ¶ added in v0.31.0
GetCompactedItems は API 用の圧縮済みアイテムを返す
func (*Agent) GetLSPClient ¶ added in v0.31.0
GetLSPClient はLSPクライアントを返す(コマンド用)
func (*Agent) GetTokenUsagePercentage ¶ added in v0.31.0
GetTokenUsagePercentage はトークン使用率を計算
func (*Agent) HasGitHubMCP ¶ added in v0.31.0
HasGitHubMCP はGitHub MCPサーバーが接続されているか確認する
func (*Agent) IsCompactedMode ¶ added in v0.31.0
IsCompactedMode は圧縮モードかどうかを返す
func (*Agent) PrintStatusFooter ¶ added in v0.31.0
func (a *Agent) PrintStatusFooter()
PrintStatusFooter prints a status bar with divider lines. Format: ● model │ Mode │ tokens │ ~$cost This should be called right before showing the input prompt.
func (*Agent) RestoreCompactedState ¶ added in v0.31.0
RestoreCompactedState はセッションから圧縮状態を復元
func (*Agent) RunPlanMode ¶ added in v0.29.0
RunPlanMode は Claude Code 風の Plan Mode を実行 - 調査ツール(SafetyHigh)は即座に実行 - 実装ツール(SafetyMedium/Low)の前に計画を生成・承認
func (*Agent) SetStatus ¶ added in v0.31.0
func (a *Agent) SetStatus(state AgentState, reasonEN, reasonJP, nextEN, nextJP string)
SetStatus updates the current agent status.
func (*Agent) SwitchProvider ¶ added in v0.29.0
SwitchProvider はプロバイダーを切り替える
type AgentState ¶ added in v0.31.0
type AgentState string
AgentState represents the current interaction state. This is used to make it obvious whether XELYON is waiting for input, waiting for approval, running, or aborted.
const ( StateRunning AgentState = "running" StateWaitingInput AgentState = "waiting_input" StateWaitingApproval AgentState = "waiting_approval" StateAborted AgentState = "aborted" StateCompleted AgentState = "completed" )
type AgentStatus ¶ added in v0.31.0
type CodeCheckResult ¶ added in v0.31.0
type CodeCheckResult struct {
Exists bool // 定義が既に存在するか
Type string // "function", "type", "const", "var", "method"
Name string // 定義名
FilePaths []string // 定義が存在するファイルパス
LineNumbers []int // 各ファイルでの行番号
Context string // 周辺コード(最初の一致のみ)
}
CodeCheckResult はコードスキャン結果
func ScanForDefinition ¶ added in v0.31.0
func ScanForDefinition(name string, searchPath string) (*CodeCheckResult, error)
ScanForDefinition は指定された名前の定義をコードベースからスキャン
type CommandType ¶ added in v0.46.0
type CommandType int
CommandType はコマンドの種類
const ( CmdExecuteStep CommandType = iota // ステップ実行 CmdInvestigate // 調査実行 CmdStop // 停止 )
type ConfirmLevel ¶ added in v0.46.0
type ConfirmLevel string
ConfirmLevel は確認レベル
const ( ConfirmAll ConfirmLevel = "all" // 全ツール確認 ConfirmDangerous ConfirmLevel = "dangerous" // 危険ツールのみ ConfirmNone ConfirmLevel = "none" // 確認なし )
type ErrorInfo ¶ added in v0.29.0
type ErrorInfo struct {
Type string `json:"type"` // エラータイプ(api_error, tool_error, etc.)
Message string `json:"message"` // エラーメッセージ
Code int `json:"code,omitempty"` // エラーコード(HTTPステータスなど)
}
ErrorInfo はエラー情報
type EscalationNeeded ¶ added in v0.46.0
EscalationNeeded はエスカレーションが必要な場合のエラー
func (*EscalationNeeded) Error ¶ added in v0.46.0
func (e *EscalationNeeded) Error() string
type HeadlessResult ¶ added in v0.29.0
type HeadlessResult struct {
Status string `json:"status"` // "success" or "error"
Provider string `json:"provider"` // LLMプロバイダー名
Model string `json:"model"` // モデル名
Response string `json:"response"` // AIの最終回答
ToolCalls []ToolCallResult `json:"tool_calls,omitempty"` // 実行されたツール呼び出し
Tokens *TokenUsage `json:"tokens,omitempty"` // トークン使用量
DurationMs int64 `json:"duration_ms"` // 実行時間(ミリ秒)
Timestamp string `json:"timestamp"` // タイムスタンプ(RFC3339)
Error *ErrorInfo `json:"error,omitempty"` // エラー情報
}
HeadlessResult はHeadlessモードの実行結果
func NewErrorResult ¶ added in v0.29.0
func NewErrorResult(provider, model string, errType, errMsg string, durationMs int64) *HeadlessResult
NewErrorResult はエラー結果を生成
func NewSuccessResult ¶ added in v0.29.0
func NewSuccessResult(provider, model, response string, toolCalls []ToolCallResult, durationMs int64) *HeadlessResult
NewSuccessResult は成功結果を生成
func RunHeadless ¶ added in v0.29.0
func RunHeadless(query string, model string, provider api.Provider) *HeadlessResult
RunHeadless はHeadlessモードでクエリを実行(マルチターンツール実行対応)
func (*HeadlessResult) ToJSON ¶ added in v0.29.0
func (r *HeadlessResult) ToJSON() (string, error)
ToJSON は HeadlessResult を JSON 文字列に変換
type InvestigationQuery ¶ added in v0.46.0
InvestigationQuery は調査クエリ
type InvestigationResult ¶ added in v0.46.0
type InvestigationResult struct {
Query string // 調査クエリ
Result string // 結果
Files []string // 発見したファイル
Duration time.Duration // 実行時間
WorkerID int // 実行した Worker ID
}
InvestigationResult は調査結果
type PricingInfo ¶ added in v0.46.0
type PricingInfo struct {
InputCostPerM float64 // 通常入力トークン
OutputCostPerM float64 // 出力トークン
CachedInputCostPerM float64 // キャッシュヒット入力(割引後)
CacheCreationCostPerM float64 // キャッシュ作成(Claude: 1.25x)
}
PricingInfo はプロバイダー別の料金情報($/1M tokens)
func GetPricingInfo ¶ added in v0.46.0
func GetPricingInfo(provider string) PricingInfo
GetPricingInfo はプロバイダー別の料金情報を返す
type ResponseIDCapable ¶ added in v0.43.0
type ResponseIDCapable interface {
HasCachedResponseID() bool
}
ResponseIDCapable は Responses API のキャッシュ機能を持つプロバイダー
type SessionStats ¶ added in v0.29.0
type SessionStats struct {
StartTime time.Time
UserMessages int
AssistantMessages int
ToolExecutions map[string]int // ツール名 -> 実行回数
InputTokens int
OutputTokens int
CachedInputTokens int // キャッシュヒットトークン数(累計)
CacheCreationTokens int // キャッシュ作成トークン数(累計、Claude用)
Provider string // "deepseek", "openai", "claude", "gemini", "groq", "ollama"
LastUsage *api.Usage // 直近のリクエストの使用量
}
SessionStats はセッション統計情報
func NewSessionStats ¶ added in v0.29.0
func NewSessionStats(provider string) *SessionStats
NewSessionStats は新しいSessionStatsを作成
func (*SessionStats) AddTokens ¶ added in v0.29.0
func (s *SessionStats) AddTokens(input, output int)
AddTokens はトークン使用量を追加
func (*SessionStats) AddToolExecution ¶ added in v0.29.0
func (s *SessionStats) AddToolExecution(toolName string)
AddToolExecution はツール実行をカウント
func (*SessionStats) AddUsage ¶ added in v0.46.0
func (s *SessionStats) AddUsage(usage api.Usage)
AddUsage は api.Usage からトークン使用量を追加
func (*SessionStats) ElapsedTime ¶ added in v0.29.0
func (s *SessionStats) ElapsedTime() time.Duration
ElapsedTime はセッション開始からの経過時間を返す
func (*SessionStats) EstimatedCost ¶ added in v0.29.0
func (s *SessionStats) EstimatedCost() float64
EstimatedCost は推定コストを計算(USD) キャッシュヒットとキャッシュ作成の割引/割増を反映
func (*SessionStats) FormatElapsedTime ¶ added in v0.29.0
func (s *SessionStats) FormatElapsedTime() string
FormatElapsedTime は経過時間を人間が読める形式で返す
func (*SessionStats) TotalMessages ¶ added in v0.29.0
func (s *SessionStats) TotalMessages() int
TotalMessages は合計メッセージ数を返す
func (*SessionStats) TotalTokens ¶ added in v0.29.0
func (s *SessionStats) TotalTokens() int
TotalTokens は合計トークン数を返す
func (*SessionStats) TotalToolExecutions ¶ added in v0.29.0
func (s *SessionStats) TotalToolExecutions() int
TotalToolExecutions は合計ツール実行回数を返す
type SharedContext ¶ added in v0.46.0
type SharedContext struct {
// contains filtered or unexported fields
}
SharedContext は Worker 間で共有するコンテキスト すべてのメソッドはスレッドセーフ
func NewSharedContext ¶ added in v0.46.0
func NewSharedContext() *SharedContext
NewSharedContext は新しい SharedContext を作成
func (*SharedContext) AddError ¶ added in v0.46.0
func (sc *SharedContext) AddError(err WorkerError)
AddError はエラーを追加
func (*SharedContext) AddFileChange ¶ added in v0.46.0
func (sc *SharedContext) AddFileChange(stepID int, change tools.FileChange)
AddFileChange はファイル変更を記録
func (*SharedContext) AddInvestigationResult ¶ added in v0.46.0
func (sc *SharedContext) AddInvestigationResult(query, result string)
AddInvestigationResult は調査結果を追加
func (*SharedContext) AddStepResult ¶ added in v0.46.0
func (sc *SharedContext) AddStepResult(stepID int, result string)
AddStepResult はステップ結果を追加
func (*SharedContext) GetAllFileChanges ¶ added in v0.46.0
func (sc *SharedContext) GetAllFileChanges() []tools.FileChange
GetAllFileChanges は全てのファイル変更を取得
func (*SharedContext) GetAllInvestigationResults ¶ added in v0.46.0
func (sc *SharedContext) GetAllInvestigationResults() map[string]string
GetAllInvestigationResults は全ての調査結果を取得
func (*SharedContext) GetCompletedStepIDs ¶ added in v0.46.0
func (sc *SharedContext) GetCompletedStepIDs() []int
GetCompletedStepIDs は完了したステップ ID を取得
func (*SharedContext) GetContextForStep ¶ added in v0.46.0
func (sc *SharedContext) GetContextForStep(step *plan.PlanStep) string
GetContextForStep はステップ実行に必要なコンテキストを取得 依存ステップの結果を含める
func (*SharedContext) GetErrors ¶ added in v0.46.0
func (sc *SharedContext) GetErrors() []WorkerError
GetErrors は全てのエラーを取得
func (*SharedContext) GetFileChanges ¶ added in v0.46.0
func (sc *SharedContext) GetFileChanges(stepID int) []tools.FileChange
GetFileChanges はステップのファイル変更を取得
func (*SharedContext) GetInvestigationResult ¶ added in v0.46.0
func (sc *SharedContext) GetInvestigationResult(query string) (string, bool)
GetInvestigationResult は調査結果を取得
func (*SharedContext) GetStepResult ¶ added in v0.46.0
func (sc *SharedContext) GetStepResult(stepID int) (string, bool)
GetStepResult はステップ結果を取得
func (*SharedContext) IsStepCompleted ¶ added in v0.46.0
func (sc *SharedContext) IsStepCompleted(stepID int) bool
IsStepCompleted はステップが完了しているかチェック
func (*SharedContext) MarkStepCompleted ¶ added in v0.46.0
func (sc *SharedContext) MarkStepCompleted(stepID int)
MarkStepCompleted はステップを完了としてマーク
type StepFailure ¶ added in v0.46.0
StepFailure はステップ失敗のエラー
func (*StepFailure) Error ¶ added in v0.46.0
func (e *StepFailure) Error() string
type StepTimeout ¶ added in v0.46.0
StepTimeout はステップタイムアウトのエラー
func (*StepTimeout) Error ¶ added in v0.46.0
func (e *StepTimeout) Error() string
type Supervisor ¶ added in v0.46.0
type Supervisor struct {
// contains filtered or unexported fields
}
Supervisor は Plan Mode の実行を監督
func NewSupervisor ¶ added in v0.46.0
func NewSupervisor(agent *Agent, cfg *config.PlanModeConfig) (*Supervisor, error)
NewSupervisor は新しい Supervisor を作成
type TokenUsage ¶ added in v0.29.0
type TokenUsage struct {
Input int `json:"input"` // 入力トークン数
Output int `json:"output"` // 出力トークン数
Total int `json:"total"` // 合計トークン数
}
TokenUsage はトークン使用量
type ToolCache ¶ added in v0.42.0
type ToolCache struct {
// contains filtered or unexported fields
}
ToolCache はツール結果のキャッシュ read_file, list_dir, search_code, search_file の結果をキャッシュしてトークン消費を削減
func (*ToolCache) ClearSearchCache ¶ added in v0.42.0
func (c *ToolCache) ClearSearchCache()
ClearSearchCache は検索キャッシュをクリア
func (*ToolCache) InvalidateDir ¶ added in v0.42.0
InvalidateDir は指定ディレクトリのキャッシュを無効化
func (*ToolCache) InvalidateFile ¶ added in v0.42.0
InvalidateFile は指定ファイルのキャッシュを無効化
type ToolCallResult ¶ added in v0.29.0
type ToolCallResult struct {
Tool string `json:"tool"` // ツール名
Args map[string]string `json:"args"` // 引数
Output string `json:"output"` // 出力
Success bool `json:"success"` // 成功フラグ
}
ToolCallResult は個別のツール呼び出し結果
type Worker ¶ added in v0.46.0
type Worker struct {
// contains filtered or unexported fields
}
Worker は並列実行用のワーカー UI 操作なし、Supervisor への報告のみ
func NewWorker ¶ added in v0.46.0
func NewWorker( id int, provider api.Provider, model string, sharedCtx *SharedContext, agent *Agent, stepTimeout int, commands chan WorkerCommand, results chan WorkerResult, ) *Worker
NewWorker は新しい Worker を作成
func (*Worker) GetCurrentStep ¶ added in v0.46.0
GetCurrentStep は現在実行中のステップを取得
func (*Worker) GetStatus ¶ added in v0.46.0
func (w *Worker) GetStatus() WorkerStatus
GetStatus は Worker の状態を取得
type WorkerCommand ¶ added in v0.46.0
type WorkerCommand struct {
Type CommandType // コマンドタイプ
StepID int // ステップ ID
Step *plan.PlanStep // 実行するステップ
Query string // 調査クエリ(調査フェーズ用)
ConfirmLevel string // 確認レベル
}
WorkerCommand は Supervisor → Worker へのコマンド
type WorkerError ¶ added in v0.46.0
WorkerError は Worker エラー
type WorkerPool ¶ added in v0.46.0
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool は Worker を管理するプール
func NewWorkerPool ¶ added in v0.46.0
func NewWorkerPool( maxWorkers int, provider api.Provider, model string, sharedCtx *SharedContext, agent *Agent, stepTimeout int, ) *WorkerPool
NewWorkerPool は新しい WorkerPool を作成
func (*WorkerPool) CollectResults ¶ added in v0.46.0
func (wp *WorkerPool) CollectResults(expected int) []WorkerResult
CollectResults は指定数の結果を収集
func (*WorkerPool) ExecuteInvestigationsWithUI ¶ added in v0.46.0
func (wp *WorkerPool) ExecuteInvestigationsWithUI(ctx context.Context, queries []string) []WorkerResult
ExecuteInvestigationsWithUI は調査を UI 付きで並列実行
func (*WorkerPool) ExecuteStepsWithUI ¶ added in v0.46.0
func (wp *WorkerPool) ExecuteStepsWithUI(ctx context.Context, steps []*plan.PlanStep, confirmLevel string) []WorkerResult
ExecuteStepsWithUI はステップを UI 付きで並列実行
func (*WorkerPool) GetActiveWorkerCount ¶ added in v0.46.0
func (wp *WorkerPool) GetActiveWorkerCount() int
GetActiveWorkerCount はアクティブな Worker 数を取得
func (*WorkerPool) GetWorkerStatuses ¶ added in v0.46.0
func (wp *WorkerPool) GetWorkerStatuses() []WorkerStatus
GetWorkerStatuses は全 Worker のステータスを取得
func (*WorkerPool) Start ¶ added in v0.46.0
func (wp *WorkerPool) Start(ctx context.Context)
Start は Worker を起動
func (*WorkerPool) SubmitInvestigation ¶ added in v0.46.0
func (wp *WorkerPool) SubmitInvestigation(query string)
SubmitInvestigation は調査をサブミット
func (*WorkerPool) SubmitStep ¶ added in v0.46.0
func (wp *WorkerPool) SubmitStep(step *plan.PlanStep, confirmLevel string)
SubmitStep はステップ実行をサブミット
type WorkerResult ¶ added in v0.46.0
type WorkerResult struct {
WorkerID int // Worker ID
StepID int // ステップ ID
Success bool // 成功フラグ
NeedsEscalation bool // heavy_model へのエスカレーションが必要
EscalationReason string // エスカレーション理由
Output string // 出力
Changes []tools.FileChange // ファイル変更
Error error // エラー
ToolsExecuted []string // 実行したツール名
TokensUsed int // 使用トークン数
Duration time.Duration // 実行時間
Query string // 調査クエリ(調査フェーズ用)
}
WorkerResult は Worker → Supervisor への結果報告
type WorkerStatus ¶ added in v0.46.0
type WorkerStatus string
WorkerStatus はWorkerの状態
const ( WorkerIdle WorkerStatus = "idle" // 待機中 WorkerRunning WorkerStatus = "running" // 実行中 WorkerDone WorkerStatus = "done" // 完了 WorkerFailed WorkerStatus = "failed" // 失敗 )
Source Files
¶
- agent.go
- agent_chat.go
- agent_commands.go
- agent_commands_config.go
- agent_commands_sessions.go
- agent_commands_undo.go
- agent_health.go
- agent_helpers.go
- agent_mcp.go
- agent_provider.go
- agent_repl.go
- agent_response_parser.go
- agent_run.go
- agent_tool_executor.go
- auto_compress.go
- code_scanner.go
- command_aliases.go
- commands_lsp.go
- commands_misc.go
- compress.go
- compress_compact.go
- confirm_level.go
- headless.go
- help_generated.go
- init.go
- paste.go
- plan_executor.go
- plan_failure.go
- plan_investigation.go
- plan_mode.go
- repomap_cache.go
- shared_context.go
- stats.go
- status.go
- supervisor.go
- token_limits.go
- tool_cache.go
- worker.go
- worker_pool.go
- worker_types.go