engine

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeatureBranchFor

func FeatureBranchFor(projectID string) string

Types

type Engine

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

func New

func New(opts Options) *Engine

func (*Engine) CIStatus

func (e *Engine) CIStatus(ctx context.Context, root string) interface{}

func (*Engine) CommitVerified

func (e *Engine) CommitVerified(ctx context.Context, root, message string) (string, error)

func (*Engine) Feedback

func (e *Engine) Feedback(root, requestID, text, status, credName string) error

func (*Engine) InspectChecks

func (e *Engine) InspectChecks(ctx context.Context, root string) ci.Report

func (*Engine) NextCredential

func (e *Engine) NextCredential(root string, names []string) (human.Request, error)

func (*Engine) OpenFromPRD

func (e *Engine) OpenFromPRD(ctx context.Context, prdPath string) (Result, error)

OpenFromPRD is the PRD-only entry: validate, place the Studio project, then prepare. It does not invoke a Cursor worker.

func (*Engine) OpenMilestonePR

func (e *Engine) OpenMilestonePR(ctx context.Context, root, title, body string) (vcs.PR, error)

func (*Engine) Prepare

func (e *Engine) Prepare(ctx context.Context, req Request) (Result, error)

Prepare builds a deterministic task packet and Git baseline without invoking a worker.

func (*Engine) PrepareRepair

func (e *Engine) PrepareRepair(ctx context.Context, req Request) (repair.Packet, error)

func (*Engine) Reconcile

func (e *Engine) Reconcile(ctx context.Context, root string) error

Reconcile inspects Git/GitHub reality and repairs persisted delivery state without repeating operations.

func (*Engine) RepairRuntime

func (e *Engine) RepairRuntime(ctx context.Context, root string) (repair.Packet, apprun.Report, error)

RepairRuntime runs bounded runtime repair after a failed local start.

func (*Engine) RequestHuman

func (e *Engine) RequestHuman(ctx context.Context, root string, req human.Request) (human.Request, error)

func (*Engine) Resume

func (e *Engine) Resume(ctx context.Context, root string) error

func (*Engine) Review

func (e *Engine) Review(ctx context.Context, req Request) (review.Result, error)

func (*Engine) Run

func (e *Engine) Run(ctx context.Context, req Request) (Result, error)

func (*Engine) RunGraph

func (e *Engine) RunGraph(ctx context.Context, req Request) (PhaseResult, error)

RunGraph walks READY phases sequentially. Each phase uses RunPhase as the inner loop.

func (*Engine) RunPhase

func (e *Engine) RunPhase(ctx context.Context, req Request) (PhaseResult, error)

RunPhase is the headless sequential loop for one phase: worker, verify, review, bounded repair.

func (*Engine) StartRuntime

func (e *Engine) StartRuntime(ctx context.Context, root string) (apprun.Report, error)

StartRuntime starts the local application after verified project completion.

func (*Engine) TryMerge

func (e *Engine) TryMerge(ctx context.Context, root string) (MergeDecision, vcs.MergeResult, error)

func (*Engine) Verify

func (e *Engine) Verify(ctx context.Context, req Request) (testeng.Result, error)

Verify runs independent P7 verification. It never trusts worker_claimed_success.

type Execution

type Execution struct {
	SchemaVersion        int          `json:"schema_version"`
	RunID                string       `json:"run_id"`
	TaskID               string       `json:"task_id"`
	ProjectID            string       `json:"project_id"`
	PhaseID              string       `json:"phase_id"`
	ProductRoot          string       `json:"product_root"`
	Baseline             vcs.Baseline `json:"baseline"`
	PacketRef            string       `json:"packet_ref"`
	TranscriptRef        string       `json:"transcript_ref,omitempty"`
	Invoked              bool         `json:"invoked"`
	RefusalReason        string       `json:"refusal_reason,omitempty"`
	ExitCode             int          `json:"exit_code"`
	DurationMS           int64        `json:"duration_ms"`
	TimedOut             bool         `json:"timed_out"`
	ChangedPaths         []string     `json:"changed_paths"`
	WorkerClaimedSuccess bool         `json:"worker_claimed_success"`
	ClaimedDone          bool         `json:"claimed_done"`
	VerifiedSuccess      bool         `json:"verified_success"`
	CLIMechanism         string       `json:"cli_mechanism,omitempty"`
	RecordedAt           string       `json:"recorded_at"`
	IncidentID           string       `json:"incident_id,omitempty"`
	RepairAttempt        int          `json:"repair_attempt,omitempty"`
	Subagent             string       `json:"subagent,omitempty"`
}

Execution is the persisted P4 record.

type GitHubBlock

type GitHubBlock struct {
	Operation   string `json:"operation"`
	Reason      string `json:"reason"`
	HumanAction string `json:"human_action"`
}

func (GitHubBlock) Error

func (b GitHubBlock) Error() string

type MergeDecision

type MergeDecision struct {
	Allow  bool   `json:"allow"`
	Status string `json:"status,omitempty"`
	Reason string `json:"reason,omitempty"`
}

func EvaluateMerge

func EvaluateMerge(cfg config.Config, st state.State, ex Execution, pr vcs.PR, checks ci.Report, v *testeng.Result) MergeDecision

type Options

type Options struct {
	Worker       cursor.Worker
	Git          *vcs.Client
	Now          func() time.Time
	NewID        func() string
	Timeout      time.Duration
	TestTimeout  time.Duration
	AllowSelf    bool
	PreflightEnv preflight.Env
	LookPath     func(file string) (string, error)
	ProcRunner   *proc.Runner
	Config       config.Config
	LLM          llm.Adapter
	RepairWorker cursor.Worker
	GH           *vcs.GHClient
	CI           *ci.Watcher
	Bell         *notify.Bell
	SkipWait     bool
	Cwd          string
	Home         string
	Runtime      apprun.Starter
}

Options injects P4 dependencies. This is not the full orchestration engine.

type PhaseResult

type PhaseResult struct {
	Execution        Execution
	Verification     testeng.Result
	Incident         repair.Incident
	Human            *human.Request
	Completed        bool
	Waiting          bool
	ProjectCompleted bool
	Phases           []string
}

type Request

type Request struct {
	ProductRoot string
	PRDPath     string
	PhaseID     prd.PhaseID
	Mode        string
	PRDOnly     bool
}

Request is one coding-worker invocation against a product workspace.

type Result

type Result struct {
	Execution        Execution
	Packet           packet.Packet
	ProjectCompleted bool
	Contract         *prd.ContractResult
	WaitingForHuman  bool
	Human            *human.Request
	ProjectType      string
	ProjectLocation  string
	Runtime          *apprun.Report
}

Jump to

Keyboard shortcuts

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