Documentation
¶
Index ¶
- func CheckBeforeImplementation(input string) string
- func CheckGoModExists() bool
- func ExtractDefinitionNames(input string) []string
- func ExtractPlanJSON(response string) string
- func FormatFileSize(bytes int64) string
- func FormatPlan(plan *Plan) string
- func GetFileLanguage(filePath string) string
- func GetSessionFileSize(sessionPath string) (int64, error)
- func IsAPIKeyAvailable(provider string) bool
- func IsCodeModificationRequest(input string) bool
- func RunGoFmt(filePath string) (string, error)
- func RunGoTest(filePath string) (string, bool, error)
- func RunInteractive(model string, provider api.Provider, autoApprove bool)
- func RunInteractiveWithResume(model string, provider api.Provider, autoApprove bool)
- func RunOnce(query string, model string)
- func RunOnceWithImage(query string, model string, provider api.Provider, imagePath string, ...)
- type Agent
- func (a *Agent) AddGitHubHint(input string) string
- func (a *Agent) Cleanup()
- func (a *Agent) CompressHistory(keepRecent int) error
- func (a *Agent) HasGitHubMCP() bool
- func (a *Agent) PrintStatusFooter()
- func (a *Agent) ProposeAndApplyLearning(ctx context.Context, extractor LearningExtractor, xelyonPath string) (bool, []string, error)
- 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 ErrorInfo
- type FailureAction
- 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 InitConfig
- type LLMExtractor
- type LearningExtractor
- type Plan
- func (p *Plan) CanExecute(stepID int) bool
- func (p *Plan) GetNextStep() int
- func (p *Plan) GetParallelSteps() []int
- func (p *Plan) GetStep(id int) *PlanStep
- func (p *Plan) GetToolsExecuted(stepID int) int
- func (p *Plan) HasFailed() bool
- func (p *Plan) IncrementToolsExecuted(stepID int)
- func (p *Plan) IsCompleted() bool
- func (p *Plan) UpdateStatus(stepID int, status, result string)
- type PlanStep
- type SessionStats
- func (s *SessionStats) AddTokens(input, output int)
- func (s *SessionStats) AddToolExecution(toolName string)
- 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 SyncDiff
- type SyncState
- type TokenUsage
- type ToolCallResult
- type VerifyResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckBeforeImplementation ¶ added in v0.31.0
CheckBeforeImplementation は実装前に既存定義をチェック 戻り値: 警告メッセージ(問題なければ空文字列)
func ExtractDefinitionNames ¶ added in v0.31.0
ExtractDefinitionNames は入力テキストから関数/型/変数名を抽出
func ExtractPlanJSON ¶ added in v0.29.0
ExtractPlanJSON はレスポンスからPlan JSONを抽出 見つからない場合は空文字列を返す NOTE: ツール呼び出し JSON ({"tool": ...}) は plan ではないので除外する
func FormatFileSize ¶ added in v0.29.0
FormatFileSize はファイルサイズを人間が読める形式で返す
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 RunInteractive ¶
RunInteractive はインタラクティブモードでエージェントを実行
func RunInteractiveWithResume ¶
RunInteractiveWithResume は前回のセッションを再開してインタラクティブモードを実行
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)
// 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) HasGitHubMCP ¶ added in v0.31.0
HasGitHubMCP はGitHub MCPサーバーが接続されているか確認する
func (*Agent) PrintStatusFooter ¶ added in v0.31.0
func (a *Agent) PrintStatusFooter()
PrintStatusFooter prints a short, bilingual status line. This should be called right before showing the input prompt.
func (*Agent) ProposeAndApplyLearning ¶ added in v0.31.0
func (a *Agent) ProposeAndApplyLearning(ctx context.Context, extractor LearningExtractor, xelyonPath string) (bool, []string, error)
ProposeAndApplyLearning extracts rules and asks the user whether to append them to XELYON.md. It returns (applied, rules, err). If no rules are found, applied=false and err=nil.
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 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 FailureAction ¶ added in v0.31.0
type FailureAction string
FailureAction は失敗時のユーザー選択
const ( FailureActionRetry FailureAction = "retry" FailureActionComment FailureAction = "comment" FailureActionSkip FailureAction = "skip" FailureActionAbort FailureAction = "abort" )
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 InitConfig ¶ added in v0.31.0
type InitConfig struct {
ProjectName string
Overview string
TechStack []string
CodingRules string
RepoMapData *repomap.RepoMap
LanguageStats map[string]int // 言語 → ファイル数
}
InitConfig は/initコマンドで収集する情報
type LLMExtractor ¶ added in v0.31.0
LLMExtractor uses the current provider to extract rules. It requests JSON output for robust parsing.
type LearningExtractor ¶ added in v0.31.0
type LearningExtractor interface {
Extract(ctx context.Context, history []api.Message, model string) ([]string, error)
}
LearningExtractor extracts coding rules/instructions from conversation history. It is interface-based for testability (stub/mocking).
type Plan ¶ added in v0.29.0
Plan は実行計画を表す
func ParsePlan ¶ added in v0.29.0
ParsePlan はJSON文字列からPlanを解析
互換対応: - V2形式: {"plan": {...}} - 旧形式: {"summary": "...", "steps": [...]}
func (*Plan) CanExecute ¶ added in v0.29.0
CanExecute はステップが実行可能かチェック
func (*Plan) GetNextStep ¶ added in v0.29.0
GetNextStep は次に実行すべきステップIDを取得
func (*Plan) GetParallelSteps ¶ added in v0.29.0
GetParallelSteps は並列実行可能なステップを取得 depends_on が同じステップは並列実行可能と判定
func (*Plan) GetToolsExecuted ¶ added in v0.31.0
GetToolsExecuted は実行ツール数を取得
func (*Plan) IncrementToolsExecuted ¶ added in v0.31.0
IncrementToolsExecuted は実行ツール数をインクリメント
func (*Plan) IsCompleted ¶ added in v0.29.0
IsCompleted はすべてのステップが完了したかチェック
func (*Plan) UpdateStatus ¶ added in v0.29.0
UpdateStatus はステップのステータスを更新
type PlanStep ¶ added in v0.29.0
type PlanStep struct {
ID int `json:"id"`
Description string `json:"description"`
Tools []string `json:"tools"` // 使用予定ツール
DependsOn []int `json:"depends_on"` // 依存するステップID
Status string `json:"status"` // "pending", "running", "completed", "failed"
Result string `json:"result"` // 実行結果
ToolsExecuted int `json:"-"` // 実際に実行されたツール数
// 将来の依存関係解析用(現時点では未使用)
TargetFiles []string `json:"-"` // 操作対象ファイル(推論結果)
ReadFiles []string `json:"-"` // 読み取りファイル
WriteFiles []string `json:"-"` // 書き込みファイル
}
PlanStep は計画の1ステップを表す
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
Provider string // "deepseek", "openai", "claude", "gemini", "groq", "ollama"
}
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) 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 SyncDiff ¶ added in v0.31.0
type SyncDiff struct {
AddedTech []string
RemovedTech []string
AddedFiles []string
RemovedFiles []string
NewSymbols int
}
SyncDiff は変更の差分を表す
func (*SyncDiff) HasChanges ¶ added in v0.31.0
HasChanges は変更があるかどうかを返す
type SyncState ¶ added in v0.31.0
type SyncState struct {
ProjectName string
Overview string
TechStack []string
CodingRules string
CodeMapFiles []string // コードマップに含まれるファイル一覧
}
SyncState は現在のXELYON.mdの状態を表す
type TokenUsage ¶ added in v0.29.0
type TokenUsage struct {
Input int `json:"input"` // 入力トークン数
Output int `json:"output"` // 出力トークン数
Total int `json:"total"` // 合計トークン数
}
TokenUsage はトークン使用量
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 VerifyResult ¶
type VerifyResult struct {
NeedsVerify bool // 検証が必要か
FileType string // "go", "js", "py" など
ChangedFiles []string // 変更されたファイル
FmtResult string // go fmt の結果
TestResult string // go test の結果
TestPassed bool // テスト成功したか
}
VerifyResult は検証結果
func ShouldVerify ¶
func ShouldVerify(filePath string) *VerifyResult
ShouldVerify は変更されたファイルが検証対象かを判定
Source Files
¶
- agent.go
- agent_chat.go
- agent_commands.go
- agent_commands_config.go
- agent_commands_sessions.go
- agent_commands_undo.go
- agent_helpers.go
- agent_mcp.go
- agent_provider.go
- agent_repl.go
- agent_response_parser.go
- agent_run.go
- agent_tool_executor.go
- agent_verify.go
- code_scanner.go
- command_aliases.go
- compress.go
- confirm.go
- headless.go
- init.go
- learning.go
- paste.go
- plan.go
- plan_executor.go
- plan_failure.go
- plan_investigation.go
- plan_mode.go
- plan_parallel.go
- repomap_cache.go
- stats.go
- status.go
- sync.go
- token_guard.go