factory

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Work order events. `order.status.updated` is the sole authoritative
	// lifecycle event: every FSM transition emits one, enriched with the
	// actor / automation / originating run / app when applicable.
	EventTypeOrderAssigneesUpdated = "order.assignees.updated"
	// EventTypeOrderUpdated is a websocket-only notification reason.
	// Title and description edits update the row in place and do not
	// write a timeline event.
	EventTypeOrderUpdated       = "order.updated"
	EventTypeOrderStatusUpdated = "order.status.updated"
	EventTypeOrderCommentAdded  = "order.comment.added"
	EventTypeOrderArtifactAdded = "order.artifact.added"
	// EventTypeOrderArtifactUpdated is a websocket-only notification
	// reason — it does not back a timeline event/struct. Artifact data
	// updates re-save the row in place and this reason tells the
	// frontend which query to invalidate.
	EventTypeOrderArtifactUpdated = "order.artifact.updated"
	// EventTypeOrderArtifactsCleared records a bulk delete of task
	// artifacts when a person sends the task to the backlog.
	EventTypeOrderArtifactsCleared   = "order.artifacts.cleared"
	EventTypeOrderPullRequestAdded   = "order.pull_request.added"
	EventTypeOrderPullRequestUpdated = "order.pull_request.updated"
	// EventTypeOrderCheckReported records every check report, including
	// re-reports of the same check key. The check row itself is
	// latest-only state (one row per key, updated in place); the events
	// keep the score history on the timeline.
	EventTypeOrderCheckReported = "order.check.reported"
	// EventTypeOrderStatusNoteUpdated does not back a timeline event
	// (like EventTypeOrderArtifactUpdated): the status note is
	// current-wait metadata on the order row, not a discrete history
	// entry, so the websocket fan-out just tells the frontend to
	// refetch the order. It does, however, back an email notification
	// (see FactoryContext.SetWorkOrderStatusNote): a note is how a line
	// tells an order's owners/creator it's waiting on their review, so
	// setting one publishes a FactoryWorkOrderNotificationMessage the
	// same way status changes and comments do. Clearing rides on
	// `order.status.updated`.
	EventTypeOrderStatusNoteUpdated = "order.status_note.updated"
	// EventTypeOrderAgentQuestion is a notification-only reason: the
	// planning agent is waiting for an answer on a task. It does not
	// back a timeline event.
	EventTypeOrderAgentQuestion = "order.agent_question"
	// EventTypeOrderPlanReady is a notification-only reason: refinement
	// ended and the planning spec artifact exists. It does not back a
	// timeline event.
	EventTypeOrderPlanReady = "order.plan_ready"

	// Factory line events
	EventTypeLineStepExecutionQueued   = "step.execution.queued"
	EventTypeLineStepExecutionCreated  = "step.execution.created"
	EventTypeLineStepExecutionFinished = "step.execution.finished"
)
View Source
const (
	CommentAuthorKindUser       = "user"
	CommentAuthorKindAutomation = "automation"
)

Comment author kinds. `automation` covers any canvas-run comment; the specific tool is exposed via the `Automation` payload.

View Source
const (
	ArtifactTypeMarkdown = "markdown"
	ArtifactTypeBranch   = "branch"
	ArtifactTypeLink     = "link"
	ArtifactTypeFile     = "file"
)

Artifact types

View Source
const (
	CheckLevelPositive = "positive"
	CheckLevelNeutral  = "neutral"
	CheckLevelCaution  = "caution"
	CheckLevelCritical = "critical"
)

Check levels. The reporting component computes the level from its declarative thresholds (direction + cautionAt/criticalAt); the model only validates and stores it.

View Source
const (
	CheckFormatFraction = "fraction"
	CheckFormatPercent  = "percent"
	// CheckFormatBoolean is a pass/fail verdict: score 1 (pass) or 0
	// (fail) on a max score of 1.
	CheckFormatBoolean = "boolean"
)

Check score formats: render as `score/maxScore` or as a percentage.

View Source
const (
	StatusNoteKindInfo = "info"
)

Status note kinds. A status note is a display-only announcement of what a waiting work order is blocked on and what resolves it. `info` is the only kind today; the tag exists so future kinds (e.g. an interactive decision prompt) extend the payload instead of changing its meaning.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppRef

type AppRef struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name,omitempty"`
}

type ArtifactRef

type ArtifactRef struct {
	ID   uuid.UUID      `json:"id"`
	Type string         `json:"type"`
	Data map[string]any `json:"data,omitempty"`
}

type AutomationRef

type AutomationRef struct {
	NodeID    string    `json:"nodeId,omitempty"`
	NodeName  string    `json:"nodeName,omitempty"`
	AppID     uuid.UUID `json:"appId,omitempty"`
	AppName   string    `json:"appName,omitempty"`
	LineID    uuid.UUID `json:"lineId,omitempty"`
	LineName  string    `json:"lineName,omitempty"`
	StepIndex *int      `json:"stepIndex,omitempty"`
	StepName  string    `json:"stepName,omitempty"`
}

AutomationRef snapshots the canvas node + app + factory line/step behind an automated event. Captured at write time so later renames don't retro-edit history. `StepIndex` is a pointer so consumers can distinguish "no line context" from a legitimate index of 0.

type CheckRef

type CheckRef struct {
	ID            uuid.UUID `json:"id"`
	Key           string    `json:"key"`
	Name          string    `json:"name"`
	Score         float64   `json:"score"`
	MaxScore      float64   `json:"maxScore"`
	Format        string    `json:"format"`
	Level         string    `json:"level"`
	PreviousScore *float64  `json:"previousScore,omitempty"`
}

CheckRef snapshots a check report for the timeline. PreviousScore is the score the same check key held before this report, if any, so the timeline can show the movement without replaying older events.

type LineRef

type LineRef struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

type LineStepExecutionCreated

type LineStepExecutionCreated struct {
	StepName string        `json:"stepName"`
	Order    *WorkOrderRef `json:"order,omitempty"`
	Line     *LineRef      `json:"line,omitempty"`
	App      *AppRef       `json:"app,omitempty"`
	Run      *RunRef       `json:"run,omitempty"`
}

type LineStepExecutionFinished

type LineStepExecutionFinished struct {
	StepName string        `json:"stepName"`
	Order    *WorkOrderRef `json:"order,omitempty"`
	Line     *LineRef      `json:"line,omitempty"`
	App      *AppRef       `json:"app,omitempty"`
	Run      *RunRef       `json:"run,omitempty"`
	// User is who cancelled the canvas run, when this finish is a
	// cancellation. Passed finishes leave it empty.
	User *UserRef `json:"user,omitempty"`
}

type LineStepExecutionQueued

type LineStepExecutionQueued struct {
	StepName string        `json:"stepName"`
	Order    *WorkOrderRef `json:"order,omitempty"`
	Line     *LineRef      `json:"line,omitempty"`
	App      *AppRef       `json:"app,omitempty"`
}

LineStepExecutionQueued is recorded when a work order becomes ready for a step that is at its maxParallelism, so the work order waits in the step's queue instead of starting a run.

type PullRequestRef

type PullRequestRef struct {
	ID         uuid.UUID `json:"id"`
	Provider   string    `json:"provider,omitempty"`
	Repository string    `json:"repository,omitempty"`
	Number     int64     `json:"number,omitempty"`
	URL        string    `json:"url,omitempty"`
	Title      string    `json:"title,omitempty"`
	State      string    `json:"state,omitempty"`
}

type RunRef

type RunRef struct {
	ID     uuid.UUID `json:"id"`
	State  string    `json:"state"`
	Result *string   `json:"result,omitempty"`
}

type UserRef

type UserRef struct {
	ID uuid.UUID `json:"id"`
}

type WorkOrderArtifactAdded

type WorkOrderArtifactAdded struct {
	Order      *WorkOrderRef  `json:"order,omitempty"`
	Artifact   *ArtifactRef   `json:"artifact,omitempty"`
	User       *UserRef       `json:"user,omitempty"`
	Automation *AutomationRef `json:"automation,omitempty"`
	Run        *RunRef        `json:"run,omitempty"`
}

type WorkOrderArtifactsCleared

type WorkOrderArtifactsCleared struct {
	Order *WorkOrderRef `json:"order,omitempty"`
	Count int           `json:"count"`
	User  *UserRef      `json:"user,omitempty"`
}

type WorkOrderAssigneesUpdated

type WorkOrderAssigneesUpdated struct {
	Order      *WorkOrderRef `json:"order,omitempty"`
	User       *UserRef      `json:"user,omitempty"`
	Assigned   []UserRef     `json:"assigned,omitempty"`
	Unassigned []UserRef     `json:"unassigned,omitempty"`
}

type WorkOrderCheckReported

type WorkOrderCheckReported struct {
	Order      *WorkOrderRef  `json:"order,omitempty"`
	Check      *CheckRef      `json:"check,omitempty"`
	Automation *AutomationRef `json:"automation,omitempty"`
	Run        *RunRef        `json:"run,omitempty"`
}

type WorkOrderCommentAdded

type WorkOrderCommentAdded struct {
	Order          *WorkOrderRef           `json:"order,omitempty"`
	CommentID      uuid.UUID               `json:"commentId,omitempty"`
	Body           string                  `json:"body"`
	Author         *WorkOrderCommentAuthor `json:"author,omitempty"`
	Run            *RunRef                 `json:"run,omitempty"`
	MentionedUsers []UserRef               `json:"mentionedUsers,omitempty"`
}

type WorkOrderCommentAuthor

type WorkOrderCommentAuthor struct {
	Kind       string         `json:"kind"`
	UserID     *string        `json:"userId,omitempty"`
	Automation *AutomationRef `json:"automation,omitempty"`
}

type WorkOrderPullRequestAdded

type WorkOrderPullRequestAdded struct {
	Order       *WorkOrderRef   `json:"order,omitempty"`
	PullRequest *PullRequestRef `json:"pullRequest,omitempty"`
	User        *UserRef        `json:"user,omitempty"`
	Automation  *AutomationRef  `json:"automation,omitempty"`
	Run         *RunRef         `json:"run,omitempty"`
}

type WorkOrderPullRequestUpdated

type WorkOrderPullRequestUpdated struct {
	Order       *WorkOrderRef   `json:"order,omitempty"`
	PullRequest *PullRequestRef `json:"pullRequest,omitempty"`
	User        *UserRef        `json:"user,omitempty"`
	Automation  *AutomationRef  `json:"automation,omitempty"`
	Run         *RunRef         `json:"run,omitempty"`
}

type WorkOrderRef

type WorkOrderRef struct {
	ID     uuid.UUID `json:"id"`
	Title  string    `json:"title"`
	Result *string   `json:"result,omitempty"`
}

type WorkOrderStatusUpdated

type WorkOrderStatusUpdated struct {
	Order      *WorkOrderRef  `json:"order,omitempty"`
	User       *UserRef       `json:"user,omitempty"`
	Automation *AutomationRef `json:"automation,omitempty"`
	App        *AppRef        `json:"app,omitempty"`
	Run        *RunRef        `json:"run,omitempty"`
	FromState  string         `json:"fromState"`
	ToState    string         `json:"toState"`
	FromResult string         `json:"fromResult,omitempty"`
	ToResult   string         `json:"toResult,omitempty"`
}

WorkOrderStatusUpdated is the authoritative lifecycle event: emitted for every FSM transition, including the initial `"" → draft` on creation and the `→ closed` termination. `User`, `Automation`, and `Run` + `App` are attribution channels — populate whichever caused the transition.

Jump to

Keyboard shortcuts

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