agent

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconWaiting   = "⏸️" // 待機中(依存解決待ち)
	IconRunning   = "⏳"  // 実行中
	IconCompleted = "✅"  // 完了
	IconFailed    = "❌"  // 失敗
	IconRetrying  = "🔄"  // リトライ中
	IconEscalated = "⬆️" // エスカレーション
)

UI表示用のステータスアイコン

View Source
const GeneratedHelpText = `` /* 2679-byte string literal not displayed */

GeneratedHelpText は自動生成されたヘルプテキスト

View Source
const MaxFileCacheSize = 1024 * 1024

MaxFileCacheSize はキャッシュする最大ファイルサイズ (1MB)

Variables

This section is empty.

Functions

func CalculateRequestCost added in v0.46.0

func CalculateRequestCost(provider string, input, output int) float64

CalculateRequestCost は単一リクエストのコストを計算(キャッシュなし想定)

func CalculateRequestCostWithCache added in v0.46.0

func CalculateRequestCostWithCache(provider string, usage api.Usage) float64

CalculateRequestCostWithCache は単一リクエストのコストを計算(キャッシュ対応)

func CheckBeforeImplementation added in v0.31.0

func CheckBeforeImplementation(input string) string

CheckBeforeImplementation は実装前に既存定義をチェック 戻り値: 警告メッセージ(問題なければ空文字列)

func ExtractDefinitionNames added in v0.31.0

func ExtractDefinitionNames(input string) []string

ExtractDefinitionNames は入力テキストから関数/型/変数名を抽出

func FormatFileSize added in v0.29.0

func FormatFileSize(bytes int64) string

FormatFileSize はファイルサイズを人間が読める形式で返す

func FormatNumber added in v0.46.0

func FormatNumber(n int) string

FormatNumber は数値にカンマを追加してフォーマット

func FormatTokens added in v0.46.0

func FormatTokens(n int) string

FormatTokens は K/M 形式でトークン数をフォーマット

func GetFileLanguage added in v0.31.0

func GetFileLanguage(filePath string) string

GetFileLanguage はファイル拡張子から言語を判定

func GetSessionFileSize added in v0.29.0

func GetSessionFileSize(sessionPath string) (int64, error)

GetSessionFileSize はセッションファイルのサイズを返す(bytes)

func IsAPIKeyAvailable added in v0.29.0

func IsAPIKeyAvailable(provider string) bool

IsAPIKeyAvailable は指定されたプロバイダーのAPIキーが利用可能かチェック

func IsCodeModificationRequest added in v0.31.0

func IsCodeModificationRequest(input string) bool

IsCodeModificationRequest はコード変更を伴うリクエストかどうかを判定

func IsDangerousTool added in v0.46.0

func IsDangerousTool(toolName string) bool

IsDangerousTool は危険なツールかを判定

func RunInteractive

func RunInteractive(model string, provider api.Provider, autoApprove bool)

RunInteractive はインタラクティブモードでエージェントを実行

func RunInteractiveWithResume

func RunInteractiveWithResume(model string, provider api.Provider, autoApprove bool)

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

func ShouldConfirmTool(toolName string, level string) bool

ShouldConfirmTool はツール実行前に確認が必要か判定 注: 計画承認は常にあり、これは実行中の確認のみ

func ValidateConfirmLevel added in v0.46.0

func ValidateConfirmLevel(level string) bool

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 NewAgent

func NewAgent(model string, provider api.Provider) *Agent

NewAgent は新しいAgentを作成

func (*Agent) AddGitHubHint added in v0.31.0

func (a *Agent) AddGitHubHint(input string) string

AddGitHubHint はGitHub関連リクエストにシステムヒントを追加する

func (*Agent) Cleanup

func (a *Agent) Cleanup()

Cleanup はエージェントのリソースをクリーンアップ

func (*Agent) CompressHistory added in v0.29.0

func (a *Agent) CompressHistory(keepRecent int) error

CompressHistory は会話履歴を圧縮する

func (*Agent) CompressWithCompactAPI added in v0.31.0

func (a *Agent) CompressWithCompactAPI(ctx context.Context) error

CompressWithCompactAPI は OpenAI Compact API で会話履歴を圧縮

func (*Agent) EstimateHistoryTokens added in v0.31.0

func (a *Agent) EstimateHistoryTokens() int

EstimateHistoryTokens は会話履歴のトークン数を推定

func (*Agent) EstimateSystemPromptTokens added in v0.31.0

func (a *Agent) EstimateSystemPromptTokens() int

EstimateSystemPromptTokens はシステムプロンプトのトークン数を推定

func (*Agent) EstimateTokens added in v0.31.0

func (a *Agent) EstimateTokens() int

EstimateTokens は現在のトークン使用量を推定

func (*Agent) GetCompactedItems added in v0.31.0

func (a *Agent) GetCompactedItems() []api.InputItem

GetCompactedItems は API 用の圧縮済みアイテムを返す

func (*Agent) GetLSPClient added in v0.31.0

func (a *Agent) GetLSPClient() *lsp.Client

GetLSPClient はLSPクライアントを返す(コマンド用)

func (*Agent) GetTokenUsagePercentage added in v0.31.0

func (a *Agent) GetTokenUsagePercentage() float64

GetTokenUsagePercentage はトークン使用率を計算

func (*Agent) HasGitHubMCP added in v0.31.0

func (a *Agent) HasGitHubMCP() bool

HasGitHubMCP はGitHub MCPサーバーが接続されているか確認する

func (*Agent) IsCompactedMode added in v0.31.0

func (a *Agent) IsCompactedMode() bool

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

func (a *Agent) RestoreCompactedState(session *history.Session)

RestoreCompactedState はセッションから圧縮状態を復元

func (*Agent) RunPlanMode added in v0.29.0

func (a *Agent) RunPlanMode(ctx context.Context, userRequest string) error

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

func (a *Agent) SwitchProvider(providerName string) error

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 AgentStatus struct {
	State      AgentState
	ReasonEN   string
	ReasonJP   string
	NextEN     string
	NextJP     string
	LastUpdate int64 // unix nanos (debug/ordering; optional)
}

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

type EscalationNeeded struct {
	StepID   int
	ToolName string
	Reason   string
}

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

type InvestigationQuery struct {
	Query    string // 調査クエリ
	WorkerID int    // 割り当てられた Worker ID
}

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) Clear added in v0.46.0

func (sc *SharedContext) Clear()

Clear はコンテキストをクリア

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

type StepFailure struct {
	StepID int
	Reason string
}

StepFailure はステップ失敗のエラー

func (*StepFailure) Error added in v0.46.0

func (e *StepFailure) Error() string

type StepTimeout added in v0.46.0

type StepTimeout struct {
	StepID  int
	Timeout int // 秒
}

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 を作成

func (*Supervisor) Run added in v0.46.0

func (s *Supervisor) Run(ctx context.Context, userRequest string) error

Run は Plan Mode を実行(並列モード)

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 NewToolCache added in v0.42.0

func NewToolCache() *ToolCache

NewToolCache は新しい ToolCache を作成

func (*ToolCache) Clear added in v0.42.0

func (c *ToolCache) Clear()

Clear は全キャッシュをクリア

func (*ToolCache) ClearSearchCache added in v0.42.0

func (c *ToolCache) ClearSearchCache()

ClearSearchCache は検索キャッシュをクリア

func (*ToolCache) GetDir added in v0.42.0

func (c *ToolCache) GetDir(path string) (string, bool)

GetDir はディレクトリ一覧のキャッシュを取得

func (*ToolCache) GetFile added in v0.42.0

func (c *ToolCache) GetFile(path string) (string, bool)

GetFile はファイル内容のキャッシュを取得

func (*ToolCache) GetSearch added in v0.42.0

func (c *ToolCache) GetSearch(pattern, path string) (string, bool)

GetSearch は検索結果のキャッシュを取得

func (*ToolCache) InvalidateDir added in v0.42.0

func (c *ToolCache) InvalidateDir(path string)

InvalidateDir は指定ディレクトリのキャッシュを無効化

func (*ToolCache) InvalidateFile added in v0.42.0

func (c *ToolCache) InvalidateFile(path string)

InvalidateFile は指定ファイルのキャッシュを無効化

func (*ToolCache) SetDir added in v0.42.0

func (c *ToolCache) SetDir(path, result string)

SetDir はディレクトリ一覧をキャッシュに保存

func (*ToolCache) SetFile added in v0.42.0

func (c *ToolCache) SetFile(path, content string)

SetFile はファイル内容をキャッシュに保存

func (*ToolCache) SetSearch added in v0.42.0

func (c *ToolCache) SetSearch(pattern, path, result string)

SetSearch は検索結果をキャッシュに保存

func (*ToolCache) Stats added in v0.42.0

func (c *ToolCache) Stats() (files, dirs, searches int)

Stats はキャッシュの統計情報を返す

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

func (w *Worker) GetCurrentStep() *plan.PlanStep

GetCurrentStep は現在実行中のステップを取得

func (*Worker) GetStatus added in v0.46.0

func (w *Worker) GetStatus() WorkerStatus

GetStatus は Worker の状態を取得

func (*Worker) Run added in v0.46.0

func (w *Worker) Run(ctx context.Context)

Run は Worker のメインループ(goroutine で実行)

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

type WorkerError struct {
	WorkerID int
	StepID   int
	Error    error
}

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) Stop added in v0.46.0

func (wp *WorkerPool) Stop()

Stop は 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"  // 失敗
)

Directories

Path Synopsis
Package plan は計画の永続化を提供する
Package plan は計画の永続化を提供する

Jump to

Keyboard shortcuts

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