Documentation
¶
Index ¶
- Variables
- func ProbeReady(ctx context.Context, info Info) error
- func ProcessAlive(pid int) bool
- func RemoveInfo(path string) error
- func Run(ctx context.Context, opts RunOptions) (retErr error)
- func WriteInfo(path string, info Info) error
- type DocumentMissingError
- type Host
- type Info
- type Lock
- type MarkdownDocument
- type ProbeOptions
- type QueryService
- type QueryServiceConfig
- type ReadyState
- type ReconcileConfig
- type ReconcileResult
- type ReviewDetailPayload
- type ReviewIssueDetail
- type ReviewIssueNotFoundError
- type ReviewWatchGit
- type ReviewWatchGitState
- type RunDetailPayload
- type RunJobCounts
- type RunLifecycleSettings
- type RunManager
- func (m *RunManager) ACPStallTotalsByMode() map[string]uint64
- func (m *RunManager) ActiveRunCount() int
- func (m *RunManager) ActiveRunCountsByMode() map[string]int
- func (m *RunManager) Cancel(ctx context.Context, runID string) error
- func (m *RunManager) Events(ctx context.Context, runID string, query apicore.RunEventPageQuery) (apicore.RunEventPage, error)
- func (m *RunManager) Get(ctx context.Context, runID string) (apicore.Run, error)
- func (m *RunManager) IncompleteRunCount() int
- func (m *RunManager) JournalSubmitDropTotals() (uint64, uint64)
- func (m *RunManager) List(ctx context.Context, query apicore.RunListQuery) ([]apicore.Run, error)
- func (m *RunManager) OpenStream(ctx context.Context, runID string, after apicore.StreamCursor) (apicore.RunStream, error)
- func (m *RunManager) OpenWorkspaceStream(ctx context.Context, workspaceRef string) (apicore.WorkspaceEventStream, error)
- func (m *RunManager) Purge(ctx context.Context, settings RunLifecycleSettings) (RunPurgeResult, error)
- func (m *RunManager) RunDetail(ctx context.Context, runID string) (apicore.RunDetailPayload, error)
- func (m *RunManager) Shutdown(ctx context.Context, force bool) error
- func (m *RunManager) Snapshot(ctx context.Context, runID string) (apicore.RunSnapshot, error)
- func (m *RunManager) StartExecRun(ctx context.Context, req apicore.ExecRequest) (apicore.Run, error)
- func (m *RunManager) StartReviewRun(ctx context.Context, workspaceRef string, workflowSlug string, round int, ...) (apicore.Run, error)
- func (m *RunManager) StartReviewWatch(ctx context.Context, workspaceRef string, workflowSlug string, ...) (apicore.Run, error)
- func (m *RunManager) StartTaskRun(ctx context.Context, workspaceRef string, workflowSlug string, ...) (apicore.Run, error)
- func (m *RunManager) TerminalTotalsByModeAndStatus() map[string]map[string]uint64
- func (m *RunManager) Transcript(ctx context.Context, runID string) (apicore.RunTranscript, error)
- type RunManagerConfig
- type RunMode
- type RunOptions
- type RunPurgeResult
- type RunRuntimeSummary
- type Service
- type ServiceConfig
- type StaleDocumentReferenceError
- type StartOptions
- type StartOutcome
- type StartResult
- type Status
- type TaskBoardPayload
- type TaskCard
- type TaskDetailPayload
- type TaskLane
- type WorkflowMemoryEntry
- type WorkflowMemoryIndex
- type WorkflowOverviewPayload
- type WorkflowSpecDocument
- type WorkflowTaskCounts
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDocumentMissing reports a canonical workflow document missing on disk. ErrDocumentMissing = errors.New("daemon: document missing") // ErrStaleDocumentReference reports an opaque file id that no longer resolves. ErrStaleDocumentReference = errors.New("daemon: stale document reference") // ErrReviewIssueNotFound reports a missing review issue within a known round. ErrReviewIssueNotFound = errors.New("daemon: review issue not found") )
var ErrAlreadyRunning = errors.New("daemon: already running")
Functions ¶
func ProbeReady ¶
ProbeReady verifies that one daemon info record points at a healthy transport.
func ProcessAlive ¶
ProcessAlive reports whether a process with pid is currently alive.
Types ¶
type DocumentMissingError ¶
DocumentMissingError reports a missing canonical workflow document.
func (DocumentMissingError) Error ¶
func (e DocumentMissingError) Error() string
func (DocumentMissingError) Is ¶
func (e DocumentMissingError) Is(target error) bool
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host owns one daemon bootstrap instance and its singleton lock.
func (*Host) Paths ¶
func (h *Host) Paths() productizeconfig.HomePaths
Paths returns the home-scoped daemon paths for this host.
type Info ¶
type Info struct {
PID int `json:"pid"`
Version string `json:"version,omitempty"`
SocketPath string `json:"socket_path,omitempty"`
StartedAt time.Time `json:"started_at"`
State ReadyState `json:"state"`
}
Info is the persisted daemon discovery record written to daemon.json.
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock owns the singleton daemon file lock.
func AcquireLock ¶
AcquireLock acquires the singleton daemon lock and records the current PID in the lock file.
type MarkdownDocument ¶
type MarkdownDocument struct {
ID string
Kind string
Title string
UpdatedAt time.Time
Markdown string
Metadata map[string]any
}
MarkdownDocument is the normalized daemon-side markdown payload.
type ProbeOptions ¶
ProbeOptions control readiness checks for an existing daemon instance.
type QueryService ¶
type QueryService interface {
WorkflowOverview(ctx context.Context, workspaceRef string, workflowSlug string) (WorkflowOverviewPayload, error)
TaskBoard(ctx context.Context, workspaceRef string, workflowSlug string) (TaskBoardPayload, error)
WorkflowSpec(ctx context.Context, workspaceRef string, workflowSlug string) (WorkflowSpecDocument, error)
WorkflowMemoryIndex(ctx context.Context, workspaceRef string, workflowSlug string) (WorkflowMemoryIndex, error)
WorkflowMemoryFile(
ctx context.Context,
workspaceRef string,
workflowSlug string,
fileID string,
) (MarkdownDocument, error)
TaskDetail(ctx context.Context, workspaceRef string, workflowSlug string, taskID string) (TaskDetailPayload, error)
ReviewDetail(
ctx context.Context,
workspaceRef string,
workflowSlug string,
round int,
issueRef string,
) (ReviewDetailPayload, error)
RunDetail(ctx context.Context, runID string) (RunDetailPayload, error)
}
QueryService exposes the daemon-side read-model assembly required by the web UI.
func NewQueryService ¶
func NewQueryService(cfg QueryServiceConfig) QueryService
NewQueryService constructs the daemon-side read-model query layer.
type QueryServiceConfig ¶
type QueryServiceConfig struct {
GlobalDB *globaldb.GlobalDB
RunManager *RunManager
}
QueryServiceConfig wires the daemon read-model service.
type ReadyState ¶
type ReadyState string
ReadyState is the persisted daemon readiness state.
const ( ReadyStateStarting ReadyState = "starting" ReadyStateReady ReadyState = "ready" ReadyStateStopped ReadyState = "stopped" )
type ReconcileConfig ¶
type ReconcileConfig struct {
HomePaths productizeconfig.HomePaths
Now func() time.Time
OpenGlobalDB func(context.Context, string) (*globaldb.GlobalDB, error)
OpenRunDB func(context.Context, string) (*rundb.RunDB, error)
}
ReconcileConfig controls startup crash reconciliation.
type ReconcileResult ¶
type ReconcileResult struct {
ReconciledRuns int
CrashEventAppended int
CrashEventFailures int
LastReconciledRunID string
}
ReconcileResult summarizes one startup reconciliation pass.
func ReconcileStartup ¶
func ReconcileStartup(ctx context.Context, cfg ReconcileConfig) (ReconcileResult, error)
ReconcileStartup marks interrupted runs as crashed before the daemon reports ready. Missing or corrupt per-run databases do not block readiness; their failure is folded into the durable global error summary instead.
type ReviewDetailPayload ¶
type ReviewDetailPayload struct {
Workspace apicore.Workspace
Workflow apicore.WorkflowSummary
Round apicore.ReviewRound
Issue ReviewIssueDetail
Document MarkdownDocument
RelatedRuns []apicore.Run
}
ReviewDetailPayload captures the daemon-side review issue detail read model.
type ReviewIssueDetail ¶
type ReviewIssueDetail struct {
ID string
IssueNumber int
Severity string
Status string
UpdatedAt time.Time
}
ReviewIssueDetail captures the detail metadata for one review issue.
type ReviewIssueNotFoundError ¶
ReviewIssueNotFoundError reports a missing issue inside a known review round.
func (ReviewIssueNotFoundError) Error ¶
func (e ReviewIssueNotFoundError) Error() string
func (ReviewIssueNotFoundError) Is ¶
func (e ReviewIssueNotFoundError) Is(target error) bool
type ReviewWatchGit ¶
type ReviewWatchGit interface {
State(ctx context.Context, workspaceRoot string) (ReviewWatchGitState, error)
Push(ctx context.Context, workspaceRoot string, remote string, branch string) error
}
ReviewWatchGit is the narrow git boundary used by daemon review-watch runs.
type ReviewWatchGitState ¶
type ReviewWatchGitState struct {
Branch string
HeadSHA string
UpstreamRemote string
UpstreamBranch string
Dirty bool
UnpushedCommits int
}
ReviewWatchGitState captures read-only repository state relevant to watch push safety.
type RunDetailPayload ¶
type RunDetailPayload struct {
Run apicore.Run
Snapshot apicore.RunSnapshot
JobCounts RunJobCounts
Runtime RunRuntimeSummary
Timeline []eventspkg.Event
ArtifactSync []rundb.ArtifactSyncRow
}
RunDetailPayload captures the daemon-side run detail read model.
type RunJobCounts ¶
type RunJobCounts struct {
Queued int
Running int
Retrying int
Completed int
Failed int
Canceled int
}
RunJobCounts summarizes per-status job counts for one run snapshot.
type RunLifecycleSettings ¶
type RunLifecycleSettings struct {
KeepTerminalDays int
KeepMax int
ShutdownDrainTimeout time.Duration
}
RunLifecycleSettings captures the daemon-owned retention and shutdown bounds resolved from the effective home-scoped config.
func LoadRunLifecycleSettings ¶
func LoadRunLifecycleSettings(ctx context.Context) (RunLifecycleSettings, string, error)
LoadRunLifecycleSettings reads the home-scoped config and resolves the daemon run lifecycle defaults required for retention and forced shutdown behavior.
type RunManager ¶
type RunManager struct {
// contains filtered or unexported fields
}
RunManager owns daemon-backed task, review, and exec runs.
func NewRunManager ¶
func NewRunManager(cfg RunManagerConfig) (*RunManager, error)
NewRunManager constructs a daemon-owned run manager.
func (*RunManager) ACPStallTotalsByMode ¶
func (m *RunManager) ACPStallTotalsByMode() map[string]uint64
ACPStallTotalsByMode reports daemon-lifetime ACP stall counts keyed by mode.
func (*RunManager) ActiveRunCount ¶
func (m *RunManager) ActiveRunCount() int
ActiveRunCount returns the number of runs still owned by the live daemon.
func (*RunManager) ActiveRunCountsByMode ¶
func (m *RunManager) ActiveRunCountsByMode() map[string]int
ActiveRunCountsByMode returns the current active-run breakdown by run mode.
func (*RunManager) Cancel ¶
func (m *RunManager) Cancel(ctx context.Context, runID string) error
Cancel requests cancellation for one active run.
func (*RunManager) Events ¶
func (m *RunManager) Events( ctx context.Context, runID string, query apicore.RunEventPageQuery, ) (apicore.RunEventPage, error)
Events returns persisted run events after the supplied cursor.
func (*RunManager) IncompleteRunCount ¶
func (m *RunManager) IncompleteRunCount() int
IncompleteRunCount reports how many runs this daemon has observed with sticky persisted integrity issues.
func (*RunManager) JournalSubmitDropTotals ¶
func (m *RunManager) JournalSubmitDropTotals() (uint64, uint64)
JournalSubmitDropTotals reports daemon-lifetime journal submit drop counts grouped by dropped event kind.
func (*RunManager) List ¶
func (m *RunManager) List(ctx context.Context, query apicore.RunListQuery) ([]apicore.Run, error)
List returns durable run summaries filtered by workspace, mode, or status.
func (*RunManager) OpenStream ¶
func (m *RunManager) OpenStream( ctx context.Context, runID string, after apicore.StreamCursor, ) (apicore.RunStream, error)
OpenStream returns a replay-plus-live run stream.
func (*RunManager) OpenWorkspaceStream ¶
func (m *RunManager) OpenWorkspaceStream( ctx context.Context, workspaceRef string, ) (apicore.WorkspaceEventStream, error)
func (*RunManager) Purge ¶
func (m *RunManager) Purge(ctx context.Context, settings RunLifecycleSettings) (RunPurgeResult, error)
Purge deletes terminal run directories and their durable index rows according to the configured oldest-first retention policy.
func (*RunManager) RunDetail ¶
func (m *RunManager) RunDetail(ctx context.Context, runID string) (apicore.RunDetailPayload, error)
RunDetail returns the richer browser-facing run detail payload.
func (*RunManager) Shutdown ¶
func (m *RunManager) Shutdown(ctx context.Context, force bool) error
Shutdown applies the daemon stop semantics for active runs. Without force it returns a conflict while active runs exist. With force it cancels every run and waits only up to the configured drain timeout for their terminal cleanup.
func (*RunManager) Snapshot ¶
func (m *RunManager) Snapshot(ctx context.Context, runID string) (apicore.RunSnapshot, error)
Snapshot returns the dense attach snapshot for one run.
func (*RunManager) StartExecRun ¶
func (m *RunManager) StartExecRun( ctx context.Context, req apicore.ExecRequest, ) (apicore.Run, error)
StartExecRun starts one daemon-owned exec run.
func (*RunManager) StartReviewRun ¶
func (m *RunManager) StartReviewRun( ctx context.Context, workspaceRef string, workflowSlug string, round int, req apicore.ReviewRunRequest, ) (apicore.Run, error)
StartReviewRun starts one daemon-owned review-fix run.
func (*RunManager) StartReviewWatch ¶
func (m *RunManager) StartReviewWatch( ctx context.Context, workspaceRef string, workflowSlug string, req apicore.ReviewWatchRequest, ) (apicore.Run, error)
StartReviewWatch starts one daemon-owned review-watch parent run.
func (*RunManager) StartTaskRun ¶
func (m *RunManager) StartTaskRun( ctx context.Context, workspaceRef string, workflowSlug string, req apicore.TaskRunRequest, ) (apicore.Run, error)
StartTaskRun starts one daemon-owned task workflow run.
func (*RunManager) TerminalTotalsByModeAndStatus ¶
func (m *RunManager) TerminalTotalsByModeAndStatus() map[string]map[string]uint64
TerminalTotalsByModeAndStatus reports daemon-lifetime terminal outcome totals keyed by mode then status.
func (*RunManager) Transcript ¶
func (m *RunManager) Transcript(ctx context.Context, runID string) (apicore.RunTranscript, error)
Transcript returns the canonical structured transcript for one run.
type RunManagerConfig ¶
type RunManagerConfig struct {
GlobalDB *globaldb.GlobalDB
LifecycleContext context.Context
ShutdownDrainTimeout time.Duration
Now func() time.Time
BuildRunID func(*model.RuntimeConfig) (string, error)
OpenRunScope func(context.Context, *model.RuntimeConfig, model.OpenRunScopeOptions) (model.RunScope, error)
Prepare func(context.Context, *model.RuntimeConfig, model.RunScope) (*model.SolvePreparation, error)
Execute func(context.Context, *model.SolvePreparation, *model.RuntimeConfig) error
ExecuteExec func(context.Context, *model.RuntimeConfig, model.RunScope) error
OpenRunDB func(context.Context, string) (*rundb.RunDB, error)
LoadProjectConfig func(context.Context, string) (workspacecfg.ProjectConfig, error)
ReviewProviderRegistry reviewProviderRegistryFactory
ReviewWatchGit ReviewWatchGit
WatcherDebounce time.Duration
RunDBCacheTTL time.Duration
LookupWorkflowSlugs func(context.Context, []string) (map[string]string, error)
GetWorkflow func(context.Context, string) (globaldb.Workflow, error)
}
RunManagerConfig wires the daemon-owned run manager dependencies.
type RunOptions ¶
RunOptions control the long-lived daemon host process.
type RunPurgeResult ¶
type RunPurgeResult struct {
PurgedRunIDs []string
}
RunPurgeResult captures the terminal runs removed by one purge operation.
func PurgeTerminalRuns ¶
func PurgeTerminalRuns( ctx context.Context, db *globaldb.GlobalDB, settings RunLifecycleSettings, ) (RunPurgeResult, error)
PurgeTerminalRuns deletes terminal run directories and durable index rows using the configured retention policy without requiring a live run manager.
type RunRuntimeSummary ¶
type RunRuntimeSummary struct {
IDEs []string
Models []string
ReasoningEfforts []string
AccessModes []string
PresentationModes []string
}
RunRuntimeSummary captures the distinct runtime settings observed in the run snapshot.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements the shared transport-facing daemon control surface.
func NewService ¶
func NewService(cfg ServiceConfig) *Service
NewService constructs the daemon-wide control service.
func (*Service) Metrics ¶
Metrics returns the minimal daemon metrics required by the current transport contract and lifecycle task set.
type ServiceConfig ¶
type ServiceConfig struct {
Host *Host
GlobalDB *globaldb.GlobalDB
RunManager *RunManager
RequestStop func(context.Context) error
ReconcileResult ReconcileResult
LifecycleSettings RunLifecycleSettings
Now func() time.Time
}
ServiceConfig wires the daemon-wide status, health, metrics, and stop surface exposed to transports.
type StaleDocumentReferenceError ¶
StaleDocumentReferenceError reports an opaque memory file identifier that no longer resolves.
func (StaleDocumentReferenceError) Error ¶
func (e StaleDocumentReferenceError) Error() string
func (StaleDocumentReferenceError) Is ¶
func (e StaleDocumentReferenceError) Is(target error) bool
type StartOptions ¶
type StartOptions struct {
HomePaths productizeconfig.HomePaths
Version string
PID int
Now func() time.Time
ProcessAlive func(int) bool
Healthy func(context.Context, Info) error
Prepare func(context.Context, *Host) error
}
StartOptions control daemon bootstrap behavior.
type StartOutcome ¶
type StartOutcome string
StartOutcome describes the bootstrap result for one daemon start attempt.
const ( StartOutcomeStarted StartOutcome = "started" StartOutcomeAlreadyRunning StartOutcome = "already_running" )
type StartResult ¶
type StartResult struct {
Outcome StartOutcome
Paths productizeconfig.HomePaths
Info Info
Host *Host
}
StartResult captures the result of a daemon bootstrap attempt.
func Start ¶
func Start(ctx context.Context, opts StartOptions) (_ StartResult, retErr error)
Start bootstraps the daemon home layout, acquires singleton ownership, and marks readiness.
type Status ¶
type Status struct {
Paths productizeconfig.HomePaths
State ReadyState
Healthy bool
Info *Info
}
Status captures the last known daemon readiness view.
func QueryStatus ¶
func QueryStatus(ctx context.Context, paths productizeconfig.HomePaths, opts ProbeOptions) (Status, error)
QueryStatus reports the current daemon readiness without guessing from the filesystem layout.
type TaskBoardPayload ¶
type TaskBoardPayload struct {
Workspace apicore.Workspace
Workflow apicore.WorkflowSummary
TaskCounts WorkflowTaskCounts
Lanes []TaskLane
}
TaskBoardPayload captures the kanban/list task read model.
type TaskCard ¶
type TaskCard struct {
TaskNumber int
TaskID string
Title string
Status string
Type string
DependsOn []string
UpdatedAt time.Time
}
TaskCard is the transport-neutral task row used by workflow and detail views.
type TaskDetailPayload ¶
type TaskDetailPayload struct {
Workspace apicore.Workspace
Workflow apicore.WorkflowSummary
Task TaskCard
Document MarkdownDocument
MemoryEntries []WorkflowMemoryEntry
RelatedRuns []apicore.Run
LiveTailAvailable bool
}
TaskDetailPayload captures the daemon-side task detail read model.
type WorkflowMemoryEntry ¶
type WorkflowMemoryEntry struct {
FileID string
DisplayPath string
Kind string
Title string
SizeBytes int64
UpdatedAt time.Time
}
WorkflowMemoryEntry describes one memory file without exposing a raw source path.
type WorkflowMemoryIndex ¶
type WorkflowMemoryIndex struct {
Workspace apicore.Workspace
Workflow apicore.WorkflowSummary
Entries []WorkflowMemoryEntry
}
WorkflowMemoryIndex lists memory files using opaque IDs.
type WorkflowOverviewPayload ¶
type WorkflowOverviewPayload struct {
Workspace apicore.Workspace
Workflow apicore.WorkflowSummary
TaskCounts WorkflowTaskCounts
LatestReview *apicore.ReviewSummary
RecentRuns []apicore.Run
ArchiveEligible bool
ArchiveReason string
}
WorkflowOverviewPayload is the daemon-side workflow summary aggregate.
type WorkflowSpecDocument ¶
type WorkflowSpecDocument struct {
Workspace apicore.Workspace
Workflow apicore.WorkflowSummary
PRD *MarkdownDocument
TechSpec *MarkdownDocument
ADRs []MarkdownDocument
}
WorkflowSpecDocument captures the canonical workflow spec artifacts.
type WorkflowTaskCounts ¶
WorkflowTaskCounts summarizes task state for one workflow.
Source Files
¶
- boot.go
- extension_bridge.go
- host.go
- info.go
- lock.go
- process_unix.go
- query_documents.go
- query_kinds.go
- query_models.go
- query_service.go
- reconcile.go
- review_exec_transport_service.go
- review_watch.go
- review_watch_git.go
- review_watch_hooks.go
- run_integrity.go
- run_manager.go
- run_snapshot.go
- run_snapshot_compact.go
- run_transcript.go
- runtime.go
- service.go
- shutdown.go
- signal_unix.go
- sync_transport_service.go
- task_transport_service.go
- transport_mappers.go
- watchers.go
- workflow_sync.go
- workspace_events.go
- workspace_refresh.go
- workspace_transport_service.go