Documentation
¶
Overview ¶
Package service contains state machines and domain logic.
Index ¶
- func Emit(bus event.Publisher, evt domain.SystemEvent)
- func WorkItemEventExternalIDs(item domain.Session) []string
- type AgentSessionService
- func (s *AgentSessionService) Complete(ctx context.Context, id string) error
- func (s *AgentSessionService) Create(ctx context.Context, agentSession domain.AgentSession) error
- func (s *AgentSessionService) Delete(ctx context.Context, id string) error
- func (s *AgentSessionService) Fail(ctx context.Context, id string, exitCode *int) error
- func (s *AgentSessionService) FindInterruptedByWorkspace(ctx context.Context, workspaceID string) ([]domain.AgentSession, error)
- func (s *AgentSessionService) FindRunningByOwner(ctx context.Context, instanceID string) ([]domain.AgentSession, error)
- func (s *AgentSessionService) FollowUpFailed(ctx context.Context, failed domain.AgentSession, harnessName string, ...) (domain.AgentSession, error)
- func (s *AgentSessionService) FollowUpRestart(ctx context.Context, id string) error
- func (s *AgentSessionService) Get(ctx context.Context, id string) (domain.AgentSession, error)
- func (s *AgentSessionService) Interrupt(ctx context.Context, id string) error
- func (s *AgentSessionService) ListBySubPlanID(ctx context.Context, subPlanID string) ([]domain.AgentSession, error)
- func (s *AgentSessionService) ListByWorkItemID(ctx context.Context, workItemID string) ([]domain.AgentSession, error)
- func (s *AgentSessionService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.AgentSession, error)
- func (s *AgentSessionService) Resume(ctx context.Context, interrupted domain.AgentSession, harnessName string, ...) (domain.AgentSession, error)
- func (s *AgentSessionService) ResumeFromAnswer(ctx context.Context, id string) error
- func (s *AgentSessionService) SearchHistory(ctx context.Context, filter domain.SessionHistoryFilter) ([]domain.SessionHistoryEntry, error)
- func (s *AgentSessionService) SetPlanID(ctx context.Context, id string, planID string) error
- func (s *AgentSessionService) Start(ctx context.Context, id string) error
- func (s *AgentSessionService) Transition(ctx context.Context, id string, to domain.AgentSessionStatus) error
- func (s *AgentSessionService) UpdateOwnerInstance(ctx context.Context, id string, instanceID string) error
- func (s *AgentSessionService) UpdatePID(ctx context.Context, id string, pid int) error
- func (s *AgentSessionService) UpdateResumeInfo(ctx context.Context, id string, info map[string]string) error
- func (s *AgentSessionService) WaitForAnswer(ctx context.Context, id string) error
- type ErrAlreadyExists
- type ErrConstraintViolation
- type ErrInvalidInput
- type ErrInvalidTransition
- type ErrNotFound
- type EventService
- func (s *EventService) Create(ctx context.Context, e domain.SystemEvent) error
- func (s *EventService) ListByType(ctx context.Context, eventType string, limit int) ([]domain.SystemEvent, error)
- func (s *EventService) ListByWorkspaceID(ctx context.Context, workspaceID string, limit int) ([]domain.SystemEvent, error)
- type GithubPRCheckService
- type GithubPRReviewService
- type GithubPRService
- func (s *GithubPRService) Get(ctx context.Context, id string) (domain.GithubPullRequest, error)
- func (s *GithubPRService) GetByNumber(ctx context.Context, owner, repo string, number int) (domain.GithubPullRequest, error)
- func (s *GithubPRService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.GithubPullRequest, error)
- func (s *GithubPRService) ListNonTerminal(ctx context.Context, workspaceID string) ([]domain.GithubPullRequest, error)
- func (s *GithubPRService) Upsert(ctx context.Context, pr domain.GithubPullRequest) error
- type GitlabMRCheckService
- type GitlabMRReviewService
- type GitlabMRService
- func (s *GitlabMRService) Delete(ctx context.Context, id string) error
- func (s *GitlabMRService) Get(ctx context.Context, id string) (domain.GitlabMergeRequest, error)
- func (s *GitlabMRService) GetByIID(ctx context.Context, projectPath string, iid int) (domain.GitlabMergeRequest, error)
- func (s *GitlabMRService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.GitlabMergeRequest, error)
- func (s *GitlabMRService) ListNonTerminal(ctx context.Context, workspaceID string) ([]domain.GitlabMergeRequest, error)
- func (s *GitlabMRService) Upsert(ctx context.Context, mr domain.GitlabMergeRequest) error
- type InstanceService
- func (s *InstanceService) CleanupStaleInstances(ctx context.Context, workspaceID string, threshold time.Duration) (int, error)
- func (s *InstanceService) Create(ctx context.Context, inst domain.SubstrateInstance) error
- func (s *InstanceService) Delete(ctx context.Context, id string) error
- func (s *InstanceService) FindStaleInstances(ctx context.Context, workspaceID string, threshold time.Duration) ([]domain.SubstrateInstance, error)
- func (s *InstanceService) Get(ctx context.Context, id string) (domain.SubstrateInstance, error)
- func (s *InstanceService) IsAlive(ctx context.Context, id string, threshold time.Duration) (bool, error)
- func (s *InstanceService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.SubstrateInstance, error)
- func (s *InstanceService) UpdateHeartbeat(ctx context.Context, id string) error
- type PlanApprovalEventContext
- type PlanOption
- type PlanService
- func (s *PlanService) AllSubPlansCompleted(ctx context.Context, planID string) (bool, error)
- func (s *PlanService) AppendFAQ(ctx context.Context, entry domain.FAQEntry) error
- func (s *PlanService) ApplyReviewedPlanOutput(ctx context.Context, id string, rawOutput domain.RawPlanOutput) (domain.Plan, []domain.TaskPlan, error)
- func (s *PlanService) ApprovePlan(ctx context.Context, id string, opts ...PlanOption) error
- func (s *PlanService) CompleteSubPlan(ctx context.Context, id string) error
- func (s *PlanService) CreatePlan(ctx context.Context, plan domain.Plan) error
- func (s *PlanService) CreatePlanAtomic(ctx context.Context, replacePlanID string, plan *domain.Plan, ...) error
- func (s *PlanService) CreateSubPlan(ctx context.Context, sp domain.TaskPlan) error
- func (s *PlanService) CreateSubPlansBatch(ctx context.Context, subPlans []domain.TaskPlan) error
- func (s *PlanService) DeletePlan(ctx context.Context, id string) error
- func (s *PlanService) DeleteSubPlan(ctx context.Context, id string) error
- func (s *PlanService) FailSubPlan(ctx context.Context, id string) error
- func (s *PlanService) GetPlan(ctx context.Context, id string) (domain.Plan, error)
- func (s *PlanService) GetPlanByWorkItemID(ctx context.Context, workItemID string) (domain.Plan, error)
- func (s *PlanService) GetSubPlan(ctx context.Context, id string) (domain.TaskPlan, error)
- func (s *PlanService) ListSubPlansByPlanID(ctx context.Context, planID string) ([]domain.TaskPlan, error)
- func (s *PlanService) MarkSubPlanPRReady(ctx context.Context, subPlanID string, ready SubPlanPRReadyContext) error
- func (s *PlanService) RejectPlan(ctx context.Context, id string) error
- func (s *PlanService) RetrySubPlan(ctx context.Context, id string) error
- func (s *PlanService) StartSubPlan(ctx context.Context, id string) error
- func (s *PlanService) SubmitForReview(ctx context.Context, id string) error
- func (s *PlanService) TransitionPlan(ctx context.Context, id string, to domain.PlanStatus) error
- func (s *PlanService) TransitionSubPlan(ctx context.Context, id string, to domain.TaskPlanStatus) error
- func (s *PlanService) UpdatePlanContent(ctx context.Context, id string, content string) error
- func (s *PlanService) UpdateSubPlanContent(ctx context.Context, id string, content string) error
- type QuestionService
- func (s *QuestionService) Answer(ctx context.Context, id string, answer string, answeredBy string) error
- func (s *QuestionService) AnswerWithData(ctx context.Context, id string, answer domain.AgentQuestionAnswer, ...) error
- func (s *QuestionService) Create(ctx context.Context, q domain.Question) error
- func (s *QuestionService) Escalate(ctx context.Context, id string) error
- func (s *QuestionService) EscalateWithProposal(ctx context.Context, id string, proposedAnswer string) error
- func (s *QuestionService) Get(ctx context.Context, id string) (domain.Question, error)
- func (s *QuestionService) HasPendingQuestions(ctx context.Context, sessionID string) (bool, error)
- func (s *QuestionService) ListBySessionID(ctx context.Context, sessionID string) ([]domain.Question, error)
- func (s *QuestionService) Transition(ctx context.Context, id string, to domain.QuestionStatus) error
- func (s *QuestionService) UpdateContext(ctx context.Context, id string, questionContext string) error
- func (s *QuestionService) UpdateProposal(ctx context.Context, id, proposedAnswer string) error
- type ReviewService
- func (s *ReviewService) CompleteReimplementation(ctx context.Context, id string) error
- func (s *ReviewService) CountMajorCritiques(ctx context.Context, cycleID string) (int, error)
- func (s *ReviewService) CreateCritique(ctx context.Context, critique domain.Critique) error
- func (s *ReviewService) CreateCritiquesBatch(ctx context.Context, critiques []domain.Critique) error
- func (s *ReviewService) CreateCycle(ctx context.Context, cycle domain.ReviewCycle) error
- func (s *ReviewService) FailReviewCycle(ctx context.Context, id string) error
- func (s *ReviewService) GetCritique(ctx context.Context, id string) (domain.Critique, error)
- func (s *ReviewService) GetCycle(ctx context.Context, id string) (domain.ReviewCycle, error)
- func (s *ReviewService) HasUnresolvedCritiques(ctx context.Context, cycleID string) (bool, error)
- func (s *ReviewService) ListCritiquesByCycleID(ctx context.Context, cycleID string) ([]domain.Critique, error)
- func (s *ReviewService) ListCyclesBySessionID(ctx context.Context, sessionID string) ([]domain.ReviewCycle, error)
- func (s *ReviewService) PassReview(ctx context.Context, id string) error
- func (s *ReviewService) RecordCritiques(ctx context.Context, id string) error
- func (s *ReviewService) ResolveCritique(ctx context.Context, id string) error
- func (s *ReviewService) StartReimplementation(ctx context.Context, id string) error
- func (s *ReviewService) TransitionCritique(ctx context.Context, id string, to domain.CritiqueStatus) error
- func (s *ReviewService) TransitionCycle(ctx context.Context, id string, to domain.ReviewCycleStatus) error
- func (s *ReviewService) UpdateCycleSummary(ctx context.Context, id string, summary string) error
- type SessionFilterLockService
- func (s *SessionFilterLockService) Acquire(ctx context.Context, filterID, instanceID string, leaseDuration time.Duration) (domain.NewSessionFilterLock, bool, error)
- func (s *SessionFilterLockService) Release(ctx context.Context, filterID, instanceID string) error
- func (s *SessionFilterLockService) Renew(ctx context.Context, filterID, instanceID string, leaseDuration time.Duration) (domain.NewSessionFilterLock, bool, error)
- type SessionFilterService
- func (s *SessionFilterService) Create(ctx context.Context, filter domain.NewSessionFilter) error
- func (s *SessionFilterService) Delete(ctx context.Context, id string) error
- func (s *SessionFilterService) Get(ctx context.Context, id string) (domain.NewSessionFilter, error)
- func (s *SessionFilterService) GetByWorkspaceProviderName(ctx context.Context, workspaceID, provider, name string) (domain.NewSessionFilter, error)
- func (s *SessionFilterService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.NewSessionFilter, error)
- func (s *SessionFilterService) ListByWorkspaceProvider(ctx context.Context, workspaceID, provider string) ([]domain.NewSessionFilter, error)
- func (s *SessionFilterService) Update(ctx context.Context, filter domain.NewSessionFilter) error
- type SessionReviewArtifactService
- func (s *SessionReviewArtifactService) ListByWorkItemID(ctx context.Context, workItemID string) ([]domain.SessionReviewArtifact, error)
- func (s *SessionReviewArtifactService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.SessionReviewArtifact, error)
- func (s *SessionReviewArtifactService) TransferArtifactLinks(ctx context.Context, fromID, toID string) error
- func (s *SessionReviewArtifactService) Upsert(ctx context.Context, link domain.SessionReviewArtifact) error
- type SessionService
- func (s *SessionService) ApprovePlan(ctx context.Context, id string) error
- func (s *SessionService) Archive(ctx context.Context, id string) error
- func (s *SessionService) CompleteWorkItem(ctx context.Context, id string) error
- func (s *SessionService) Create(ctx context.Context, item domain.Session) error
- func (s *SessionService) Delete(ctx context.Context, id string) error
- func (s *SessionService) FailWorkItem(ctx context.Context, id string) error
- func (s *SessionService) Get(ctx context.Context, id string) (domain.Session, error)
- func (s *SessionService) List(ctx context.Context, filter repository.SessionFilter) ([]domain.Session, error)
- func (s *SessionService) MergeWorkItem(ctx context.Context, id string) error
- func (s *SessionService) RejectPlan(ctx context.Context, id string) error
- func (s *SessionService) RequestReimplementation(ctx context.Context, id string) error
- func (s *SessionService) RetryFailedWorkItem(ctx context.Context, id string) error
- func (s *SessionService) RollbackPlanningInterrupt(ctx context.Context, id string) error
- func (s *SessionService) StartFollowUpPlanning(ctx context.Context, id string) error
- func (s *SessionService) StartImplementation(ctx context.Context, id string) error
- func (s *SessionService) StartPlanning(ctx context.Context, id string) error
- func (s *SessionService) SubmitForReview(ctx context.Context, id string) error
- func (s *SessionService) SubmitPlanForReview(ctx context.Context, id string) error
- func (s *SessionService) Transition(ctx context.Context, id string, to domain.SessionState) error
- func (s *SessionService) Unarchive(ctx context.Context, id string) error
- func (s *SessionService) Update(ctx context.Context, item domain.Session) error
- type SubPlanPRReadyContext
- type WorkspaceService
- func (s *WorkspaceService) Archive(ctx context.Context, id string) error
- func (s *WorkspaceService) Create(ctx context.Context, ws domain.Workspace) error
- func (s *WorkspaceService) Delete(ctx context.Context, id string) error
- func (s *WorkspaceService) Get(ctx context.Context, id string) (domain.Workspace, error)
- func (s *WorkspaceService) MarkError(ctx context.Context, id string) error
- func (s *WorkspaceService) MarkReady(ctx context.Context, id string) error
- func (s *WorkspaceService) Recover(ctx context.Context, id string) error
- func (s *WorkspaceService) Transition(ctx context.Context, id string, to domain.WorkspaceStatus) error
- func (s *WorkspaceService) Update(ctx context.Context, ws domain.Workspace) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Emit ¶ added in v0.0.39
func Emit(bus event.Publisher, evt domain.SystemEvent)
Emit emits an event asynchronously.
func WorkItemEventExternalIDs ¶ added in v0.1.0
WorkItemEventExternalIDs builds the external_ids list for work item event payloads. It prefixes source item IDs with the provider namespace and deduplicates.
Types ¶
type AgentSessionService ¶ added in v0.1.0
type AgentSessionService struct {
// contains filtered or unexported fields
}
AgentSessionService provides business logic for agent sessions.
func NewAgentSessionService ¶ added in v0.1.0
func NewAgentSessionService(transacter atomic.Transacter[repository.Resources], eventBus event.Publisher) *AgentSessionService
func (*AgentSessionService) Complete ¶ added in v0.1.0
func (s *AgentSessionService) Complete(ctx context.Context, id string) error
Complete transitions an agent session from running to completed.
func (*AgentSessionService) Create ¶ added in v0.1.0
func (s *AgentSessionService) Create(ctx context.Context, agentSession domain.AgentSession) error
Create creates a new child agent session in pending status.
func (*AgentSessionService) Delete ¶ added in v0.1.0
func (s *AgentSessionService) Delete(ctx context.Context, id string) error
Delete deletes an agent session.
func (*AgentSessionService) FindInterruptedByWorkspace ¶ added in v0.1.0
func (s *AgentSessionService) FindInterruptedByWorkspace(ctx context.Context, workspaceID string) ([]domain.AgentSession, error)
FindInterruptedByWorkspace finds all interrupted agent sessions for a workspace.
func (*AgentSessionService) FindRunningByOwner ¶ added in v0.1.0
func (s *AgentSessionService) FindRunningByOwner(ctx context.Context, instanceID string) ([]domain.AgentSession, error)
FindRunningByOwner finds all running agent sessions owned by an instance.
func (*AgentSessionService) FollowUpFailed ¶ added in v0.1.0
func (s *AgentSessionService) FollowUpFailed(ctx context.Context, failed domain.AgentSession, harnessName string, ownerInstanceID *string) (domain.AgentSession, error)
FollowUpFailed creates a new agent session for a failed one and transitions it to running. The failed session row is preserved as audit trail. It emits EventAgentSessionResumed with the full new session and the old session ID so the TUI can link old→new.
func (*AgentSessionService) FollowUpRestart ¶ added in v0.1.0
func (s *AgentSessionService) FollowUpRestart(ctx context.Context, id string) error
FollowUpRestart transitions a completed agent session back to running for a follow-up session. Unlike Start(), this preserves the original StartedAt and clears CompletedAt.
func (*AgentSessionService) Get ¶ added in v0.1.0
func (s *AgentSessionService) Get(ctx context.Context, id string) (domain.AgentSession, error)
Get retrieves an agent session by ID.
func (*AgentSessionService) Interrupt ¶ added in v0.1.0
func (s *AgentSessionService) Interrupt(ctx context.Context, id string) error
Interrupt transitions an agent session from running to interrupted.
func (*AgentSessionService) ListBySubPlanID ¶ added in v0.1.0
func (s *AgentSessionService) ListBySubPlanID(ctx context.Context, subPlanID string) ([]domain.AgentSession, error)
ListBySubPlanID retrieves all child agent sessions for a sub-plan.
func (*AgentSessionService) ListByWorkItemID ¶ added in v0.1.0
func (s *AgentSessionService) ListByWorkItemID(ctx context.Context, workItemID string) ([]domain.AgentSession, error)
ListByWorkItemID retrieves all child agent sessions for a work item.
func (*AgentSessionService) ListByWorkspaceID ¶ added in v0.1.0
func (s *AgentSessionService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.AgentSession, error)
ListByWorkspaceID retrieves all child agent sessions for a workspace.
func (*AgentSessionService) Resume ¶ added in v0.1.0
func (s *AgentSessionService) Resume(ctx context.Context, interrupted domain.AgentSession, harnessName string, ownerInstanceID *string) (domain.AgentSession, error)
Resume creates a new agent session as a replacement for an interrupted one and emits EventAgentSessionResumed with both session IDs. The interrupted session is NOT transitioned by this method — callers must handle that separately.
func (*AgentSessionService) ResumeFromAnswer ¶ added in v0.1.0
func (s *AgentSessionService) ResumeFromAnswer(ctx context.Context, id string) error
ResumeFromAnswer transitions an agent session from waiting_for_answer to running.
func (*AgentSessionService) SearchHistory ¶ added in v0.1.0
func (s *AgentSessionService) SearchHistory(ctx context.Context, filter domain.SessionHistoryFilter) ([]domain.SessionHistoryEntry, error)
SearchHistory retrieves searchable session-history entries for the requested scope.
func (*AgentSessionService) SetPlanID ¶ added in v0.1.0
SetPlanID records the plan produced by a planning session.
func (*AgentSessionService) Start ¶ added in v0.1.0
func (s *AgentSessionService) Start(ctx context.Context, id string) error
Start transitions an agent session from pending to running and emits EventAgentSessionStarted so the TUI reloads the session list when an agent session begins executing.
func (*AgentSessionService) Transition ¶ added in v0.1.0
func (s *AgentSessionService) Transition(ctx context.Context, id string, to domain.AgentSessionStatus) error
Transition transitions an agent session to a new status. For semantic events, use the specialized mutators: Start, Complete, Interrupt, FollowUpRestart. Transition only emits EventAgentSessionResumed for resumption transitions (Interrupted/WaitingForAnswer → Running).
func (*AgentSessionService) UpdateOwnerInstance ¶ added in v0.1.0
func (s *AgentSessionService) UpdateOwnerInstance(ctx context.Context, id string, instanceID string) error
UpdateOwnerInstance updates the owner instance ID for an agent session.
func (*AgentSessionService) UpdatePID ¶ added in v0.1.0
UpdatePID updates the PID for an agent session.
func (*AgentSessionService) UpdateResumeInfo ¶ added in v0.1.0
func (s *AgentSessionService) UpdateResumeInfo(ctx context.Context, id string, info map[string]string) error
UpdateResumeInfo stores harness-specific resume data on the agent session record. The info map is harness-defined; callers must not interpret individual keys.
func (*AgentSessionService) WaitForAnswer ¶ added in v0.1.0
func (s *AgentSessionService) WaitForAnswer(ctx context.Context, id string) error
WaitForAnswer transitions an agent session from running to waiting_for_answer.
type ErrAlreadyExists ¶
ErrAlreadyExists is returned when an entity already exists.
func (ErrAlreadyExists) Error ¶
func (e ErrAlreadyExists) Error() string
type ErrConstraintViolation ¶
type ErrConstraintViolation struct {
Message string
}
ErrConstraintViolation is returned when a business constraint is violated.
func (ErrConstraintViolation) Error ¶
func (e ErrConstraintViolation) Error() string
type ErrInvalidInput ¶
ErrInvalidInput is returned when input validation fails.
func (ErrInvalidInput) Error ¶
func (e ErrInvalidInput) Error() string
type ErrInvalidTransition ¶
ErrInvalidTransition is returned when a state transition is not allowed.
func (ErrInvalidTransition) Error ¶
func (e ErrInvalidTransition) Error() string
type ErrNotFound ¶
ErrNotFound is returned when an entity is not found.
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
type EventService ¶
type EventService struct {
// contains filtered or unexported fields
}
EventService provides business logic for system events.
func NewEventService ¶
func NewEventService(transacter atomic.Transacter[repository.Resources]) *EventService
NewEventService creates a new EventService.
func (*EventService) Create ¶
func (s *EventService) Create(ctx context.Context, e domain.SystemEvent) error
Create persists a system event.
func (*EventService) ListByType ¶
func (s *EventService) ListByType(ctx context.Context, eventType string, limit int) ([]domain.SystemEvent, error)
ListByType retrieves events by type.
func (*EventService) ListByWorkspaceID ¶
func (s *EventService) ListByWorkspaceID(ctx context.Context, workspaceID string, limit int) ([]domain.SystemEvent, error)
ListByWorkspaceID retrieves events by workspace ID.
type GithubPRCheckService ¶ added in v0.0.28
type GithubPRCheckService struct {
// contains filtered or unexported fields
}
GithubPRCheckService provides business logic for GitHub PR check runs.
func NewGithubPRCheckService ¶ added in v0.0.28
func NewGithubPRCheckService(transacter atomic.Transacter[repository.Resources]) *GithubPRCheckService
NewGithubPRCheckService creates a new GithubPRCheckService.
func (*GithubPRCheckService) DeleteByPRID ¶ added in v0.0.28
func (s *GithubPRCheckService) DeleteByPRID(ctx context.Context, prID string) error
DeleteByPRID deletes all check runs for a GitHub PR.
func (*GithubPRCheckService) ListByPRID ¶ added in v0.0.28
func (s *GithubPRCheckService) ListByPRID(ctx context.Context, prID string) ([]domain.GithubPRCheck, error)
ListByPRID retrieves GitHub PR check runs by PR ID.
func (*GithubPRCheckService) Upsert ¶ added in v0.0.28
func (s *GithubPRCheckService) Upsert(ctx context.Context, check domain.GithubPRCheck) error
Upsert creates or updates a GitHub PR check run.
type GithubPRReviewService ¶ added in v0.0.28
type GithubPRReviewService struct {
// contains filtered or unexported fields
}
GithubPRReviewService provides business logic for GitHub PR reviews.
func NewGithubPRReviewService ¶ added in v0.0.28
func NewGithubPRReviewService(transacter atomic.Transacter[repository.Resources]) *GithubPRReviewService
NewGithubPRReviewService creates a new GithubPRReviewService.
func (*GithubPRReviewService) DeleteByPRID ¶ added in v0.0.28
func (s *GithubPRReviewService) DeleteByPRID(ctx context.Context, prID string) error
DeleteByPRID deletes all reviews for a GitHub PR.
func (*GithubPRReviewService) ListByPRID ¶ added in v0.0.28
func (s *GithubPRReviewService) ListByPRID(ctx context.Context, prID string) ([]domain.GithubPRReview, error)
ListByPRID retrieves GitHub PR reviews by PR ID.
func (*GithubPRReviewService) Upsert ¶ added in v0.0.28
func (s *GithubPRReviewService) Upsert(ctx context.Context, review domain.GithubPRReview) error
Upsert creates or updates a GitHub PR review.
type GithubPRService ¶
type GithubPRService struct {
// contains filtered or unexported fields
}
GithubPRService provides business logic for GitHub pull requests.
func NewGithubPRService ¶
func NewGithubPRService(transacter atomic.Transacter[repository.Resources]) *GithubPRService
NewGithubPRService creates a new GithubPRService.
func (*GithubPRService) Get ¶
func (s *GithubPRService) Get(ctx context.Context, id string) (domain.GithubPullRequest, error)
Get retrieves a GitHub pull request by ID.
func (*GithubPRService) GetByNumber ¶
func (s *GithubPRService) GetByNumber(ctx context.Context, owner, repo string, number int) (domain.GithubPullRequest, error)
GetByNumber retrieves a GitHub pull request by owner, repo, and number.
func (*GithubPRService) ListByWorkspaceID ¶
func (s *GithubPRService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.GithubPullRequest, error)
ListByWorkspaceID retrieves GitHub pull requests by workspace ID.
func (*GithubPRService) ListNonTerminal ¶
func (s *GithubPRService) ListNonTerminal(ctx context.Context, workspaceID string) ([]domain.GithubPullRequest, error)
ListNonTerminal retrieves non-terminal GitHub pull requests by workspace ID.
func (*GithubPRService) Upsert ¶
func (s *GithubPRService) Upsert(ctx context.Context, pr domain.GithubPullRequest) error
Upsert creates or updates a GitHub pull request.
type GitlabMRCheckService ¶ added in v0.0.28
type GitlabMRCheckService struct {
// contains filtered or unexported fields
}
GitlabMRCheckService provides business logic for GitLab MR pipeline jobs.
func NewGitlabMRCheckService ¶ added in v0.0.28
func NewGitlabMRCheckService(transacter atomic.Transacter[repository.Resources]) *GitlabMRCheckService
NewGitlabMRCheckService creates a new GitlabMRCheckService.
func (*GitlabMRCheckService) DeleteByMRID ¶ added in v0.0.28
func (s *GitlabMRCheckService) DeleteByMRID(ctx context.Context, mrID string) error
DeleteByMRID deletes all pipeline jobs for a GitLab MR.
func (*GitlabMRCheckService) ListByMRID ¶ added in v0.0.28
func (s *GitlabMRCheckService) ListByMRID(ctx context.Context, mrID string) ([]domain.GitlabMRCheck, error)
ListByMRID retrieves GitLab MR pipeline jobs by MR ID.
func (*GitlabMRCheckService) Upsert ¶ added in v0.0.28
func (s *GitlabMRCheckService) Upsert(ctx context.Context, check domain.GitlabMRCheck) error
Upsert creates or updates a GitLab MR pipeline job.
type GitlabMRReviewService ¶ added in v0.0.28
type GitlabMRReviewService struct {
// contains filtered or unexported fields
}
GitlabMRReviewService provides business logic for GitLab MR reviews.
func NewGitlabMRReviewService ¶ added in v0.0.28
func NewGitlabMRReviewService(transacter atomic.Transacter[repository.Resources]) *GitlabMRReviewService
NewGitlabMRReviewService creates a new GitlabMRReviewService.
func (*GitlabMRReviewService) DeleteByMRID ¶ added in v0.0.28
func (s *GitlabMRReviewService) DeleteByMRID(ctx context.Context, mrID string) error
DeleteByMRID deletes all reviews for a GitLab MR.
func (*GitlabMRReviewService) ListByMRID ¶ added in v0.0.28
func (s *GitlabMRReviewService) ListByMRID(ctx context.Context, mrID string) ([]domain.GitlabMRReview, error)
ListByMRID retrieves GitLab MR reviews by MR ID.
func (*GitlabMRReviewService) Upsert ¶ added in v0.0.28
func (s *GitlabMRReviewService) Upsert(ctx context.Context, review domain.GitlabMRReview) error
Upsert creates or updates a GitLab MR review.
type GitlabMRService ¶
type GitlabMRService struct {
// contains filtered or unexported fields
}
GitlabMRService provides business logic for GitLab merge requests.
func NewGitlabMRService ¶
func NewGitlabMRService(transacter atomic.Transacter[repository.Resources]) *GitlabMRService
NewGitlabMRService creates a new GitlabMRService.
func (*GitlabMRService) Delete ¶ added in v0.1.0
func (s *GitlabMRService) Delete(ctx context.Context, id string) error
Delete removes a GitLab merge request by ID.
func (*GitlabMRService) Get ¶
func (s *GitlabMRService) Get(ctx context.Context, id string) (domain.GitlabMergeRequest, error)
Get retrieves a GitLab merge request by ID.
func (*GitlabMRService) GetByIID ¶
func (s *GitlabMRService) GetByIID(ctx context.Context, projectPath string, iid int) (domain.GitlabMergeRequest, error)
GetByIID retrieves a GitLab merge request by project path and IID.
func (*GitlabMRService) ListByWorkspaceID ¶
func (s *GitlabMRService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.GitlabMergeRequest, error)
ListByWorkspaceID retrieves GitLab merge requests by workspace ID.
func (*GitlabMRService) ListNonTerminal ¶
func (s *GitlabMRService) ListNonTerminal(ctx context.Context, workspaceID string) ([]domain.GitlabMergeRequest, error)
ListNonTerminal retrieves non-terminal GitLab merge requests by workspace ID.
func (*GitlabMRService) Upsert ¶
func (s *GitlabMRService) Upsert(ctx context.Context, mr domain.GitlabMergeRequest) error
Upsert creates or updates a GitLab merge request.
type InstanceService ¶
type InstanceService struct {
// contains filtered or unexported fields
}
InstanceService provides business logic for substrate instances.
func NewInstanceService ¶
func NewInstanceService(transacter atomic.Transacter[repository.Resources]) *InstanceService
NewInstanceService creates a new InstanceService.
func (*InstanceService) CleanupStaleInstances ¶
func (s *InstanceService) CleanupStaleInstances(ctx context.Context, workspaceID string, threshold time.Duration) (int, error)
CleanupStaleInstances removes all stale instance records for a workspace. Returns the count of successfully deleted instances and an error if any deletions failed. If some deletions fail, the error will be a joined error containing all individual errors.
func (*InstanceService) Create ¶
func (s *InstanceService) Create(ctx context.Context, inst domain.SubstrateInstance) error
Create creates a new instance record.
func (*InstanceService) Delete ¶
func (s *InstanceService) Delete(ctx context.Context, id string) error
Delete removes an instance record (on clean shutdown).
func (*InstanceService) FindStaleInstances ¶
func (s *InstanceService) FindStaleInstances(ctx context.Context, workspaceID string, threshold time.Duration) ([]domain.SubstrateInstance, error)
FindStaleInstances finds all instances with stale heartbeats for a workspace.
func (*InstanceService) Get ¶
func (s *InstanceService) Get(ctx context.Context, id string) (domain.SubstrateInstance, error)
Get retrieves an instance by ID.
func (*InstanceService) IsAlive ¶
func (s *InstanceService) IsAlive(ctx context.Context, id string, threshold time.Duration) (bool, error)
IsAlive checks if an instance is alive based on heartbeat. An instance is considered alive if its last heartbeat is within the threshold.
func (*InstanceService) ListByWorkspaceID ¶
func (s *InstanceService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.SubstrateInstance, error)
ListByWorkspaceID retrieves all instances for a workspace.
func (*InstanceService) UpdateHeartbeat ¶
func (s *InstanceService) UpdateHeartbeat(ctx context.Context, id string) error
UpdateHeartbeat updates the last heartbeat timestamp for an instance.
type PlanApprovalEventContext ¶ added in v0.1.0
type PlanApprovalEventContext struct {
ExternalID string
ExternalIDs []string
CommentBody string
RepoCommentScopes map[string]string
}
PlanApprovalEventContext holds adapter-specific context for plan approval events.
type PlanOption ¶ added in v0.1.0
type PlanOption func(*planEventExtra)
PlanOption is a functional option for plan service methods.
func WithPlanApprovalEventContext ¶ added in v0.1.0
func WithPlanApprovalEventContext(ctx PlanApprovalEventContext) PlanOption
WithPlanApprovalEventContext sets adapter-specific context for plan approval events.
type PlanService ¶
type PlanService struct {
// contains filtered or unexported fields
}
PlanService provides business logic for plans and sub-plans.
func NewPlanService ¶
func NewPlanService(transacter atomic.Transacter[repository.Resources], eventBus event.Publisher) *PlanService
NewPlanService creates a new PlanService.
func (*PlanService) AllSubPlansCompleted ¶
AllSubPlansCompleted checks if all sub-plans for a plan are completed.
func (*PlanService) ApplyReviewedPlanOutput ¶
func (s *PlanService) ApplyReviewedPlanOutput(ctx context.Context, id string, rawOutput domain.RawPlanOutput) (domain.Plan, []domain.TaskPlan, error)
ApplyReviewedPlanOutput updates the persisted orchestration plan and sub-plans from a fully parsed review document.
func (*PlanService) ApprovePlan ¶
func (s *PlanService) ApprovePlan(ctx context.Context, id string, opts ...PlanOption) error
ApprovePlan transitions a plan from pending_review to approved. It accepts optional PlanOptions for adapter-specific event context.
func (*PlanService) CompleteSubPlan ¶
func (s *PlanService) CompleteSubPlan(ctx context.Context, id string) error
CompleteSubPlan transitions a sub-plan from in_progress to completed.
func (*PlanService) CreatePlan ¶
CreatePlan creates a new plan in draft status.
func (*PlanService) CreatePlanAtomic ¶
func (s *PlanService) CreatePlanAtomic(ctx context.Context, replacePlanID string, plan *domain.Plan, subPlans []domain.TaskPlan) error
CreatePlanAtomic atomically supersedes the old plan (when replacePlanID is non-empty) and creates the new plan and sub-plans in a single transaction. The partial unique index on plans(work_item_id) WHERE status != 'superseded' ensures at most one active plan per work item. The old plan and its sub-plans remain in the database for historical reference. It emits EventPlanGenerated with the full plan and sub-plans after successful creation.
func (*PlanService) CreateSubPlan ¶
CreateSubPlan creates a new sub-plan in pending status.
func (*PlanService) CreateSubPlansBatch ¶
CreateSubPlansBatch creates multiple sub-plans in a single call.
func (*PlanService) DeletePlan ¶
func (s *PlanService) DeletePlan(ctx context.Context, id string) error
DeletePlan deletes a plan.
func (*PlanService) DeleteSubPlan ¶
func (s *PlanService) DeleteSubPlan(ctx context.Context, id string) error
DeleteSubPlan deletes a sub-plan.
func (*PlanService) FailSubPlan ¶
func (s *PlanService) FailSubPlan(ctx context.Context, id string) error
FailSubPlan transitions a sub-plan from in_progress to failed.
func (*PlanService) GetPlanByWorkItemID ¶
func (s *PlanService) GetPlanByWorkItemID(ctx context.Context, workItemID string) (domain.Plan, error)
GetPlanByWorkItemID retrieves a plan by work item ID.
func (*PlanService) GetSubPlan ¶
GetSubPlan retrieves a sub-plan by ID.
func (*PlanService) ListSubPlansByPlanID ¶
func (s *PlanService) ListSubPlansByPlanID(ctx context.Context, planID string) ([]domain.TaskPlan, error)
ListSubPlansByPlanID retrieves all sub-plans for a plan.
func (*PlanService) MarkSubPlanPRReady ¶ added in v0.1.0
func (s *PlanService) MarkSubPlanPRReady(ctx context.Context, subPlanID string, ready SubPlanPRReadyContext) error
MarkSubPlanPRReady emits EventSubPlanPRReady after a sub-plan's branch has been finalized and pushed. It validates that the sub-plan status is SubPlanCompleted and that required fields (Repository, Branch, Review) are present. This method is event-only: it does not mutate sub-plan status or persist a separate readiness state. It is idempotent: if EventSubPlanPRReady was already emitted for this sub-plan, the event is not emitted again.
The idempotency check uses SELECT FOR UPDATE to serialize concurrent calls, ensuring only one emission per sub-plan even under race conditions. Event emission uses synchronous bus.Publish so the event is persisted before the transaction commits, making it visible to concurrent transactions' checks.
func (*PlanService) RejectPlan ¶
func (s *PlanService) RejectPlan(ctx context.Context, id string) error
RejectPlan transitions a plan from pending_review to rejected.
func (*PlanService) RetrySubPlan ¶
func (s *PlanService) RetrySubPlan(ctx context.Context, id string) error
RetrySubPlan transitions a failed sub-plan back to pending.
func (*PlanService) StartSubPlan ¶
func (s *PlanService) StartSubPlan(ctx context.Context, id string) error
StartSubPlan transitions a sub-plan from pending to in_progress.
func (*PlanService) SubmitForReview ¶
func (s *PlanService) SubmitForReview(ctx context.Context, id string) error
SubmitForReview transitions a plan from draft to pending_review.
func (*PlanService) TransitionPlan ¶
func (s *PlanService) TransitionPlan(ctx context.Context, id string, to domain.PlanStatus) error
TransitionPlan transitions a plan to a new status.
func (*PlanService) TransitionSubPlan ¶
func (s *PlanService) TransitionSubPlan(ctx context.Context, id string, to domain.TaskPlanStatus) error
TransitionSubPlan transitions a sub-plan to a new status. It emits semantic events based on the destination status: - SubPlanInProgress → EventSubPlanStarted - SubPlanCompleted → EventSubPlanCompleted - SubPlanFailed → EventSubPlanFailed
func (*PlanService) UpdatePlanContent ¶
UpdatePlanContent updates the plan content without changing status.
func (*PlanService) UpdateSubPlanContent ¶
UpdateSubPlanContent updates the sub-plan content without changing status.
type QuestionService ¶
type QuestionService struct {
// contains filtered or unexported fields
}
QuestionService provides business logic for questions.
func NewQuestionService ¶
func NewQuestionService(transacter atomic.Transacter[repository.Resources], eventBus event.Publisher) *QuestionService
NewQuestionService creates a new QuestionService.
func (*QuestionService) Answer ¶
func (s *QuestionService) Answer(ctx context.Context, id string, answer string, answeredBy string) error
Answer transitions a question from pending to answered and records the answer.
func (*QuestionService) AnswerWithData ¶ added in v0.0.33
func (s *QuestionService) AnswerWithData(ctx context.Context, id string, answer domain.AgentQuestionAnswer, answeredBy string) error
AnswerWithData records a normalized answer and preserves structured answer data when present.
func (*QuestionService) Escalate ¶
func (s *QuestionService) Escalate(ctx context.Context, id string) error
Escalate transitions a question from pending to escalated.
func (*QuestionService) EscalateWithProposal ¶
func (s *QuestionService) EscalateWithProposal(ctx context.Context, id string, proposedAnswer string) error
EscalateWithProposal transitions a question from pending to escalated and records the Foreman's proposed answer so the TUI can pre-fill the human review form.
func (*QuestionService) HasPendingQuestions ¶
HasPendingQuestions checks if there are any pending questions for a session.
func (*QuestionService) ListBySessionID ¶
func (s *QuestionService) ListBySessionID(ctx context.Context, sessionID string) ([]domain.Question, error)
ListBySessionID retrieves all questions for a session.
func (*QuestionService) Transition ¶
func (s *QuestionService) Transition(ctx context.Context, id string, to domain.QuestionStatus) error
Transition transitions a question to a new status.
func (*QuestionService) UpdateContext ¶
func (s *QuestionService) UpdateContext(ctx context.Context, id string, questionContext string) error
UpdateContext updates the context for a pending question.
func (*QuestionService) UpdateProposal ¶
func (s *QuestionService) UpdateProposal(ctx context.Context, id, proposedAnswer string) error
UpdateProposal replaces the Foreman's proposed answer for an already-escalated question. Uses UpdateProposedAnswer (conditional SQL: WHERE status='escalated') so a concurrent ResolveEscalated that already answered the question results in a no-op rather than reverting the row's status back to 'escalated'.
type ReviewService ¶
type ReviewService struct {
// contains filtered or unexported fields
}
ReviewService provides business logic for review cycles and critiques.
func NewReviewService ¶
func NewReviewService(transacter atomic.Transacter[repository.Resources], eventBus event.Publisher) *ReviewService
NewReviewService creates a new ReviewService.
func (*ReviewService) CompleteReimplementation ¶
func (s *ReviewService) CompleteReimplementation(ctx context.Context, id string) error
CompleteReimplementation transitions a review cycle from reimplementing to reviewing.
func (*ReviewService) CountMajorCritiques ¶
CountMajorCritiques counts the number of major or critical critiques in a cycle.
func (*ReviewService) CreateCritique ¶
CreateCritique creates a new critique in open status.
func (*ReviewService) CreateCritiquesBatch ¶
func (s *ReviewService) CreateCritiquesBatch(ctx context.Context, critiques []domain.Critique) error
CreateCritiquesBatch creates multiple critiques in a single call.
func (*ReviewService) CreateCycle ¶
func (s *ReviewService) CreateCycle(ctx context.Context, cycle domain.ReviewCycle) error
CreateCycle creates a new review cycle in reviewing status.
func (*ReviewService) FailReviewCycle ¶
func (s *ReviewService) FailReviewCycle(ctx context.Context, id string) error
FailReviewCycle transitions a review cycle to failed.
func (*ReviewService) GetCritique ¶
GetCritique retrieves a critique by ID.
func (*ReviewService) GetCycle ¶
func (s *ReviewService) GetCycle(ctx context.Context, id string) (domain.ReviewCycle, error)
GetCycle retrieves a review cycle by ID.
func (*ReviewService) HasUnresolvedCritiques ¶
HasUnresolvedCritiques checks if there are any unresolved critiques in a cycle.
func (*ReviewService) ListCritiquesByCycleID ¶
func (s *ReviewService) ListCritiquesByCycleID(ctx context.Context, cycleID string) ([]domain.Critique, error)
ListCritiquesByCycleID retrieves all critiques for a review cycle.
func (*ReviewService) ListCyclesBySessionID ¶
func (s *ReviewService) ListCyclesBySessionID(ctx context.Context, sessionID string) ([]domain.ReviewCycle, error)
ListCyclesBySessionID retrieves all review cycles for a session.
func (*ReviewService) PassReview ¶
func (s *ReviewService) PassReview(ctx context.Context, id string) error
PassReview transitions a review cycle from reviewing to passed.
func (*ReviewService) RecordCritiques ¶
func (s *ReviewService) RecordCritiques(ctx context.Context, id string) error
RecordCritiques transitions a review cycle from reviewing to critiques_found.
func (*ReviewService) ResolveCritique ¶
func (s *ReviewService) ResolveCritique(ctx context.Context, id string) error
ResolveCritique transitions a critique from open to resolved.
func (*ReviewService) StartReimplementation ¶
func (s *ReviewService) StartReimplementation(ctx context.Context, id string) error
StartReimplementation transitions a review cycle from critiques_found to reimplementing.
func (*ReviewService) TransitionCritique ¶
func (s *ReviewService) TransitionCritique(ctx context.Context, id string, to domain.CritiqueStatus) error
TransitionCritique transitions a critique to a new status.
func (*ReviewService) TransitionCycle ¶
func (s *ReviewService) TransitionCycle(ctx context.Context, id string, to domain.ReviewCycleStatus) error
TransitionCycle transitions a review cycle to a new status.
func (*ReviewService) UpdateCycleSummary ¶
UpdateCycleSummary updates the review cycle summary.
type SessionFilterLockService ¶
type SessionFilterLockService struct {
// contains filtered or unexported fields
}
SessionFilterLockService coordinates lock leases for active New Session filters.
func NewSessionFilterLockService ¶
func NewSessionFilterLockService(transacter atomic.Transacter[repository.Resources]) *SessionFilterLockService
NewSessionFilterLockService creates a SessionFilterLockService.
func (*SessionFilterLockService) Acquire ¶
func (s *SessionFilterLockService) Acquire(ctx context.Context, filterID, instanceID string, leaseDuration time.Duration) (domain.NewSessionFilterLock, bool, error)
type SessionFilterService ¶
type SessionFilterService struct {
// contains filtered or unexported fields
}
SessionFilterService provides business logic for saved New Session filters.
func NewSessionFilterService ¶
func NewSessionFilterService(transacter atomic.Transacter[repository.Resources]) *SessionFilterService
NewSessionFilterService creates a SessionFilterService.
func (*SessionFilterService) Create ¶
func (s *SessionFilterService) Create(ctx context.Context, filter domain.NewSessionFilter) error
func (*SessionFilterService) Delete ¶
func (s *SessionFilterService) Delete(ctx context.Context, id string) error
func (*SessionFilterService) Get ¶
func (s *SessionFilterService) Get(ctx context.Context, id string) (domain.NewSessionFilter, error)
func (*SessionFilterService) GetByWorkspaceProviderName ¶
func (s *SessionFilterService) GetByWorkspaceProviderName(ctx context.Context, workspaceID, provider, name string) (domain.NewSessionFilter, error)
func (*SessionFilterService) ListByWorkspaceID ¶
func (s *SessionFilterService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.NewSessionFilter, error)
func (*SessionFilterService) ListByWorkspaceProvider ¶
func (s *SessionFilterService) ListByWorkspaceProvider(ctx context.Context, workspaceID, provider string) ([]domain.NewSessionFilter, error)
func (*SessionFilterService) Update ¶
func (s *SessionFilterService) Update(ctx context.Context, filter domain.NewSessionFilter) error
type SessionReviewArtifactService ¶
type SessionReviewArtifactService struct {
// contains filtered or unexported fields
}
SessionReviewArtifactService provides business logic for session review artifacts.
func NewSessionReviewArtifactService ¶
func NewSessionReviewArtifactService(transacter atomic.Transacter[repository.Resources]) *SessionReviewArtifactService
NewSessionReviewArtifactService creates a new SessionReviewArtifactService.
func (*SessionReviewArtifactService) ListByWorkItemID ¶
func (s *SessionReviewArtifactService) ListByWorkItemID(ctx context.Context, workItemID string) ([]domain.SessionReviewArtifact, error)
ListByWorkItemID retrieves session review artifacts by work item ID.
func (*SessionReviewArtifactService) ListByWorkspaceID ¶
func (s *SessionReviewArtifactService) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.SessionReviewArtifact, error)
ListByWorkspaceID retrieves session review artifacts by workspace ID.
func (*SessionReviewArtifactService) TransferArtifactLinks ¶ added in v0.1.0
func (s *SessionReviewArtifactService) TransferArtifactLinks(ctx context.Context, fromID, toID string) error
TransferArtifactLinks moves all session review artifacts from one provider artifact ID to another. This is used when correcting duplicate MR/PR records to preserve session links.
func (*SessionReviewArtifactService) Upsert ¶
func (s *SessionReviewArtifactService) Upsert(ctx context.Context, link domain.SessionReviewArtifact) error
Upsert creates or updates a session review artifact.
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService provides business logic for work items.
func NewSessionService ¶
func NewSessionService(transacter atomic.Transacter[repository.Resources], bus event.Publisher) *SessionService
NewSessionService creates a new WorkItemService.
func (*SessionService) ApprovePlan ¶
func (s *SessionService) ApprovePlan(ctx context.Context, id string) error
ApprovePlan transitions a work item from plan_review to approved.
func (*SessionService) Archive ¶ added in v0.0.39
func (s *SessionService) Archive(ctx context.Context, id string) error
Archive archives a terminal work item (completed, merged, or failed). It captures the current state in PreviousState so it can be restored on unarchive.
func (*SessionService) CompleteWorkItem ¶
func (s *SessionService) CompleteWorkItem(ctx context.Context, id string) error
CompleteWorkItem transitions a work item from reviewing to completed.
func (*SessionService) Delete ¶
func (s *SessionService) Delete(ctx context.Context, id string) error
Delete deletes a work item.
func (*SessionService) FailWorkItem ¶
func (s *SessionService) FailWorkItem(ctx context.Context, id string) error
FailWorkItem transitions a work item to failed from any applicable state.
func (*SessionService) List ¶
func (s *SessionService) List(ctx context.Context, filter repository.SessionFilter) ([]domain.Session, error)
List retrieves work items based on filter.
func (*SessionService) MergeWorkItem ¶ added in v0.0.28
func (s *SessionService) MergeWorkItem(ctx context.Context, id string) error
MergeWorkItem transitions a work item from completed to merged.
func (*SessionService) RejectPlan ¶
func (s *SessionService) RejectPlan(ctx context.Context, id string) error
RejectPlan transitions a work item from plan_review back to planning.
func (*SessionService) RequestReimplementation ¶
func (s *SessionService) RequestReimplementation(ctx context.Context, id string) error
RequestReimplementation transitions a work item from reviewing to implementing.
func (*SessionService) RetryFailedWorkItem ¶
func (s *SessionService) RetryFailedWorkItem(ctx context.Context, id string) error
RetryFailedWorkItem transitions a failed work item back to implementing for retry.
func (*SessionService) RollbackPlanningInterrupt ¶
func (s *SessionService) RollbackPlanningInterrupt(ctx context.Context, id string) error
RollbackPlanningInterrupt transitions a work item from planning back to ingested when its planning task was interrupted. Idempotent: if the work item is already in a different state (rolled back by a prior call or already advanced), it is a no-op.
func (*SessionService) StartFollowUpPlanning ¶
func (s *SessionService) StartFollowUpPlanning(ctx context.Context, id string) error
StartFollowUpPlanning transitions a completed work item back to planning for a follow-up round.
func (*SessionService) StartImplementation ¶
func (s *SessionService) StartImplementation(ctx context.Context, id string) error
StartImplementation transitions a work item from approved to implementing.
func (*SessionService) StartPlanning ¶
func (s *SessionService) StartPlanning(ctx context.Context, id string) error
StartPlanning transitions a work item from ingested to planning. If the work item is already in planning state (from a crashed session), it first rolls back to ingested before transitioning to planning. This handles the case where substrate was killed externally while planning was in progress.
func (*SessionService) SubmitForReview ¶
func (s *SessionService) SubmitForReview(ctx context.Context, id string) error
SubmitForReview transitions a work item from implementing to reviewing.
func (*SessionService) SubmitPlanForReview ¶
func (s *SessionService) SubmitPlanForReview(ctx context.Context, id string) error
SubmitPlanForReview transitions a work item from planning to plan_review.
func (*SessionService) Transition ¶
func (s *SessionService) Transition(ctx context.Context, id string, to domain.SessionState) error
Transition transitions a work item to a new state.
type SubPlanPRReadyContext ¶ added in v0.1.0
type SubPlanPRReadyContext struct {
Repository string
Branch string
WorktreePath string
WorkItemTitle string
SubPlanContent string
TrackerRefs []domain.TrackerReference
Review domain.ReviewRef
}
SubPlanPRReadyContext holds adapter-specific context for PR-ready events.
type WorkspaceService ¶
type WorkspaceService struct {
// contains filtered or unexported fields
}
WorkspaceService provides business logic for workspaces.
func NewWorkspaceService ¶
func NewWorkspaceService(transacter atomic.Transacter[repository.Resources], eventBus event.Publisher) *WorkspaceService
NewWorkspaceService creates a new WorkspaceService.
func (*WorkspaceService) Archive ¶
func (s *WorkspaceService) Archive(ctx context.Context, id string) error
Archive transitions a workspace from ready to archived.
func (*WorkspaceService) Delete ¶
func (s *WorkspaceService) Delete(ctx context.Context, id string) error
Delete deletes a workspace.
func (*WorkspaceService) MarkError ¶
func (s *WorkspaceService) MarkError(ctx context.Context, id string) error
MarkError transitions a workspace from creating to error.
func (*WorkspaceService) MarkReady ¶
func (s *WorkspaceService) MarkReady(ctx context.Context, id string) error
MarkReady transitions a workspace from creating to ready.
func (*WorkspaceService) Recover ¶
func (s *WorkspaceService) Recover(ctx context.Context, id string) error
Recover transitions a workspace from error to ready.
func (*WorkspaceService) Transition ¶
func (s *WorkspaceService) Transition(ctx context.Context, id string, to domain.WorkspaceStatus) error
Transition transitions a workspace to a new status.