Documentation
¶
Overview ¶
Package prfix materializes PR maintenance as ordinary workflows. Actions in this package implement individual operations; only YAML chooses execution order.
Index ¶
- Constants
- func BuiltinAdapters(role string) map[string]Adapter
- func LoadAdapters(path string) (map[string]Adapter, error)
- type Account
- type ActionInput
- type ActionOutput
- type Adapter
- type AudienceReport
- type Authorization
- type CICheck
- type CIClassification
- type CIExecution
- type CIObservation
- type CIProof
- type CIReport
- type CIRerunVerifier
- type CIVerifier
- type Candidate
- type Check
- type ChecklistItem
- type Cleanup
- type CommitPolicyHandoff
- type Configuration
- type DispatchDiagnostic
- type DispatchExecution
- type DispatchResponse
- type FeedbackSource
- type FileChange
- type Finding
- type GitHub
- func (g *GitHub) Capture(ctx context.Context, id Identity) (PREvidence, error)
- func (g *GitHub) Execute(ctx context.Context, i Intent) (Receipt, error)
- func (g *GitHub) InspectReply(ctx context.Context, i Intent, receipt Receipt) (ReplyObservation, error)
- func (g *GitHub) InspectReviewRequest(ctx context.Context, i Intent) (ReviewRequestObservation, error)
- func (g *GitHub) MergeReady(ctx context.Context, id Identity, head string) (MergeProof, error)
- func (g *GitHub) ObserveCI(ctx context.Context, id Identity, head string) (CIObservation, error)
- func (g *GitHub) PullRequestNumbers(ctx context.Context, id Identity) ([]string, error)
- func (g *GitHub) Reconcile(ctx context.Context, i Intent) (string, Receipt, error)
- func (g *GitHub) VerifyCI(ctx context.Context, id Identity, head string, classes []CIClassification, ...) (CIProof, error)
- func (g *GitHub) VerifyRerun(ctx context.Context, i Intent) error
- type Identity
- type Intent
- type IntentRef
- type Invocation
- type Ledger
- func (l *Ledger) Active(ctx context.Context, pr string) (string, error)
- func (l *Ledger) Admission(ctx context.Context, run, plan, fingerprint, requested string) (string, error)
- func (l *Ledger) Close() error
- func (l *Ledger) Continue(ctx context.Context, run string, a Authorization, cycles int) (int, error)
- func (l *Ledger) Deadline(ctx context.Context, run, head string, now time.Time, timeout time.Duration) (time.Time, error)
- func (l *Ledger) Execution(ctx context.Context, run, request, plan, engine string) error
- func (l *Ledger) Extend(ctx context.Context, run, head string, extension time.Duration, maximum int) (time.Time, bool, error)
- func (l *Ledger) Intent(ctx context.Context, run, id string) (Intent, error)
- func (l *Ledger) LatestExecution(ctx context.Context, run string) (string, string, error)
- func (l *Ledger) Plan(ctx context.Context, id string) (Plan, error)
- func (l *Ledger) PrepareIntent(ctx context.Context, p Plan, intent Intent, source string) error
- func (l *Ledger) Reserve(ctx context.Context, run, kind, scope, operation, reason string) error
- func (l *Ledger) SavePlan(ctx context.Context, p Plan) (string, error)
- func (l *Ledger) Started(ctx context.Context, run, head string) (time.Time, error)
- type Limits
- type MergeProof
- type MergeReadiness
- type Occurrence
- type PREvidence
- type PRMetadata
- type PRRef
- type Pass
- type Plan
- type PreferenceDecision
- type PrepareRequest
- type Prepared
- type Provider
- type PullRequestInventory
- type Receipt
- type ReplyDisposition
- type ReplyInspector
- type ReplyObligation
- type ReplyObservation
- type ReplyReplacement
- type ReplyResponse
- type Report
- type Resolved
- type ReviewRequestDisposition
- type ReviewRequestInspector
- type ReviewRequestObservation
- type Runtime
- type ScopeReport
- type Selection
- type Snapshot
- type SplitBoundary
Constants ¶
const Implementation = "prfix-v13-dk-workflows-5.2.0"
const Version = "5.2.0"
Variables ¶
This section is empty.
Functions ¶
func BuiltinAdapters ¶
Types ¶
type ActionInput ¶
type ActionInput struct {
Agent string `json:"agent,omitempty"`
Receipt *Receipt `json:"receipt,omitempty"`
Plan string `json:"plan"`
Occurrence string `json:"occurrence,omitempty"`
Claim string `json:"claim,omitempty"`
Cycle string `json:"cycle,omitempty"`
Attempt int `json:"attempt,omitempty"`
Round int `json:"round,omitempty"`
Payload string `json:"payload,omitempty"`
Kind string `json:"kind,omitempty"`
Intent string `json:"intent,omitempty"`
}
type ActionOutput ¶
type ActionOutput struct {
Agent string `json:"agent,omitempty"`
TaskInput map[string]any `json:"task_input,omitempty"`
Round int `json:"round"`
Receipt *Receipt `json:"receipt,omitempty"`
Claim string `json:"claim"`
Invoke bool `json:"invoke"`
Settled bool `json:"settled"`
Recheck bool `json:"recheck"`
Cycle string `json:"cycle"`
Prompt string `json:"prompt"`
Complete bool `json:"complete"`
Ready bool `json:"ready"`
Report string `json:"report"`
Items []IntentRef `json:"items"`
Repair bool `json:"repair"`
Deferred bool `json:"deferred"`
State string `json:"state"`
}
type Adapter ¶
type Adapter struct {
Writes []string `json:"writes,omitempty" yaml:"writes,omitempty"`
Reads []string `json:"reads,omitempty" yaml:"reads,omitempty"`
Identity string `json:"identity" yaml:"identity"`
Version string `json:"version" yaml:"version"`
Kind string `json:"kind" yaml:"kind"`
Procedure [][]Pass `json:"procedure" yaml:"procedure"`
Controls []string `json:"controls" yaml:"controls"`
Options []string `json:"options" yaml:"options"`
Resources []string `json:"resources" yaml:"resources"`
History bool `json:"history" yaml:"history"`
HeadSensitive bool `json:"head_sensitive" yaml:"head-sensitive"`
Cacheable bool `json:"cacheable" yaml:"cacheable"`
}
type AudienceReport ¶
type Authorization ¶
type Authorization struct {
RequestID string `json:"request_id"`
Instruction string `json:"instruction"`
Source string `json:"source"`
}
func (Authorization) Validate ¶
func (a Authorization) Validate() error
type CIClassification ¶
type CIClassification struct {
CheckID string `json:"check_id"`
RunID string `json:"run_id"`
JobID string `json:"job_id"`
Attempt int `json:"attempt"`
Kind string `json:"kind"`
Workflow string `json:"workflow"`
Job string `json:"job"`
Test string `json:"test,omitempty"`
Signature string `json:"signature,omitempty"`
Issue string `json:"issue,omitempty"`
Rule string `json:"rule,omitempty"`
}
type CIExecution ¶
This small provenance pin distinguishes a live selected CI observation from the same checkpoint reused after an interrupted execution.
type CIObservation ¶
type CIObservation struct {
Execution *CIExecution `json:"execution,omitempty"`
Verified []CIProof `json:"verified,omitempty"`
Logs map[string]string `json:"logs,omitempty"`
Head string `json:"head"`
Checks []CICheck `json:"checks"`
Evidence string `json:"evidence"`
}
func (CIObservation) Success ¶
func (c CIObservation) Success() bool
type CIReport ¶
type CIReport struct {
RerunReason string `json:"rerun_reason,omitempty"`
Repair bool `json:"repair,omitempty"`
RepairReason string `json:"repair_reason,omitempty"`
Classifications []CIClassification `json:"classifications,omitempty"`
Head string `json:"head"`
Status string `json:"status"`
Checks []string `json:"checks"`
Exceptions []Finding `json:"exceptions"`
Evidence []string `json:"evidence"`
}
type CIRerunVerifier ¶
Reruns are guarded before dispatch, not merely recognized after the write.
type CIVerifier ¶
type ChecklistItem ¶
type Cleanup ¶
type Cleanup struct {
Outcome string `json:"outcome"`
ReviewedHead string `json:"reviewed_head"`
FinalHead string `json:"final_head"`
FinalTree string `json:"final_tree"`
Commits map[string]string `json:"commits"`
BoundaryReasons []string `json:"boundary_reasons"`
RecoveryRef string `json:"recovery_ref"`
Validation []string `json:"validation"`
Receipt string `json:"receipt,omitempty"`
}
type CommitPolicyHandoff ¶
type CommitPolicyHandoff struct {
Prompt *string `json:"policy_prompt"`
Configuration any `json:"configuration"`
Context string `json:"context"`
Providers []string `json:"providers"`
}
A handoff contains the actual accepted provider instructions and immutable context, resource and engine references, not just a configured identity.
type Configuration ¶
type DispatchDiagnostic ¶
type DispatchExecution ¶
type DispatchExecution struct {
Intent Intent `json:"intent"`
CreatedAt string `json:"created_at"`
Dispatched string `json:"dispatch_intent_at"`
Action workflows.ActionContext `json:"action"`
}
func (*DispatchExecution) UnmarshalJSON ¶
func (execution *DispatchExecution) UnmarshalJSON(data []byte) error
type DispatchResponse ¶
type DispatchResponse struct {
Intent Intent `json:"intent"`
Response map[string]any `json:"response"`
}
func (*DispatchResponse) UnmarshalJSON ¶
func (r *DispatchResponse) UnmarshalJSON(data []byte) error
type FeedbackSource ¶
type FeedbackSource struct {
Kind string `json:"kind"`
ID string `json:"id"`
URL string `json:"url"`
ThreadID string `json:"thread_id,omitempty"`
}
The feedback being answered can differ from the inline root used for routing.
type FileChange ¶
type GitHub ¶
type GitHub struct{ Root string }
func (*GitHub) InspectReply ¶
func (*GitHub) InspectReviewRequest ¶
func (*GitHub) MergeReady ¶
func (*GitHub) PullRequestNumbers ¶
type Identity ¶
type Identity struct {
URL string `json:"url"`
Repository string `json:"repository"`
Host string `json:"host"`
Owner string `json:"owner"`
Name string `json:"name"`
Number int `json:"number"`
}
func ParseIdentity ¶
type Intent ¶
type Intent struct {
Source *FeedbackSource `json:"source,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Replaces *ReplyReplacement `json:"replaces,omitempty"`
CreatedHead string `json:"created_head,omitempty"`
ActorID int64 `json:"actor_id,omitempty"`
Before map[string]any `json:"before,omitempty"`
Discussion string `json:"discussion,omitempty"`
ID string `json:"id"`
Run string `json:"run"`
Kind string `json:"kind"`
PR Identity `json:"pr"`
Head string `json:"head"`
Lease string `json:"lease"`
Target string `json:"target"`
Branch string `json:"branch"`
HeadRepository string `json:"head_repository"`
Payload map[string]any `json:"payload"`
Authorization Authorization `json:"authorization"`
Sources []string `json:"sources"`
AudienceClaim string `json:"audience_claim,omitempty"`
}
func (Intent) Fingerprint ¶
type Invocation ¶
type Invocation struct {
Skill string `json:"skill,omitempty" yaml:"skill,omitempty"`
Instructions string `json:"instructions,omitempty" yaml:"instructions,omitempty"`
Options map[string]any `json:"options,omitempty" yaml:"options,omitempty"`
Required *bool `json:"required,omitempty" yaml:"required,omitempty"`
Agent map[string]any `json:"agent,omitempty" yaml:"agent,omitempty"`
}
func (Invocation) IsRequired ¶
func (i Invocation) IsRequired() bool
type Ledger ¶
type Ledger struct {
Root string
// contains filtered or unexported fields
}
func OpenLedger ¶
func (*Ledger) LatestExecution ¶
func (*Ledger) PrepareIntent ¶
type Limits ¶
type MergeProof ¶
type MergeReadiness ¶
type Occurrence ¶
type Occurrence struct {
InheritedResources []string `json:"inherited_resources,omitempty"`
InheritedInstructions []string `json:"inherited_invocation_instructions,omitempty"`
PolicyProviders []string `json:"policy_providers,omitempty"`
ID string `json:"id"`
Kind string `json:"kind"`
Call Resolved `json:"call"`
Adapter Adapter `json:"adapter"`
Pass Pass `json:"pass"`
Required bool `json:"required"`
Review bool `json:"review"`
History bool `json:"history"`
HeadSensitive bool `json:"head_sensitive"`
Cacheable bool `json:"cacheable"`
Checklist []ChecklistItem `json:"checklist"`
MaxChecks int `json:"max_checks"`
}
type PREvidence ¶
type PREvidence struct {
Metadata PRMetadata `json:"metadata"`
Viewer string `json:"viewer"`
ViewerID int64 `json:"viewer_id"`
Comments []map[string]any `json:"comments"`
Reviews []map[string]any `json:"reviews"`
Inline []map[string]any `json:"inline"`
Threads []map[string]any `json:"threads"`
}
func (*PREvidence) UnmarshalJSON ¶
func (e *PREvidence) UnmarshalJSON(data []byte) error
type PRMetadata ¶
type PRMetadata struct {
URL string `json:"html_url"`
NodeID string `json:"node_id"`
Number int `json:"number"`
State string `json:"state"`
Draft bool `json:"draft"`
Merged bool `json:"merged"`
MergeCommit string `json:"merge_commit_sha"`
MergedBy struct {
ID int64 `json:"id"`
} `json:"merged_by"`
Title string `json:"title"`
Body string `json:"body"`
Updated string `json:"updated_at"`
User struct {
ID int64 `json:"id"`
Login string `json:"login"`
} `json:"user"`
Head PRRef `json:"head"`
Base PRRef `json:"base"`
MergeableState string `json:"mergeable_state"`
}
type Plan ¶
type Plan struct {
Version string `json:"version"`
LogicalRun string `json:"logical_run"`
Identity Identity `json:"identity"`
Selection Selection `json:"selection"`
Snapshot Snapshot `json:"snapshot"`
Instructions string `json:"instructions"`
MaintainOther *Authorization `json:"maintain_other,omitempty"`
Authorizations map[string]Authorization `json:"authorizations"`
Roles json.RawMessage `json:"roles"`
Occurrences []Occurrence `json:"occurrences"`
Groups map[string][][]string `json:"groups"`
Omitted []string `json:"omitted"`
Sources map[string]string `json:"sources"`
Options map[string]any `json:"options"`
Upstream string `json:"upstream"`
Adapters map[string]Adapter `json:"adapters"`
ConfigPath string `json:"config_path"`
Ref string `json:"ref"`
Fingerprint string `json:"fingerprint"`
}
func (Plan) Occurrence ¶
func (p Plan) Occurrence(id string) (Occurrence, error)
type PreferenceDecision ¶
type PrepareRequest ¶
type PrepareRequest struct {
Resume bool
RequestID string
Capabilities func(string) (workflows.ProviderCapabilities, error)
PR string
Run string
Instructions string
Upstream string
Options map[string]any
Adapters map[string]Adapter
Role string
Config clirunner.Config
ConfigPath string
MaintainOther *Authorization
Authorizations map[string]Authorization
}
func ResumeRequest ¶
func ResumeRequest(p Plan, cfg clirunner.Config) PrepareRequest
ResumeRequest rebuilds preparation inputs without importing plugin histories or granting permissions. The caller may apply explicit current invocation edits.
type Prepared ¶
type Prepared struct {
LogicalRun string `json:"logical_run"`
Workflow string `json:"workflow"`
Plan string `json:"plan"`
Roles json.RawMessage `json:"roles"`
Inputs map[string]any `json:"inputs"`
RequestID string `json:"request_id"`
Omitted []string `json:"omitted"`
EngineLimits map[string]int `json:"engine_limits"`
Warnings []string `json:"warnings"`
}
type Provider ¶
type Provider interface {
Capture(context.Context, Identity) (PREvidence, error)
ObserveCI(context.Context, Identity, string) (CIObservation, error)
Execute(context.Context, Intent) (Receipt, error)
Reconcile(context.Context, Intent) (string, Receipt, error)
}
Provider methods perform one observation or one external operation. They must never decide which workflow stage runs next.
type PullRequestInventory ¶
type PullRequestInventory interface {
PullRequestNumbers(context.Context, Identity) ([]string, error)
}
PullRequestInventory supplies a complete private baseline before split writes.
type Receipt ¶
type Receipt struct {
ID string `json:"id"`
Kind string `json:"kind"`
PR string `json:"pr"`
Head string `json:"head"`
Result map[string]any `json:"result"`
Evidence []string `json:"evidence"`
}
func (*Receipt) UnmarshalJSON ¶
type ReplyDisposition ¶
type ReplyInspector ¶
type ReplyObligation ¶
type ReplyObservation ¶
type ReplyObservation struct {
Intent Intent `json:"intent"`
Receipt Receipt `json:"receipt"`
PR PREvidence `json:"pr"`
Original map[string]any `json:"original"`
Status string `json:"status"`
}
func (ReplyObservation) Fingerprint ¶
func (o ReplyObservation) Fingerprint() string
func (*ReplyObservation) UnmarshalJSON ¶
func (o *ReplyObservation) UnmarshalJSON(b []byte) error
type ReplyReplacement ¶
type ReplyReplacement struct {
Run string `json:"run"`
ID string `json:"id"`
Inspection string `json:"inspection"`
Observation string `json:"observation"`
Decision string `json:"decision"`
Reason string `json:"reason"`
Sources []string `json:"sources"`
Authorization Authorization `json:"authorization"`
}
A replacement is a new, separately authorized effect. Its reassessment is bound to an immutable observation; the historical intent/receipt stay intact.
type ReplyResponse ¶
type Report ¶
type Report struct {
ReplyDisposition *ReplyDisposition `json:"reply_disposition,omitempty"`
ReviewRequestDisposition *ReviewRequestDisposition `json:"review_request_disposition,omitempty"`
PolicyPrompt string `json:"policy_prompt,omitempty"`
ReplyObligations []ReplyObligation `json:"reply_obligations,omitempty"`
Responses []ReplyResponse `json:"responses,omitempty"`
Audience *AudienceReport `json:"audience,omitempty"`
Scope *ScopeReport `json:"scope,omitempty"`
Changes []FileChange `json:"changes,omitempty"`
Deliverables map[string]string `json:"deliverables,omitempty"`
PreferenceDecisions []PreferenceDecision `json:"preference_decisions,omitempty"`
CommitMessage string `json:"commit_message,omitempty"`
Complete bool `json:"complete"`
Findings []Finding `json:"findings"`
Checklist []Check `json:"checklist"`
Evidence []string `json:"evidence"`
Blockers []string `json:"blockers"`
Operations []Intent `json:"operations,omitempty"`
NoReply []Finding `json:"no_reply,omitempty"`
Cleanup *Cleanup `json:"cleanup,omitempty"`
CI *CIReport `json:"ci,omitempty"`
}
type Resolved ¶
type Resolved struct {
Invocation Invocation `json:"invocation"`
Configuration *Configuration `json:"configuration"`
}
type ReviewRequestInspector ¶
type ReviewRequestInspector interface {
InspectReviewRequest(context.Context, Intent) (ReviewRequestObservation, error)
}
type ReviewRequestObservation ¶
type ReviewRequestObservation struct {
Intent Intent `json:"intent"`
PR PREvidence `json:"pr"`
Requested map[string]any `json:"requested"`
Timeline []map[string]any `json:"timeline"`
Dispatch *DispatchResponse `json:"dispatch,omitempty"`
Execution *DispatchExecution `json:"execution"`
HistoricalFailure *DispatchDiagnostic `json:"historical_failure"`
ReconciliationErrors []DispatchDiagnostic `json:"reconciliation_errors"`
}
Inspection establishes current context, never whether the historical POST reached GitHub. Timeline events and reviews cannot prove delivery identity.
func (ReviewRequestObservation) Fingerprint ¶
func (o ReviewRequestObservation) Fingerprint() string
func (*ReviewRequestObservation) UnmarshalJSON ¶
func (o *ReviewRequestObservation) UnmarshalJSON(b []byte) error
type Runtime ¶
type Runtime struct {
BeforeCheckpoint func(string, ActionOutput) error
Root string
Store *workflows.SQLiteStore
Workers *workflows.WorkerManager
Provider Provider
Now func() time.Time
PollInterval time.Duration
// contains filtered or unexported fields
}
type ScopeReport ¶
type ScopeReport struct {
AddedLines int `json:"added_lines"`
Threshold int `json:"threshold"`
EvacuateMode string `json:"evacuate_unrelated"`
RelatedMode string `json:"split_related"`
Enabled bool `json:"enabled"`
Assessment string `json:"assessment"`
Boundaries []SplitBoundary `json:"boundaries"`
Evidence []string `json:"evidence"`
}
type Selection ¶
type Selection struct {
Invocation Invocation `json:"invocation"`
Config Configuration `json:"config"`
Tasks [][]Resolved `json:"tasks"`
Finalizers [][]Resolved `json:"finalizers"`
Hooks map[string][][]Resolved `json:"hooks"`
Children map[string]map[string][][]Resolved `json:"children"`
Accounts []Account `json:"accounts"`
Preferences map[string]any `json:"preferences"`
Settings map[string]any `json:"settings"`
}
type Snapshot ¶
type Snapshot struct {
RepositoryInstructions map[string]string `json:"repository_instruction_resources"`
CompletedEffects []string `json:"completed_effects,omitempty"`
ResourceDigests map[string]string `json:"resource_digests"`
RoleDigests map[string]string `json:"role_digests"`
ReviewPreferences string `json:"review_preferences"`
ImplementationPreferences string `json:"implementation_preferences"`
Identity Identity `json:"identity"`
Author string `json:"author"`
Viewer string `json:"viewer"`
HeadRepository string `json:"head_repository"`
HeadBranch string `json:"head_branch"`
TargetBranch string `json:"target_branch"`
Target string `json:"target"`
Base string `json:"base"`
Head string `json:"head"`
LocalHead string `json:"local_head"`
TargetTree string `json:"target_tree"`
BaseTree string `json:"base_tree"`
HeadTree string `json:"head_tree"`
LocalTree string `json:"local_tree"`
Diff string `json:"diff"`
History string `json:"history"`
Discussion string `json:"discussion"`
Decisions string `json:"decisions"`
Instructions string `json:"instructions"`
Settings string `json:"settings"`
TaskSettings string `json:"task_settings,omitempty"`
Resources string `json:"resources"`
Paths []string `json:"paths"`
Evidence string `json:"evidence"`
Open bool `json:"open"`
Draft bool `json:"draft"`
}
func (Snapshot) Fingerprint ¶
type SplitBoundary ¶
Source Files
¶
- actions.go
- adapters.go
- agent_tasks.go
- capture.go
- ci.go
- ci_controls.go
- ci_freshness.go
- ci_inventory.go
- claims.go
- commit_policy.go
- completion.go
- discussion.go
- dispatch_diagnostics.go
- flake_issue.go
- github_numbers.go
- io.go
- ledger.go
- legacy_workflows.go
- obligations.go
- prepare.go
- provider.go
- publication.go
- publication_lock.go
- replacement.go
- reply_disposition.go
- reply_identity.go
- reply_recovery.go
- reply_source.go
- report_limits.go
- resources.go
- review_request.go
- scope.go
- source.go
- types.go
- workers.go