workflow

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAgentSwitchMessage added in v1.3.0

func BuildAgentSwitchMessage(planPath, planContent string) m31types.Message

BuildAgentSwitchMessage creates a synthetic user message that instructs the builder agent to execute the plan.

func CaptureDiffSummary added in v1.3.0

func CaptureDiffSummary(g *git.Git, beforeHash, afterHash string) (*m31types.DiffSummary, error)

CaptureDiffSummary computes a diff summary between two git commit hashes. Uses git diff --numstat for structured additions/deletions data.

func ClassifyIntent added in v1.2.0

func ClassifyIntent(ctx context.Context, p provider.LLMProvider, modelID string, input string, prompts *PromptRegistry, timeoutSecs int) (*m31types.IntentResult, error)

ClassifyIntent uses an LLM to classify the user's input intent. Falls back to the keyword-based ClassifyPrompt on failure or timeout. timeoutSecs controls the per-attempt deadline; 0 uses the default (25s).

func ClassifyPrompt

func ClassifyPrompt(goal string, workDir string) m31types.ComplexityLevel

ClassifyPrompt estimates the complexity of a user's goal using heuristics. Factors considered:

  • Keyword/phrase matching
  • Goal length and sentence count
  • Number of existing project files (proxy for project size)

func ExtractWebsiteTemplate added in v1.3.0

func ExtractWebsiteTemplate(destDir string) error

ExtractWebsiteTemplate extracts the bundled Next.js website template to the specified directory. It creates the directory structure and writes all template files. Returns an error if extraction fails.

func FallbackClassifyIntent added in v1.2.0

func FallbackClassifyIntent(goal string, workDir string) *m31types.IntentResult

FallbackClassifyIntent converts the keyword-based ClassifyPrompt result into an IntentResult for consistent downstream handling.

func FormatDiffSummary added in v1.3.0

func FormatDiffSummary(ds *m31types.DiffSummary) string

FormatDiffSummary renders a human-readable diff summary.

func ParsePlan

func ParsePlan(markdown string) (*m31types.Plan, error)

ParsePlan extracts a structured Plan from rich markdown content. The markdown is expected to follow the format defined in plan-format.md. Sections that cannot be parsed are left empty rather than causing an error.

func SelectTemplate added in v1.3.0

func SelectTemplate(modelID string) string

SelectTemplate returns the model-specific prompt template for the given model ID. Falls back to the default template if no model-specific match is found.

func ShouldStartWorkflow added in v1.2.0

func ShouldStartWorkflow(result *m31types.IntentResult) bool

ShouldStartWorkflow returns true when the classified intent warrants a structured workflow (feature, bugfix, refactor, chore) with sufficient confidence (≥ 0.7).

func WorkflowModeForComplexity

func WorkflowModeForComplexity(c m31types.ComplexityLevel) m31types.WorkflowMode

WorkflowModeForComplexity maps complexity to a workflow mode. ModeAuto delegates to this mapping.

Types

type AgentSwitchMsg added in v1.3.0

type AgentSwitchMsg struct {
	FromAgent   string
	ToAgent     string
	PlanPath    string
	PlanContent string
}

AgentSwitchMsg is emitted when the engine suggests switching from planner to builder agent after plan completion.

type BehavioralResult added in v1.5.0

type BehavioralResult struct {
	Command  string `json:"command"`
	Passed   bool   `json:"passed"`
	Output   string `json:"output"`
	Error    string `json:"error,omitempty"`
	Duration int64  `json:"duration_ms"`
}

BehavioralResult holds the outcome of running a verification command.

type CheckpointData added in v1.5.0

type CheckpointData struct {
	Phase       m31types.WorkflowPhase     `json:"phase"`
	Goal        string                     `json:"goal"`
	PlanVersion int                        `json:"plan_version"`
	Decisions   []decision.DecisionReceipt `json:"decisions,omitempty"`
	Timestamp   time.Time                  `json:"timestamp"`
}

CheckpointData holds data that can be saved/restored across checkpoints.

type CompactionCompleteMsg added in v1.3.0

type CompactionCompleteMsg struct {
	TokensBefore    int
	TokensAfter     int
	MessagesRemoved int
}

CompactionCompleteMsg is emitted when automatic session compaction completes.

type ContextChange added in v1.5.0

type ContextChange struct {
	Source string // e.g., "knowledge", "conventions", "patterns"
	Type   string // e.g., "refresh", "update", "new"
}

ContextChange represents a change in a context source.

type Convention added in v1.5.0

type Convention struct {
	Category   string  `json:"category"` // naming, imports, errors, etc.
	Pattern    string  `json:"pattern"`  // e.g., "error handling uses sentinel errors"
	Example    string  `json:"example"`  // e.g., "m31errors.ErrNotFound"
	Confidence float64 `json:"confidence"`
}

Convention represents a detected coding convention.

type DemonstrationReadyMsg

type DemonstrationReadyMsg struct {
	Content string
}

DemonstrationReadyMsg carries the generated demonstration content to the TUI.

type DiffStats

type DiffStats struct {
	FilesAdded    int
	FilesModified int
	FilesDeleted  int
	Insertions    int
	Deletions     int
}

DiffStats holds file change statistics from git diff.

type DiscussCompleteness added in v1.2.0

type DiscussCompleteness struct {
	Score        int // 0-100
	Answered     int
	Skipped      int
	Total        int
	MissingAreas []string
}

DiscussCompleteness holds the result of an answer completeness check.

type DiscussCompletenessMsg added in v1.2.0

type DiscussCompletenessMsg struct {
	Score        int // 0-100
	MissingAreas []string
}

DiscussCompletenessMsg is emitted after the answer completeness check.

type DiscussIssue added in v1.2.0

type DiscussIssue struct {
	Severity      string // "blocker" or "warning"
	Category      string // yes_no, vague, duplicate, redundant
	Message       string
	QuestionIndex int
}

DiscussIssue represents a quality issue found in generated questions.

type DiscussQualityMsg added in v1.2.0

type DiscussQualityMsg struct {
	Passed   bool
	Warnings int
	Retried  bool
}

DiscussQualityMsg is emitted after the question quality checker runs.

type DiscussState

type DiscussState struct {
	Questions []string
	Answers   map[int]string
}

DiscussState holds the questions and collected answers for the discuss phase.

type DynamicContextRegistry added in v1.5.0

type DynamicContextRegistry struct {
	// contains filtered or unexported fields
}

DynamicContextRegistry maintains project knowledge and provides dynamic context for LLM calls. Integrates with code intelligence and knowledge subsystem.

func NewDynamicContextRegistry added in v1.5.0

func NewDynamicContextRegistry(workDir string, ci *codeintel.Indexer) *DynamicContextRegistry

NewDynamicContextRegistry creates a new registry.

func (*DynamicContextRegistry) GetKnowledge added in v1.5.0

func (r *DynamicContextRegistry) GetKnowledge() *Knowledge

GetKnowledge returns the project knowledge instance.

func (*DynamicContextRegistry) LoadAll added in v1.5.0

func (r *DynamicContextRegistry) LoadAll(ctx context.Context) map[string]string

LoadAll returns the current snapshot of all context sources.

func (*DynamicContextRegistry) Reconcile added in v1.5.0

func (r *DynamicContextRegistry) Reconcile(ctx context.Context, snapshot map[string]string) []ContextChange

Reconcile checks if context sources have changed and returns updates.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine orchestrates the seven active workflow phases (Initialize, Discuss, Plan, Execute, Verify, Runtime, Ship).

func NewEngine

func NewEngine(sessionID, workDir, backupDir, planningDir string, p provider.LLMProvider, modelID string,
	dispatcher *tools.Dispatcher, tokenEst *tokens.Estimator, sessionMgr *session.Manager, cfg *config.Config) (*Engine, error)

NewEngine creates a workflow engine.

func NewEngineFromOptions

func NewEngineFromOptions(opts EngineOptions) (*Engine, error)

NewEngineFromOptions creates a workflow engine from an EngineOptions struct.

func NewEngineWithCollector added in v1.5.0

func NewEngineWithCollector(opts EngineOptions) (*Engine, error)

NewEngineWithCollector creates a workflow engine with metrics collection.

func (*Engine) BehavioralVerification added in v1.5.0

func (e *Engine) BehavioralVerification(task m31types.Task) ([]BehavioralResult, error)

BehavioralVerification runs CMDs from acceptance criteria and validates outcomes. Commands are checked against a blocklist (destructive/dangerous) and allowlist (safe). Commands outside both lists are rejected (would require permission modal in interactive mode).

func (*Engine) BuildSummary

func (e *Engine) BuildSummary() ShipSummary

BuildSummary creates a ShipSummary from the current session state.

func (*Engine) CheckDiscussCompleteness added in v1.2.0

func (e *Engine) CheckDiscussCompleteness() DiscussCompleteness

CheckDiscussCompleteness evaluates how well the collected answers cover the goal. Called by the TUI after all answers are collected, before proceeding to Plan.

func (*Engine) Close added in v1.6.1

func (e *Engine) Close()

Close flushes and shuts down the decision logger. Safe to call multiple times.

func (*Engine) DiscussState

func (e *Engine) DiscussState() DiscussState

DiscussState returns a copy of the current discuss state. The TUI uses this to read the parsed questions after the discuss phase returns. The returned struct is a value copy so mutations by the TUI do not affect the engine's internal state.

func (*Engine) ExtractWebsiteTemplateTo added in v1.3.0

func (e *Engine) ExtractWebsiteTemplateTo() (string, error)

ExtractWebsiteTemplateTo extracts the bundled website template to a temporary directory and stores the path for later injection into the plan/execute context. Returns the path to the extracted template, or an error if extraction fails.

func (*Engine) FinalizeDiscuss

func (e *Engine) FinalizeDiscuss() error

func (*Engine) FlushDecisions added in v1.5.0

func (e *Engine) FlushDecisions() []decision.DecisionReceipt

FlushDecisions synchronously returns all logged decisions and resets the buffer.

func (*Engine) GenerateFollowUpsIfNeeded added in v1.2.0

func (e *Engine) GenerateFollowUpsIfNeeded(ctx context.Context) ([]string, error)

GenerateFollowUpsIfNeeded creates follow-up questions when answers are incomplete. Called by the TUI after CheckDiscussCompleteness if score is low.

func (*Engine) GetCheckpointData added in v1.5.0

func (e *Engine) GetCheckpointData() *CheckpointData

GetCheckpointData returns the current checkpoint data, or nil if none.

func (*Engine) HealTask

func (e *Engine) HealTask(ctx context.Context, taskID int) (bool, error)

HealTask triggers self-healing for a specific task by ID. Returns true if healing was attempted, false if the task cannot be healed.

func (*Engine) IntentResult added in v1.2.0

func (e *Engine) IntentResult() *m31types.IntentResult

IntentResult returns the stored intent classification result, or nil if unset.

func (*Engine) IsPlanComplete added in v1.3.0

func (e *Engine) IsPlanComplete() bool

IsPlanComplete checks if the engine's plan phase produced a valid plan.

func (*Engine) LastHealReport added in v1.5.0

func (e *Engine) LastHealReport() *m31types.HealReport

LastHealReport returns the most recent self-heal report, or nil if none.

func (*Engine) LoadCheckpointData added in v1.5.0

func (e *Engine) LoadCheckpointData(data *CheckpointData)

LoadCheckpointData restores workflow state from a checkpoint. If data is nil, it attempts to load from disk via the session manager.

func (*Engine) LogDecision added in v1.5.0

func (e *Engine) LogDecision(r decision.DecisionReceipt)

LogDecision records a decision in the session log.

func (*Engine) PlanContent

func (e *Engine) PlanContent() string

PlanContent returns the current plan markdown content.

func (*Engine) PlanVersion

func (e *Engine) PlanVersion() int

PlanVersion returns the current plan version number. Version 1 is the initial plan; each refinement increments it.

func (*Engine) PreparePlanFile added in v1.3.0

func (e *Engine) PreparePlanFile(planContent string) (string, error)

PreparePlanFile creates a plan file at .m31a/plans/<session-id>.md and writes the plan content. Returns the file path.

func (*Engine) RunPhase

func (e *Engine) RunPhase(ctx context.Context, phase m31types.WorkflowPhase, goal string) (*PhaseResult, error)

RunPhase executes the given workflow phase and returns the result.

func (*Engine) SaveCheckpointData added in v1.5.0

func (e *Engine) SaveCheckpointData(goal string)

SaveCheckpointData saves current workflow state for checkpoint resume. It persists to both in-memory state and disk via the session manager.

func (*Engine) ScopeIncludes added in v1.3.0

func (e *Engine) ScopeIncludes(term string) bool

ScopeIncludes returns true if the intent result's scope contains the given term.

func (*Engine) SessionID

func (e *Engine) SessionID() string

SessionID returns the current session ID.

func (*Engine) SetCollector added in v1.5.0

func (e *Engine) SetCollector(c *metrics.Collector)

SetCollector attaches a metrics collector to the engine for recording tool calls, LLM interactions, phase durations, and heal/bisect events.

func (*Engine) SetGit

func (e *Engine) SetGit(g *git.Git)

SetGit sets the git instance on the engine. Required before running any phase that uses git operations.

func (*Engine) SetIntentResult added in v1.2.0

func (e *Engine) SetIntentResult(ir *m31types.IntentResult)

SetIntentResult stores the LLM-classified intent result for downstream enrichment.

func (*Engine) SetLedger added in v1.1.0

func (e *Engine) SetLedger(l *ledger.Ledger)

SetLedger sets the shared ledger instance on the engine so the ship phase writes session records to the application-configured path instead of creating a new ledger at a hardcoded location.

func (*Engine) SetModel

func (e *Engine) SetModel(modelID string, p provider.LLMProvider)

SetModel updates the active model ID and provider for the engine.

func (*Engine) SetMsgEmitter

func (e *Engine) SetMsgEmitter(em MsgEmitter)

SetMsgEmitter sets the callback for emitting messages back to the TUI.

func (*Engine) SetPhaseModel

func (e *Engine) SetPhaseModel(phase m31types.WorkflowPhase, modelID string)

SetPhaseModel assigns a model ID to a specific workflow phase. This takes the highest priority over AgentsConfig and cfg.Model.Default. Called by the TUI after the user selects Planning/Coding models in the picker.

func (*Engine) SetRefinementFeedback

func (e *Engine) SetRefinementFeedback(feedback string)

SetRefinementFeedback stores user feedback for the next plan regeneration. The plan phase reads this field to inject feedback into the LLM context. Duplicate feedback is ignored — only new feedback bumps the plan version.

func (*Engine) SetSessionID

func (e *Engine) SetSessionID(id string)

SetSessionID updates the engine's session ID.

func (*Engine) SetWorkflowMode

func (e *Engine) SetWorkflowMode(mode m31types.WorkflowMode)

SetWorkflowMode sets the mode that controls phase-skipping behaviour.

func (*Engine) SkipDiscuss

func (e *Engine) SkipDiscuss() error

SkipDiscuss fills default (empty) answers and saves.

func (*Engine) SnapshotDecisions added in v1.5.0

func (e *Engine) SnapshotDecisions() []decision.DecisionReceipt

SnapshotDecisions returns a copy of buffered decisions without flushing.

func (*Engine) SubmitDiscussAnswer

func (e *Engine) SubmitDiscussAnswer(index int, answer string) error

SubmitDiscussAnswer records an answer for a discuss question.

func (*Engine) Transition

func (e *Engine) Transition(ctx context.Context, from, to m31types.WorkflowPhase) error

Transition saves a checkpoint and writes STATE.md for the new phase. Validates the transition is allowed by the phase ordering guard.

func (*Engine) WorkflowMode

func (e *Engine) WorkflowMode() m31types.WorkflowMode

WorkflowMode returns the current workflow mode.

type EngineOptions

type EngineOptions struct {
	SessionID   string
	WorkDir     string
	BackupDir   string
	PlanningDir string
	Provider    provider.LLMProvider
	ModelID     string
	Dispatcher  *tools.Dispatcher
	TokenEst    *tokens.Estimator
	SessionMgr  *session.Manager
	Config      *config.Config
	Collector   *metrics.Collector
}

EngineOptions holds all parameters for creating a new Engine.

type ExecuteLoopDetectMsg added in v1.2.0

type ExecuteLoopDetectMsg struct {
	TaskID   int
	ToolName string
	Count    int
}

ExecuteLoopDetectMsg is emitted when a tool call loop is detected.

type ExecutePreflightMsg added in v1.2.0

type ExecutePreflightMsg struct {
	Passed bool
	Issues []string
}

ExecutePreflightMsg is emitted after pre-execution validation.

type ExecutePreflightResult added in v1.2.0

type ExecutePreflightResult struct {
	Passed bool
	Issues []string
}

ExecutePreflightResult holds the outcome of pre-execution validation.

type ExecuteQualityGateMsg added in v1.2.0

type ExecuteQualityGateMsg struct {
	TaskID  int
	Passed  bool
	Checked int
	Failed  int
}

ExecuteQualityGateMsg is emitted after per-task acceptance criteria check.

type Fact added in v1.5.0

type Fact struct {
	Category  string    `json:"category"`  // success, failure, preference
	Statement string    `json:"statement"` // e.g., "go test -race catches data races"
	SessionID string    `json:"session_id"`
	Timestamp time.Time `json:"timestamp"`
}

Fact represents a learned fact from previous sessions.

type FileKnowledge added in v1.5.0

type FileKnowledge struct {
	LastModified time.Time `json:"last_modified"`
	Complexity   string    `json:"complexity"` // low, medium, high
	IsTest       bool      `json:"is_test"`
	IsHot        bool      `json:"is_hot"` // frequently modified
	Language     string    `json:"language"`
}

FileKnowledge holds per-file intelligence.

type InitAnalysisMsg added in v1.2.0

type InitAnalysisMsg struct {
	ProjectType     string
	Framework       string
	Language        string
	DependencyCount int
	TestFileRatio   float64
	FileCount       int
	HealthScore     int // 0-100
}

InitAnalysisMsg is emitted when deep project analysis completes.

type InitPreflightMsg added in v1.2.0

type InitPreflightMsg struct {
	Passed         bool
	RuntimeVersion string
	DiskSpaceOK    bool
	GitRemoteOK    bool
	Issues         []string
}

InitPreflightMsg is emitted when environment pre-flight checks complete.

type IntermediateProgressMsg

type IntermediateProgressMsg struct {
	Phase   string
	Message string
}

IntermediateProgressMsg is emitted during long operations to show progress.

type Knowledge added in v1.5.0

type Knowledge struct {

	// Conventions detected from codebase (naming, imports, error handling)
	Conventions []Convention `json:"conventions"`

	// Patterns observed in the codebase (architectural patterns, common shapes)
	Patterns []Pattern `json:"patterns"`

	// Learned facts from previous sessions (what worked, what failed)
	Facts []Fact `json:"facts"`

	// File-specific knowledge (hot files, complex files, test patterns)
	FileKnowledge map[string]FileKnowledge `json:"file_knowledge"`

	// Last analysis timestamp
	LastAnalyzed time.Time `json:"last_analyzed"`
	// contains filtered or unexported fields
}

Knowledge holds project-specific learnings accumulated across sessions. Stored as methods on WorkflowState (not separate package) until data model proven.

func NewKnowledge added in v1.5.0

func NewKnowledge() *Knowledge

NewKnowledge creates a new Knowledge instance.

func (*Knowledge) AddConvention added in v1.5.0

func (k *Knowledge) AddConvention(c Convention)

AddConvention adds a convention if not already present. Caps at 50 conventions to prevent unbounded growth.

func (*Knowledge) AddFact added in v1.5.0

func (k *Knowledge) AddFact(f Fact)

AddFact adds a learned fact if not already present (dedup by Statement).

func (*Knowledge) AddPattern added in v1.5.0

func (k *Knowledge) AddPattern(p Pattern)

AddPattern adds a pattern if not already present. Caps at 50 patterns to prevent unbounded growth.

func (*Knowledge) DetectConventions added in v1.5.0

func (k *Knowledge) DetectConventions(workDir string, files []*codeintel.FileInfo)

DetectConventions analyzes codebase files to detect conventions.

func (*Knowledge) FormatContext added in v1.5.0

func (k *Knowledge) FormatContext(maxLen int) string

FormatContext returns a formatted string of knowledge for injection into LLM context.

func (*Knowledge) GetConventions added in v1.5.0

func (k *Knowledge) GetConventions() []Convention

GetConventions returns a copy of all conventions.

func (*Knowledge) GetFacts added in v1.5.0

func (k *Knowledge) GetFacts() []Fact

GetFacts returns a copy of all facts.

func (*Knowledge) GetPatterns added in v1.5.0

func (k *Knowledge) GetPatterns() []Pattern

GetPatterns returns a copy of all patterns.

func (*Knowledge) UpdateFileKnowledge added in v1.5.0

func (k *Knowledge) UpdateFileKnowledge(path string, fk FileKnowledge)

UpdateFileKnowledge updates knowledge for a specific file. Caps at 200 entries to prevent unbounded growth.

type MsgEmitter

type MsgEmitter interface {
	Emit(msg any)
}

MsgEmitter is a callback interface for emitting events back to the TUI. Uses `any` to avoid coupling the workflow to the Bubble Tea framework.

type Pattern added in v1.5.0

type Pattern struct {
	Name        string   `json:"name"`        // e.g., "Opts pattern", "sentinel errors"
	Description string   `json:"description"` // e.g., "Constructor uses Opts struct"
	Files       []string `json:"files"`       // files where pattern is observed
	Confidence  float64  `json:"confidence"`
}

Pattern represents an observed architectural pattern.

type PhaseResult

type PhaseResult struct {
	Phase               m31types.WorkflowPhase
	Success             bool
	Messages            []m31types.Message
	Tasks               []m31types.Task
	Error               string
	DurationMs          int64
	NeedsAnswers        bool
	RequiresManualInput bool
	WorkflowMode        m31types.WorkflowMode // mode to use for subsequent transitions

	// Execution metrics (populated by Execute/Ship phases)
	Usage     *m31types.Usage  // token usage from LLM calls
	Cost      float64          // estimated cost
	ToolCalls int              // number of tool calls made
	Commits   []git.CommitInfo // commits created during phase
	DiffStats DiffStats        // file change statistics (Ship phase)

	// Manual verification steps from the plan (populated by Verify phase)
	ManualVerificationSteps []string

	// Demonstration content (populated by Ship phase)
	Demonstration string

	// Runtime verification results (populated by Runtime phase)
	RuntimeSummary *RuntimeSummary
}

PhaseResult holds the outcome of a workflow phase.

type PhaseTransitionCompleteMsg

type PhaseTransitionCompleteMsg struct {
	From    string
	To      string
	Success bool
	Error   string
}

PhaseTransitionCompleteMsg is emitted when a phase transition completes.

type PhaseTransitionStartMsg

type PhaseTransitionStartMsg struct {
	From    string
	To      string
	Context string
}

PhaseTransitionStartMsg is emitted when a phase transition begins.

type PlanCheckMsg added in v1.2.0

type PlanCheckMsg struct {
	Passed     bool
	IssueCount int
	Blockers   int
	Warnings   int
}

PlanCheckMsg is emitted after the plan checker reviews the plan.

type PlanCheckResult added in v1.2.0

type PlanCheckResult struct {
	Passed    bool
	Issues    []PlanIssue
	Iteration int
}

PlanCheckResult holds the outcome of the plan checker review.

type PlanChunkProgressMsg added in v1.2.0

type PlanChunkProgressMsg struct {
	Wave        int
	TotalWaves  int
	TasksInWave int
}

PlanChunkProgressMsg is emitted during chunked plan generation.

type PlanIssue added in v1.2.0

type PlanIssue struct {
	Severity string // "blocker" or "warning"
	Category string // granularity, acceptance, dependency, coverage, alignment, concreteness, security, gap
	Message  string
	TaskID   int // 0 if not task-specific
}

PlanIssue represents a single issue found by the plan checker or coverage gates.

type PlanOutline added in v1.2.0

type PlanOutline struct {
	Title      string        `json:"title"`
	Waves      []WaveOutline `json:"waves"`
	TotalTasks int           `json:"total_tasks"`
}

PlanOutline represents the high-level structure of a chunked plan.

type PlanProgressMsg

type PlanProgressMsg struct {
	Version int
	Message string
}

PlanProgressMsg reports plan generation progress with version info.

type PlanRevisionMsg added in v1.2.0

type PlanRevisionMsg struct {
	Iteration       int
	MaxIterations   int
	IssuesRemaining int
}

PlanRevisionMsg is emitted during each plan revision iteration.

type PreflightCheck added in v1.2.0

type PreflightCheck struct {
	Passed         bool
	RuntimeVersion string
	DiskSpaceOK    bool
	GitRemoteOK    bool
	Issues         []string
}

PreflightCheck holds the results of environment pre-flight checks.

type ProjectAnalysis added in v1.2.0

type ProjectAnalysis struct {
	ProjectType     string
	Framework       string
	Language        string
	DependencyCount int
	TestFileRatio   float64
	FileCount       int
	HealthScore     int
	Details         []string
}

ProjectAnalysis holds the results of deep project analysis.

type PromptRegistry

type PromptRegistry struct {
	Base             string
	ToolUse          string
	PlanFormat       string
	ExecuteTask      string
	Discuss          string
	SelfHeal         string
	Demonstration    string
	Autonomous       string
	ContextAwareness string
	CodeQuality      string
	CodeIntelligence string
	Research         string
	PlanCheck        string
	PlanRevise       string
	PlanOutline      string
	DiscussFollowup  string
	IntentClassify   string
	WebsiteBuild     string
}

PromptRegistry holds all loaded prompt templates.

func LoadPrompts

func LoadPrompts() (*PromptRegistry, error)

LoadPrompts reads all embedded prompt files and returns a registry.

type QualityGateResult added in v1.2.0

type QualityGateResult struct {
	TaskID  int
	Passed  bool
	Checked int
	Failed  int
	Details []string
}

QualityGateResult holds the outcome of checking acceptance criteria against file state.

type ResearchProgressMsg added in v1.2.0

type ResearchProgressMsg struct {
	Phase    string
	Message  string
	Complete bool
}

ResearchProgressMsg is emitted during the pre-plan research sub-step.

type RuntimeCheckCompleteMsg added in v1.3.0

type RuntimeCheckCompleteMsg struct {
	Summary RuntimeSummary
}

RuntimeCheckCompleteMsg is emitted when runtime smoke tests complete.

type RuntimeSummary added in v1.3.0

type RuntimeSummary struct {
	ProjectType string            `json:"project_type"`
	ServerURL   string            `json:"server_url"`
	ServerReady bool              `json:"server_ready"`
	Tests       []SmokeTestResult `json:"tests"`
	TotalPassed int               `json:"total_passed"`
	TotalFailed int               `json:"total_failed"`
	TotalTests  int               `json:"total_tests"`
	Errors      []string          `json:"errors,omitempty"`
	DurationMs  int64             `json:"duration_ms"`
}

RuntimeSummary holds the overall runtime verification results.

type SecurityFinding added in v1.2.0

type SecurityFinding struct {
	Severity string // "high", "medium", "low"
	File     string
	Line     int
	Pattern  string
	Message  string
}

SecurityFinding holds a security-related finding from scanning task files.

type SelfHealCompleteMsg

type SelfHealCompleteMsg struct {
	TaskID  int
	Attempt int
	Max     int
	Success bool
	Error   string
}

SelfHealCompleteMsg is emitted when a self-heal attempt finishes.

type SelfHealStartMsg

type SelfHealStartMsg struct {
	TaskID  int
	Attempt int
	Max     int
}

SelfHealStartMsg is emitted when a self-heal attempt begins.

type ShipChangelogMsg added in v1.2.0

type ShipChangelogMsg struct {
	Content string
	Entries int
}

ShipChangelogMsg is emitted when the changelog is generated.

type ShipPreflightMsg added in v1.2.0

type ShipPreflightMsg struct {
	Passed bool
	Issues []string
}

ShipPreflightMsg is emitted when the pre-ship checklist runs.

type ShipPreflightResult added in v1.2.0

type ShipPreflightResult struct {
	Passed bool
	Issues []string
}

ShipPreflightResult holds the outcome of the pre-ship checklist.

type ShipSummary

type ShipSummary struct {
	TaskDone    int
	TaskTotal   int
	TaskFailed  int
	TaskSkipped int
	Commits     []git.CommitInfo
	Duration    time.Duration
	SessionID   string
}

ShipSummary holds the session completion summary.

type SmokeTestResult added in v1.3.0

type SmokeTestResult struct {
	Route      string `json:"route"`
	Method     string `json:"method"`
	Status     int    `json:"status"`
	Passed     bool   `json:"passed"`
	Error      string `json:"error,omitempty"`
	DurationMs int64  `json:"duration_ms"`
	BodySize   int    `json:"body_size"`
	HasContent bool   `json:"has_content"`
}

SmokeTestResult holds the result of a single HTTP smoke test.

type TaskDiffSummaryMsg added in v1.3.0

type TaskDiffSummaryMsg struct {
	TaskID  int
	Summary *m31types.DiffSummary
}

TaskDiffSummaryMsg is emitted after a task commit to report file changes.

type TaskStartMsg

type TaskStartMsg struct {
	Task m31types.Task
}

TaskStartMsg is emitted when a task begins execution.

type TaskStub added in v1.2.0

type TaskStub struct {
	ID           int    `json:"id"`
	Action       string `json:"action"`
	Description  string `json:"description"`
	Dependencies []int  `json:"dependencies"`
	Category     string `json:"category"`
}

TaskStub is a minimal task representation for the outline phase.

type TaskUpdateMsg

type TaskUpdateMsg struct {
	Task   m31types.Task
	Status string
}

TaskUpdateMsg is emitted when a task status changes during execution.

type ThinkingCompleteMsg

type ThinkingCompleteMsg struct {
	Context string
}

ThinkingCompleteMsg is emitted when LLM processing ends.

type ThinkingStartMsg

type ThinkingStartMsg struct {
	Context string
}

ThinkingStartMsg is emitted when LLM processing begins.

type ToolCallTracker added in v1.2.0

type ToolCallTracker struct {
	// contains filtered or unexported fields
}

ToolCallTracker tracks tool call patterns across iterations to detect loops.

func NewToolCallTracker added in v1.2.0

func NewToolCallTracker(maxLoop int) *ToolCallTracker

NewToolCallTracker creates a tracker with the given loop threshold.

func (*ToolCallTracker) Count added in v1.2.0

func (t *ToolCallTracker) Count() int

Count returns total tool calls recorded.

func (*ToolCallTracker) LastLoopTool added in v1.2.0

func (t *ToolCallTracker) LastLoopTool() string

LastLoopTool returns the tool name involved in the most recent loop, or empty.

func (*ToolCallTracker) Record added in v1.2.0

func (t *ToolCallTracker) Record(name, input string) bool

Record adds a tool call to the history and returns true if a loop is detected.

type ToolCompleteMsg

type ToolCompleteMsg struct {
	ToolName   string
	Success    bool
	DurationMs int64
	Error      string
	FilePath   string // populated for file-writing tools (FileWrite, Edit, FileDelete, FileMove)
}

ToolCompleteMsg is emitted when a tool call finishes execution.

type ToolStartMsg

type ToolStartMsg struct {
	ToolName    string
	Description string
}

ToolStartMsg is emitted when a tool call begins execution.

type VerificationResult

type VerificationResult struct {
	TaskID     int
	FilesExist bool
	SyntaxOK   bool
	TestsOK    bool
	Errors     []string
}

VerificationResult holds the outcome of verifying a task.

type VerifyReport added in v1.2.0

type VerifyReport struct {
	SessionID   string
	Timestamp   time.Time
	Total       int
	Passed      int
	Failed      int
	Skipped     int
	Results     []VerifyTaskReport
	Security    []SecurityFinding
	ManualSteps []string
}

VerifyReport holds the structured verification report.

type VerifyReportMsg added in v1.2.0

type VerifyReportMsg struct {
	Report   string
	PassRate int // percentage 0-100
}

VerifyReportMsg is emitted when the verification report is generated.

type VerifyTaskReport added in v1.2.0

type VerifyTaskReport struct {
	TaskID      int
	Description string
	Status      string
	FilesExist  bool
	BuildOK     bool
	TestsOK     bool
	Errors      []string
	Duration    time.Duration
}

VerifyTaskReport holds per-task verification results.

type WaveOutline added in v1.2.0

type WaveOutline struct {
	Wave  int        `json:"wave"`
	Tasks []TaskStub `json:"tasks"`
}

WaveOutline groups tasks by execution wave.

type WorkflowState added in v1.5.0

type WorkflowState struct {

	// Conversation messages for the workflow (updated by /compress proactively)
	Messages []m31types.Message
	// contains filtered or unexported fields
}

WorkflowState groups mutable session state extracted from Engine. This struct owns plan state, cached data, intent classification, and v1.5 subsystems (decision log, knowledge, budget tracker). The Engine retains phase dispatch, LLM streaming, and subsystem orchestration.

Jump to

Keyboard shortcuts

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