ticket

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultArchivedTicketPage    = 1
	DefaultArchivedTicketPerPage = 20
	MaxArchivedTicketPerPage     = 100
)

Variables

View Source
var (
	ErrProjectNotFound       = errors.New("project not found")
	ErrProjectRepoNotFound   = errors.New("project repo not found")
	ErrRepoScopeRequired     = errors.New("explicit repo scope is required when a project has multiple repos")
	ErrTicketNotFound        = errors.New("ticket not found")
	ErrTicketConflict        = errors.New("ticket identifier already exists in project")
	ErrStatusNotFound        = errors.New("ticket status not found")
	ErrWorkflowNotFound      = errors.New("workflow not found")
	ErrStatusNotAllowed      = errors.New("ticket status is not allowed by the workflow finish set")
	ErrParentTicketNotFound  = errors.New("parent ticket not found")
	ErrTargetMachineNotFound = errors.New("target machine not found in project organization")
	ErrDependencyNotFound    = errors.New("ticket dependency not found")
	ErrDependencyConflict    = errors.New("ticket dependency already exists")
	ErrCommentNotFound       = errors.New("ticket comment not found")
	ErrExternalLinkNotFound  = errors.New("ticket external link not found")
	ErrExternalLinkConflict  = errors.New("ticket external link already exists")
	ErrInvalidDependency     = errors.New("invalid ticket dependency")
	ErrRetryResumeConflict   = errors.New("ticket retry is not paused for repeated stalls")
)

Functions

This section is empty.

Types

type AddCommentInput

type AddCommentInput struct {
	TicketID  uuid.UUID
	Body      string
	CreatedBy string
}

type AddDependencyInput

type AddDependencyInput struct {
	TicketID       uuid.UUID
	TargetTicketID uuid.UUID
	Type           DependencyType
}

type AddExternalLinkInput

type AddExternalLinkInput struct {
	TicketID   uuid.UUID
	LinkType   ExternalLinkType
	URL        string
	ExternalID string
	Title      string
	Status     string
	Relation   ExternalLinkRelation
}

type AppliedUsage

type AppliedUsage struct {
	InputTokens  int64   `json:"input_tokens"`
	OutputTokens int64   `json:"output_tokens"`
	CostUSD      float64 `json:"cost_usd"`
	CostSource   string  `json:"cost_source"`
}

type ArchivedListInput

type ArchivedListInput struct {
	ProjectID uuid.UUID
	Page      int
	PerPage   int
}

func ParseArchivedListInput

func ParseArchivedListInput(projectID uuid.UUID, raw ArchivedListRawInput) (ArchivedListInput, error)

type ArchivedListRawInput

type ArchivedListRawInput struct {
	Page    string
	PerPage string
}

type ArchivedListResult

type ArchivedListResult struct {
	Tickets []Ticket
	Total   int
	Page    int
	PerPage int
}

type Comment

type Comment struct {
	ID           uuid.UUID  `json:"id"`
	TicketID     uuid.UUID  `json:"ticket_id"`
	BodyMarkdown string     `json:"body_markdown"`
	CreatedBy    string     `json:"created_by"`
	CreatedAt    time.Time  `json:"created_at"`
	UpdatedAt    time.Time  `json:"updated_at"`
	EditedAt     *time.Time `json:"edited_at,omitempty"`
	EditCount    int        `json:"edit_count"`
	LastEditedBy *string    `json:"last_edited_by,omitempty"`
	IsDeleted    bool       `json:"is_deleted"`
	DeletedAt    *time.Time `json:"deleted_at,omitempty"`
	DeletedBy    *string    `json:"deleted_by,omitempty"`
}

type CommentRevision

type CommentRevision struct {
	ID             uuid.UUID `json:"id"`
	CommentID      uuid.UUID `json:"comment_id"`
	RevisionNumber int       `json:"revision_number"`
	BodyMarkdown   string    `json:"body_markdown"`
	EditedBy       string    `json:"edited_by"`
	EditedAt       time.Time `json:"edited_at"`
	EditReason     *string   `json:"edit_reason,omitempty"`
}

type CreateInput

type CreateInput struct {
	ProjectID       uuid.UUID
	Title           string
	Description     string
	StatusID        *uuid.UUID
	Archived        bool
	Priority        *Priority
	Type            Type
	WorkflowID      *uuid.UUID
	TargetMachineID *uuid.UUID
	CreatedBy       string
	ParentTicketID  *uuid.UUID
	ExternalRef     string
	BudgetUSD       float64
	RepoScopes      []CreateRepoScopeInput
}

type CreateRepoScopeInput

type CreateRepoScopeInput struct {
	RepoID     uuid.UUID
	BranchName *string
}

type DeferredLifecycleHook

type DeferredLifecycleHook struct {
	RunID      uuid.UUID
	WorkflowID *uuid.UUID
	HookName   string
}

type DeleteCommentResult

type DeleteCommentResult struct {
	DeletedCommentID uuid.UUID `json:"deleted_comment_id"`
}

type DeleteDependencyResult

type DeleteDependencyResult struct {
	DeletedDependencyID uuid.UUID `json:"deleted_dependency_id"`
}

type DeleteExternalLinkResult

type DeleteExternalLinkResult struct {
	DeletedExternalLinkID uuid.UUID `json:"deleted_external_link_id"`
}

type Dependency

type Dependency struct {
	ID     uuid.UUID       `json:"id"`
	Type   DependencyType  `json:"type"`
	Target TicketReference `json:"target"`
}

type DependencyType

type DependencyType string
const (
	DefaultDependencyType  DependencyType = DependencyTypeBlocks
	DependencyTypeBlocks   DependencyType = "blocks"
	DependencyTypeSubIssue DependencyType = "sub-issue"
)

func ParseDependencyType

func ParseDependencyType(raw string) (DependencyType, error)

func (DependencyType) String

func (t DependencyType) String() string
type ExternalLink struct {
	ID         uuid.UUID            `json:"id"`
	LinkType   ExternalLinkType     `json:"link_type"`
	URL        string               `json:"url"`
	ExternalID string               `json:"external_id"`
	Title      string               `json:"title,omitempty"`
	Status     string               `json:"status,omitempty"`
	Relation   ExternalLinkRelation `json:"relation"`
	CreatedAt  time.Time            `json:"created_at"`
}

type ExternalLinkRelation

type ExternalLinkRelation string
const (
	DefaultExternalLinkRelation  ExternalLinkRelation = ExternalLinkRelationRelated
	ExternalLinkRelationResolves ExternalLinkRelation = "resolves"
	ExternalLinkRelationRelated  ExternalLinkRelation = "related"
	ExternalLinkRelationCausedBy ExternalLinkRelation = "caused_by"
)

func ParseExternalLinkRelation

func ParseExternalLinkRelation(raw string) (ExternalLinkRelation, error)

func (ExternalLinkRelation) String

func (r ExternalLinkRelation) String() string

type ExternalLinkType

type ExternalLinkType string
const (
	ExternalLinkTypeGithubIssue ExternalLinkType = "github_issue"
	ExternalLinkTypeGitlabIssue ExternalLinkType = "gitlab_issue"
	ExternalLinkTypeJiraTicket  ExternalLinkType = "jira_ticket"
	ExternalLinkTypeGithubPR    ExternalLinkType = "github_pr"
	ExternalLinkTypeGitlabMR    ExternalLinkType = "gitlab_mr"
	ExternalLinkTypeCustom      ExternalLinkType = "custom"
)

func ParseExternalLinkType

func ParseExternalLinkType(raw string) (ExternalLinkType, error)

func (ExternalLinkType) String

func (t ExternalLinkType) String() string

type HookWorkspace

type HookWorkspace struct {
	RepoName string
	RepoPath string
}

type LifecycleHookRuntimeData

type LifecycleHookRuntimeData struct {
	TicketID              uuid.UUID
	ProjectID             uuid.UUID
	AgentID               uuid.UUID
	TicketIdentifier      string
	AgentName             string
	WorkflowType          string
	WorkflowFamily        string
	PlatformAccessAllowed []string
	Attempt               int
	WorkspaceRoot         string
	Hooks                 map[string]any
	Machine               catalogdomain.Machine
	Workspaces            []HookWorkspace
}

type ListInput

type ListInput struct {
	ProjectID   uuid.UUID
	StatusNames []string
	Priorities  []Priority
	Limit       int
}

type Optional

type Optional[T any] struct {
	Set   bool
	Value T
}

type PersistedUsageResult

type PersistedUsageResult struct {
	Result       RecordUsageResult
	MetricsAgent UsageMetricsAgent
	ProjectID    uuid.UUID
}

type PickupDiagnosis

type PickupDiagnosis struct {
	State                PickupDiagnosisState           `json:"state"`
	PrimaryReasonCode    PickupDiagnosisReasonCode      `json:"primary_reason_code"`
	PrimaryReasonMessage string                         `json:"primary_reason_message"`
	NextActionHint       string                         `json:"next_action_hint,omitempty"`
	Reasons              []PickupDiagnosisReason        `json:"reasons"`
	Workflow             *PickupDiagnosisWorkflow       `json:"workflow,omitempty"`
	Agent                *PickupDiagnosisAgent          `json:"agent,omitempty"`
	Provider             *PickupDiagnosisProvider       `json:"provider,omitempty"`
	Retry                PickupDiagnosisRetry           `json:"retry"`
	Capacity             PickupDiagnosisCapacity        `json:"capacity"`
	BlockedBy            []PickupDiagnosisBlockedTicket `json:"blocked_by"`
}

type PickupDiagnosisAgent

type PickupDiagnosisAgent struct {
	ID                  uuid.UUID                              `json:"id"`
	Name                string                                 `json:"name"`
	RuntimeControlState catalogdomain.AgentRuntimeControlState `json:"runtime_control_state"`
}

type PickupDiagnosisBlockedTicket

type PickupDiagnosisBlockedTicket struct {
	ID         uuid.UUID `json:"id"`
	Identifier string    `json:"identifier"`
	Title      string    `json:"title"`
	StatusID   uuid.UUID `json:"status_id"`
	StatusName string    `json:"status_name"`
}

type PickupDiagnosisCapacity

type PickupDiagnosisCapacity struct {
	Workflow PickupDiagnosisCapacityBucket `json:"workflow"`
	Project  PickupDiagnosisCapacityBucket `json:"project"`
	Provider PickupDiagnosisCapacityBucket `json:"provider"`
	Status   PickupDiagnosisStatusCapacity `json:"status"`
}

type PickupDiagnosisCapacityBucket

type PickupDiagnosisCapacityBucket struct {
	Limited    bool `json:"limited"`
	ActiveRuns int  `json:"active_runs"`
	Capacity   int  `json:"capacity"`
}

type PickupDiagnosisProvider

type PickupDiagnosisProvider struct {
	ID                 uuid.UUID                                    `json:"id"`
	Name               string                                       `json:"name"`
	MachineID          uuid.UUID                                    `json:"machine_id"`
	MachineName        string                                       `json:"machine_name"`
	MachineStatus      catalogdomain.MachineStatus                  `json:"machine_status"`
	AvailabilityState  catalogdomain.AgentProviderAvailabilityState `json:"availability_state"`
	AvailabilityReason *string                                      `json:"availability_reason,omitempty"`
}

type PickupDiagnosisReason

type PickupDiagnosisReason struct {
	Code     PickupDiagnosisReasonCode     `json:"code"`
	Message  string                        `json:"message"`
	Severity PickupDiagnosisReasonSeverity `json:"severity"`
}

type PickupDiagnosisReasonCode

type PickupDiagnosisReasonCode string
const (
	PickupDiagnosisReasonReadyForPickup            PickupDiagnosisReasonCode = "ready_for_pickup"
	PickupDiagnosisReasonArchived                  PickupDiagnosisReasonCode = "archived"
	PickupDiagnosisReasonCompleted                 PickupDiagnosisReasonCode = "completed"
	PickupDiagnosisReasonRunningCurrentRun         PickupDiagnosisReasonCode = "running_current_run"
	PickupDiagnosisReasonRetryBackoff              PickupDiagnosisReasonCode = "retry_backoff"
	PickupDiagnosisReasonRetryPausedRepeatedStalls PickupDiagnosisReasonCode = "retry_paused_repeated_stalls"
	PickupDiagnosisReasonRetryPausedBudget         PickupDiagnosisReasonCode = "retry_paused_budget"
	PickupDiagnosisReasonRetryPausedUser           PickupDiagnosisReasonCode = "retry_paused_user"
	PickupDiagnosisReasonBlockedDependency         PickupDiagnosisReasonCode = "blocked_dependency"
	PickupDiagnosisReasonNoMatchingActiveWorkflow  PickupDiagnosisReasonCode = "no_matching_active_workflow"
	PickupDiagnosisReasonWorkflowInactive          PickupDiagnosisReasonCode = "workflow_inactive"
	PickupDiagnosisReasonWorkflowMissingAgent      PickupDiagnosisReasonCode = "workflow_missing_agent"
	PickupDiagnosisReasonAgentMissing              PickupDiagnosisReasonCode = "agent_missing"
	PickupDiagnosisReasonAgentPaused               PickupDiagnosisReasonCode = "agent_paused"
	PickupDiagnosisReasonAgentPauseRequested       PickupDiagnosisReasonCode = "agent_pause_requested"
	PickupDiagnosisReasonProviderMissing           PickupDiagnosisReasonCode = "provider_missing"
	PickupDiagnosisReasonMachineMissing            PickupDiagnosisReasonCode = "machine_missing"
	PickupDiagnosisReasonMachineOffline            PickupDiagnosisReasonCode = "machine_offline"
	PickupDiagnosisReasonProviderUnknown           PickupDiagnosisReasonCode = "provider_unknown"
	PickupDiagnosisReasonProviderStale             PickupDiagnosisReasonCode = "provider_stale"
	PickupDiagnosisReasonProviderUnavailable       PickupDiagnosisReasonCode = "provider_unavailable"
	PickupDiagnosisReasonWorkflowConcurrencyFull   PickupDiagnosisReasonCode = "workflow_concurrency_full"
	PickupDiagnosisReasonProjectConcurrencyFull    PickupDiagnosisReasonCode = "project_concurrency_full"
	PickupDiagnosisReasonProviderConcurrencyFull   PickupDiagnosisReasonCode = "provider_concurrency_full"
	PickupDiagnosisReasonStatusCapacityFull        PickupDiagnosisReasonCode = "status_capacity_full"
	PickupDiagnosisReasonSchedulerUnavailable      PickupDiagnosisReasonCode = "scheduler_unavailable"
)

type PickupDiagnosisReasonSeverity

type PickupDiagnosisReasonSeverity string
const (
	PickupDiagnosisReasonSeverityInfo    PickupDiagnosisReasonSeverity = "info"
	PickupDiagnosisReasonSeverityWarning PickupDiagnosisReasonSeverity = "warning"
	PickupDiagnosisReasonSeverityError   PickupDiagnosisReasonSeverity = "error"
)

type PickupDiagnosisRetry

type PickupDiagnosisRetry struct {
	AttemptCount int        `json:"attempt_count"`
	RetryPaused  bool       `json:"retry_paused"`
	PauseReason  string     `json:"pause_reason,omitempty"`
	NextRetryAt  *time.Time `json:"next_retry_at,omitempty"`
}

type PickupDiagnosisState

type PickupDiagnosisState string
const (
	PickupDiagnosisStateRunnable    PickupDiagnosisState = "runnable"
	PickupDiagnosisStateWaiting     PickupDiagnosisState = "waiting"
	PickupDiagnosisStateBlocked     PickupDiagnosisState = "blocked"
	PickupDiagnosisStateRunning     PickupDiagnosisState = "running"
	PickupDiagnosisStateCompleted   PickupDiagnosisState = "completed"
	PickupDiagnosisStateUnavailable PickupDiagnosisState = "unavailable"
)

type PickupDiagnosisStatusCapacity

type PickupDiagnosisStatusCapacity struct {
	Limited    bool `json:"limited"`
	ActiveRuns int  `json:"active_runs"`
	Capacity   *int `json:"capacity"`
}

type PickupDiagnosisWorkflow

type PickupDiagnosisWorkflow struct {
	ID                uuid.UUID `json:"id"`
	Name              string    `json:"name"`
	IsActive          bool      `json:"is_active"`
	PickupStatusMatch bool      `json:"pickup_status_match"`
}

type Priority

type Priority string
const (
	DefaultPriority Priority = PriorityMedium
	PriorityUrgent  Priority = "urgent"
	PriorityHigh    Priority = "high"
	PriorityMedium  Priority = "medium"
	PriorityLow     Priority = "low"
)

func ParsePriority

func ParsePriority(raw string) (Priority, error)

func (Priority) String

func (p Priority) String() string

type RecordActivityEventInput

type RecordActivityEventInput struct {
	ProjectID uuid.UUID
	TicketID  *uuid.UUID
	AgentID   *uuid.UUID
	EventType activityevent.Type
	Message   string
	Metadata  map[string]any
	CreatedAt time.Time
}

type RecordUsageInput

type RecordUsageInput struct {
	AgentID  uuid.UUID
	TicketID uuid.UUID
	RunID    *uuid.UUID
	Usage    ticketing.RawUsageDelta
}

type RecordUsageResult

type RecordUsageResult struct {
	Ticket         Ticket       `json:"ticket"`
	Applied        AppliedUsage `json:"applied"`
	BudgetExceeded bool         `json:"budget_exceeded"`
}

type ResumeRetryInput

type ResumeRetryInput struct {
	TicketID uuid.UUID
}

type Ticket

type Ticket struct {
	ID                   uuid.UUID         `json:"id"`
	ProjectID            uuid.UUID         `json:"project_id"`
	Identifier           string            `json:"identifier"`
	Title                string            `json:"title"`
	Description          string            `json:"description"`
	StatusID             uuid.UUID         `json:"status_id"`
	StatusName           string            `json:"status_name"`
	Archived             bool              `json:"archived"`
	Priority             Priority          `json:"priority"`
	Type                 Type              `json:"type"`
	WorkflowID           *uuid.UUID        `json:"workflow_id,omitempty"`
	CurrentRunID         *uuid.UUID        `json:"current_run_id,omitempty"`
	TargetMachineID      *uuid.UUID        `json:"target_machine_id,omitempty"`
	CreatedBy            string            `json:"created_by"`
	Parent               *TicketReference  `json:"parent,omitempty"`
	Children             []TicketReference `json:"children"`
	Dependencies         []Dependency      `json:"dependencies"`
	IncomingDependencies []Dependency      `json:"incoming_dependencies"`
	ExternalLinks        []ExternalLink    `json:"external_links"`
	ExternalRef          string            `json:"external_ref"`
	BudgetUSD            float64           `json:"budget_usd"`
	CostTokensInput      int64             `json:"cost_tokens_input"`
	CostTokensOutput     int64             `json:"cost_tokens_output"`
	CostAmount           float64           `json:"cost_amount"`
	AttemptCount         int               `json:"attempt_count"`
	ConsecutiveErrors    int               `json:"consecutive_errors"`
	StartedAt            *time.Time        `json:"started_at,omitempty"`
	CompletedAt          *time.Time        `json:"completed_at,omitempty"`
	NextRetryAt          *time.Time        `json:"next_retry_at,omitempty"`
	RetryPaused          bool              `json:"retry_paused"`
	PauseReason          string            `json:"pause_reason,omitempty"`
	CreatedAt            time.Time         `json:"created_at"`
}

type TicketReference

type TicketReference struct {
	ID         uuid.UUID `json:"id"`
	Identifier string    `json:"identifier"`
	Title      string    `json:"title"`
	StatusID   uuid.UUID `json:"status_id"`
	StatusName string    `json:"status_name"`
}

type Type

type Type string
const (
	DefaultType  Type = TypeFeature
	TypeFeature  Type = "feature"
	TypeBugfix   Type = "bugfix"
	TypeRefactor Type = "refactor"
	TypeChore    Type = "chore"
	TypeEpic     Type = "epic"
)

func ParseType

func ParseType(raw string) (Type, error)

func (Type) String

func (t Type) String() string

type UpdateCommentInput

type UpdateCommentInput struct {
	TicketID   uuid.UUID
	CommentID  uuid.UUID
	Body       string
	EditedBy   string
	EditReason string
}

type UpdateInput

type UpdateInput struct {
	TicketID                          uuid.UUID
	Title                             Optional[string]
	Description                       Optional[string]
	StatusID                          Optional[uuid.UUID]
	Archived                          Optional[bool]
	Priority                          Optional[*Priority]
	Type                              Optional[Type]
	WorkflowID                        Optional[*uuid.UUID]
	TargetMachineID                   Optional[*uuid.UUID]
	CreatedBy                         Optional[string]
	ParentTicketID                    Optional[*uuid.UUID]
	ExternalRef                       Optional[string]
	BudgetUSD                         Optional[float64]
	RestrictStatusToWorkflowFinishSet bool
}

type UpdateResult

type UpdateResult struct {
	Ticket       Ticket
	DeferredHook *DeferredLifecycleHook
}

type UsageMetricsAgent

type UsageMetricsAgent struct {
	ProviderName string
	ModelName    string
}

Jump to

Keyboard shortcuts

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