package wire
import (
"amadan.net/oficina/equipo/internal/copydesk"
"regexp"
"strings"
"time"
)
// Task stages. A task is recorded the moment the person reports
// something (noted), gains the coordinator's findings (investigated),
// runs its Engineering step (in_progress), goes to checks and review
// (in_review), is ready to merge once both pass on one SHA, and Equipo
// merges it (merging) into the default branch. done and cancelled are
// final.
const (
StageNoted = "noted"
StageInvestigated = "investigated"
StageInProgress = "in_progress"
StageInReview = "in_review"
StageReadyToMerge = "ready_to_merge"
StageMerging = "merging"
StageDone = "done"
StageCancelled = "cancelled"
)
// Stages lists every stage in order.
var Stages = []string{StageNoted, StageInvestigated, StageInProgress, StageInReview, StageReadyToMerge, StageMerging, StageDone, StageCancelled}
// FinalStage reports whether a task can no longer change.
func FinalStage(stage string) bool { return stage == StageDone || stage == StageCancelled }
// Step states. A step ends failed or cancelled only with the runner's
// termination proof for that attempt; Retry waits for it.
const (
StepQueued = "queued"
StepRunning = "running"
StepDone = "done"
StepFailed = "failed"
StepCancelled = "cancelled"
)
// StepTerminal reports whether a step attempt has ended.
func StepTerminal(state string) bool {
return state == StepDone || state == StepFailed || state == StepCancelled
}
// Specialists. Engineering changes the code and pushes a candidate;
// Checks runs the repository's own gate on a candidate; Review reads a
// candidate and gives a verdict. Checks and Review judge CandidateSHA,
// the commit named when they were dispatched.
const (
SpecialistCopy = "copy"
SpecialistEngineering = "engineering"
SpecialistChecks = "checks"
SpecialistReview = "review"
// SpecialistMerge is the merge itself: the person's runner merges the
// judged SHA into the default branch through the hub (forge holds the
// credential). Nothing runs in a namespace.
SpecialistMerge = "merge"
// SpecialistPreview publishes an approved candidate's static output
// to a temporary Carloku site (release preview slice); protocol 9.
SpecialistPreview = "preview"
)
// Merge strategies, as the hub names them. Equipo uses the hub's own
// default, a merge commit (the hub records a landing by ancestry).
const (
MergeCommit = "merge"
MergeSquash = "squash"
)
// Checks outcomes. none is "No checks found", which is not a failure;
// cannot_run is honest about a gate this runner cannot run (Reason says
// why, for example needs_macos), never a pass.
const (
ChecksPassed = "passed"
ChecksFailed = "failed"
ChecksNone = "none"
ChecksCannotRun = "cannot_run"
)
// Review verdicts.
const (
VerdictApprove = "approve"
VerdictChanges = "changes_requested"
)
// Review labels: how independent the reviewer was of Engineering.
// other_family is another provider family; same_family another account
// of the same family with fresh context; same_account a fresh session on
// the account Engineering used.
const (
ReviewOtherFamily = "other_family"
ReviewSameFamily = "same_family"
ReviewSameAccount = "same_account"
)
// What a task needs from its person (Task.NeedsYou). merge: ready to
// merge on Amadan, the person's decision; fix_rounds: review or checks
// still object after the automatic fix rounds; review_blocked: the
// review ended without a verdict; retry: a step stopped and can be
// retried.
const (
NeedsMerge = "merge"
NeedsFixRounds = "fix_rounds"
NeedsReviewBlocked = "review_blocked"
NeedsRetry = "retry"
// NeedsBranchMoved: the task branch's head on Amadan is no longer the
// SHA that was checked and reviewed, so nothing judged applies.
NeedsBranchMoved = "branch_moved"
// NeedsMergeConflict: the branch still conflicts with the default
// branch after Engineering's one rebase round.
NeedsMergeConflict = "merge_conflict"
// NeedsMachineRemoved: a step was running on a machine removed at
// once; the task's creator makes sure it is off, then recovers it.
NeedsMachineRemoved = "machine_removed"
// NeedsRunnerOffline: the only runner that can do the next step has
// been offline for 30 minutes.
NeedsRunnerOffline = "runner_offline"
// NeedsMacSandbox: checks wait for the Mac's sandbox; they run by
// themselves once it is proven, or the creator may choose to run them
// outside it.
NeedsMacSandbox = "mac_sandbox"
// NeedsMacRunner: Mac work waits for a Mac runner to be added; it
// starts by itself once one is.
NeedsMacRunner = "mac_runner"
// NeedsMacEngineering: Engineering for Mac work waits because a Mac
// runner does not take Engineering yet, and it never runs on Linux.
NeedsMacEngineering = "mac_engineering"
)
// MaxRebaseRounds is how many times Engineering is sent to put the change
// on top of a default branch it conflicts with, per task.
const MaxRebaseRounds = 1
// MaxFixRounds is how many Engineering fix rounds the coordinator sends
// on its own after changes are requested or checks fail.
const MaxFixRounds = 2
// Event types for tasks.
const (
EventTask = "task"
EventStep = "step"
)
// CardTask is a task receipt in the conversation; TaskID names the task.
// CardResolved is an access card whose namespace became reachable.
const (
CardTask = "task"
CardResolved = "resolved"
// CardMerge asks the task's creator, once per judged SHA, whether to
// merge a task whose checks could not run here (Name is the task's
// title, TaskID the task). ChoiceMerge merges that SHA, labelled
// without checks; ChoiceWait leaves it at Ready to merge.
CardMerge = "merge"
ChoiceMerge = "merge"
ChoiceWait = "wait"
// ChoiceNotNow declines adopting a candidate that was Ready before
// Equipo merged on its own ("Merge
?").
ChoiceNotNow = "not_now"
// ChoiceCheck is the answer on an access card: the person granted
// access, so the runner checks its reach now.
ChoiceCheck = "check"
// ChoiceNotNeeded marks an access card Equipo resolved itself because
// no access was needed: its target was never a repository or
// namespace, the agent already reached it, or the turn's task found a
// repository the agent reaches. It is never a person's answer.
ChoiceNotNeeded = "not_needed"
)
// Bounds for tasks.
const (
MaxTaskTitle = 120
MaxTaskBrief = 4000
MaxFindingText = 1000
MaxFindings = 20
MaxThreadText = 4000
MaxThread = 50
MaxLogTail = 4 << 10
MaxStepSummary = 2000
MaxTaskList = 100
MaxBranchLength = 100
// MaxChecksLines and MaxChecksOutput bound the checks output kept
// beside the SHA: its last 200 lines.
MaxChecksLines = 200
MaxChecksOutput = 32 << 10
MaxDiffBytes = 48 << 10
MaxStepFindings = 20
)
// Attachment is something a project is made of: an Amadan repository now
// (Kind "repo", Ref the forge key), later CARLOS apps and links.
type Attachment struct {
Kind string `json:"kind"`
Ref string `json:"ref"`
Name string `json:"name"`
// For a repository, from the runner's index: its default branch and
// that branch's newest commit (SHA, subject, time); empty until the
// index has read it.
DefaultBranch string `json:"default_branch"`
HeadSHA string `json:"head_sha"`
HeadSubject string `json:"head_subject"`
HeadAt *time.Time `json:"head_at"`
}
// AttachmentRepo is a repository attachment.
const AttachmentRepo = "repo"
// Finding is what the coordinator found while investigating, attached to
// the task: a diagnosis with the file and line it points at, if any.
type Finding struct {
ID string `json:"id"`
// Headline is one plain sentence a person reads first (no paths, at
// most MaxHeadline bytes); Text is the full diagnosis.
Headline string `json:"headline"`
Text string `json:"text"`
Repo string `json:"repo"`
Path string `json:"path"`
Line int `json:"line"`
At time.Time `json:"at"`
}
// ThreadEntry is one line of a task's own thread: a person's note or an
// update the instance wrote (Author "equipo").
type ThreadEntry struct {
ID string `json:"id"`
Author string `json:"author"`
Text string `json:"text"`
At time.Time `json:"at"`
}
// StepHosted is the device-visible hosted CI evidence. Runner reports retain
// the full result; devices need only the failed job names for log sections.
type StepHosted struct {
Failed []string `json:"failed"`
}
// Step is one specialist's run on the task branch. CandidateSHA is the
// commit the runner made from the step's changes; Pushed is true once
// forge confirmed the branch points at it. Terminated is the runner's
// proof that the attempt's namespace has exited.
type Step struct {
// ChangeFiles is included only by the device GET /tasks/{id} detail projection.
ChangeFiles *ChangeFiles `json:"change_files,omitempty"`
BaseChecks string `json:"base_checks,omitempty"`
ID string `json:"id"`
Revision int64 `json:"revision"`
TaskID string `json:"task_id"`
Index int `json:"index"`
Specialist string `json:"specialist"`
State string `json:"state"`
Reason string `json:"reason"`
Attempt int64 `json:"attempt"`
BaseSHA string `json:"base_sha"`
CandidateSHA string `json:"candidate_sha"`
Pushed bool `json:"pushed"`
Terminated bool `json:"terminated"`
Summary string `json:"summary"`
// Headline is the step's outcome in one plain sentence (Engineering's
// change, Review's verdict), written by the specialist; Summary has the
// rest. Empty when the specialist gave none.
Headline string `json:"headline"`
LogTail string `json:"log_tail"`
StartedAt *time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at"`
// Round is the fix round the step belongs to: 0 for the first
// Engineering step, then 1 and 2 for the automatic fix rounds.
Round int `json:"round"`
// Family and Account say what ran the step (a provider family and
// the runner's account binding); empty for checks.
Family string `json:"family"`
Account string `json:"account"`
// Model is the model the step's newest attempt ran on (connectors
// spec rev 3.3 §16.7), as its usage reported it.
Model string `json:"model,omitempty"`
// Review: the verdict on CandidateSHA, its independence label and its
// findings (file and line).
Verdict string `json:"verdict"`
ReviewLabel string `json:"review_label"`
Findings []Finding `json:"findings"`
// Checks: the outcome on CandidateSHA, the gate that ran (".amadan/
// ci.d", ".amadan/ci", "make ci" or ""), its exit code (null when it
// did not run); the last 200 lines are GET /steps/{id}/log.
Checks string `json:"checks"`
Gate string `json:"gate"`
ExitCode *int `json:"exit_code"`
Hosted *StepHosted `json:"hosted,omitempty"`
// Askable is true while the runner keeps the step's own session, so
// the task's creator can ask it a question (Engineering and Review).
Askable bool `json:"askable"`
// Rebase marks the Engineering round that puts the change on top of a
// default branch it conflicted with.
Rebase bool `json:"rebase"`
// Merge: the commit the hub made (MergeSHA) on the default branch
// (Into) with Strategy; WithoutChecks when the person chose to merge a
// SHA whose checks could not run.
MergeSHA string `json:"merge_sha"`
Into string `json:"into"`
Strategy string `json:"strategy"`
WithoutChecks bool `json:"without_checks"`
// Switched: the step moved to another connection after the first was
// limited ("Engineering on Codex (Claude was limited)").
Switched *Switched `json:"switched"`
// Activity is what the specialist did most recently in this attempt,
// oldest first, at most MaxStepActivity lines; empty until the runner
// reports any. It stays after the step ends (its last lines).
Activity []ActivityLine `json:"activity"`
// Runners: where the attempt runs (RunnerLabel for people; the house
// rule mentions it only when it is not the primary; while Placement is
// waiting_sandbox, the Mac it waits for), what it needs,
// whether it waits for a runner, how its end was proven, and the
// publication of a worker's Engineering candidate.
RunnerID string `json:"runner_id"`
RunnerLabel string `json:"runner_label"`
Needs []string `json:"needs"`
Placement string `json:"placement"`
Publication string `json:"publication"`
TerminationKind string `json:"termination_kind"`
// EngineeringStatus is, while Placement is waiting_mac_connection, the
// Engineering status the Mac it waits for (RunnerLabel) says now.
EngineeringStatus *EngineeringStatus `json:"engineering_status,omitempty"`
// SandboxChoice is, while Placement is waiting_sandbox, whether the
// task's creator may run the checks outside the Mac's sandbox
// (SandboxChoiceOffered) or not, because the instance holds that Mac
// as having a model credential (SandboxChoiceHeld); absent when
// neither is known.
SandboxChoice string `json:"sandbox_choice,omitempty"`
// WaitingFor is the id of the runner a step placed nowhere waits for
// (a Mac's sandbox, its Claude connection or update, its base):
// RunnerLabel names it. Absent once the step is placed.
WaitingFor string `json:"waiting_for,omitempty"`
// MadeOn names the worker an Engineering attempt ran on, when it is
// not the person's main runner; XcodeAccess is what that attempt got
// of Xcode's services (sandboxed, or "" for none: the Mac's checks
// build and test the change).
MadeOn string `json:"made_on,omitempty"`
XcodeAccess string `json:"xcode_access,omitempty"`
// ChecksSandbox: seatbelt or none (ran outside the sandbox) for a
// worker's checks; absent for the primary's.
ChecksSandbox string `json:"checks_sandbox,omitempty"`
// Preview: a preview step's export and, once done, its outcome.
Preview *PreviewResult `json:"preview,omitempty"`
// Research: a done Research step's findings, fetch log and kept
// images, on the task's read shape only.
Research *StepResearch `json:"research,omitempty"`
// Design: a done Design attempt's kept captures by option, on the
// task's read shape only.
Design *StepDesign `json:"design,omitempty"`
// Maker is the data-defined specialist that makes this step's work
// (Design is a maker on Engineering's step kind): the one its binding
// names, or, before its dispatch, its task's maker. Absent for a step
// its own kind's specialist makes. A step is named by its maker.
Maker *Maker `json:"maker,omitempty"`
// Hold is why the scheduler holds the step now (absent when it does
// not).
Hold *StepHold `json:"hold,omitempty"`
// Paused is what the instance adds to a step that waits and will
// carry on by itself or by a tap (paused work, 2026-11-24): absent
// when it does not wait.
Paused *StepPaused `json:"paused,omitempty"`
// Publish: a publish step's export and, once done, its outcome.
Publish *PublishResult `json:"publish,omitempty"`
// RetriedBy is "coordinator" when the coordinator's retry_step
// started the current attempt (protocol 30), else empty.
RetriedBy string `json:"retried_by,omitempty"`
}
// Task is one piece of work under a project. Branch is the task's own
// branch, equipo/-; URL opens it on Amadan once pushed.
type Task struct {
Stopping bool `json:"stopping,omitempty"`
MoveHoldReason string `json:"move_hold_reason,omitempty"`
PreparingProject bool `json:"preparing_project,omitempty"`
Moving bool `json:"moving,omitempty"`
EarlierSteps []Step `json:"earlier_steps,omitempty"`
CopyCanSkip bool `json:"copy_can_skip,omitempty"`
CopyHold bool `json:"copy_hold,omitempty"`
CopyRepeat *CopyRepeat `json:"copy_repeat,omitempty"`
CopyFlags []CopyFlag `json:"copy_flags,omitempty"`
ID string `json:"id"`
Revision int64 `json:"revision"`
ProjectID string `json:"project_id"`
Project string `json:"project"`
Repo string `json:"repo"`
Title string `json:"title"`
Brief string `json:"brief"`
Stage string `json:"stage"`
Branch string `json:"branch"`
BaseSHA string `json:"base_sha"`
URL string `json:"url"`
Creator string `json:"creator"`
TurnID string `json:"turn_id"`
Findings []Finding `json:"findings"`
Steps []Step `json:"steps"`
Thread []ThreadEntry `json:"thread"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// DoneAt is the most recent transition to done, stable across later notes.
DoneAt *time.Time `json:"done_at,omitempty"`
// CandidateSHA is the newest pushed Engineering candidate. Checks,
// ChecksReason, Verdict and ReviewLabel are the judgements stored
// beside that SHA ("" until they exist); a new candidate clears them.
// NeedsYou is what the person must decide (Needs* constants), or "".
CandidateSHA string `json:"candidate_sha"`
Checks string `json:"checks"`
ChecksReason string `json:"checks_reason"`
// ChecksSandbox is the newest checks' confinement when a worker ran
// them: none means they ran outside the sandbox (Paul's ruling 2).
ChecksSandbox string `json:"checks_sandbox,omitempty"`
Verdict string `json:"verdict"`
ReviewLabel string `json:"review_label"`
NeedsYou string `json:"needs_you"`
FixRounds int `json:"fix_rounds"`
// BranchHead is the task branch's head on Amadan when it moved away
// from CandidateSHA ("" while it is there, or once the branch is gone
// with NeedsYou branch_moved).
BranchHead string `json:"branch_head"`
// Questions are the creator's questions to the specialists and their
// answers, oldest first (the task thread beside Thread's notes).
Questions []Question `json:"questions"`
// Merged is set once Equipo merged the task: the commit on the
// default branch, and how. A merge by a person leaves it nil.
Merged *Merged `json:"merged"`
// Reports counts the person's reports attached to this task after it
// was recorded (the same problem reported again).
Reports int `json:"reports"`
// AskOpen is whether the task's creator may ask its specialists now:
// until it ends, and for KeepMergedSessions after it is done.
AskOpen bool `json:"ask_open"`
// MergeOffered is whether the creator can have Equipo merge it now
// (POST /api/v1/tasks/{id}/merge): Ready to merge, the branch at the
// judged SHA, no merge yet and no merge card open (after Not now, or
// Wait for checks).
MergeOffered bool `json:"merge_offered"`
// Merge authority: the newest decision on its merge, the coordinator's
// hold, and the task it reverts (all absent when none).
MergeDecision *MergeDecision `json:"merge_decision,omitempty"`
MergeHold string `json:"merge_hold,omitempty"`
RevertOf string `json:"revert_of,omitempty"`
// UndoOffered: Equipo merged it on its own, the hub named the merge
// commit, and the creator may still Undo it.
UndoOffered bool `json:"undo_offered,omitempty"`
// CreatorName is the creator's display name (from the address until
// people have profiles).
CreatorName string `json:"creator_name"`
// SourceMessageID is the person's message the task was noted from
// (in the creator's conversation) and SourceAt its time; empty and
// null when no message is known.
SourceMessageID string `json:"source_message_id"`
SourceAt *time.Time `json:"source_at"`
// DuplicateOf is an open task in the same project that reads like this
// one, when the coordinator recorded it anyway; null otherwise. A task
// folded into another (POST /tasks/{id}/duplicate) is cancelled with
// DuplicateOf naming where it went.
DuplicateOf *TaskRef `json:"duplicate_of"`
// Coordinator is what the coordinator is doing on the task right now
// (looking into it, merging it); null when nothing.
Coordinator *TaskActivity `json:"coordinator"`
// Folded is set while Equipo has combined this task into another one
// (its stage is then cancelled); Combined are the tasks folded into
// this one, newest first.
Folded *TaskFold `json:"folded"`
Combined []TaskRef `json:"combined"`
// EngineeringRunner is the runner Engineering is pinned to.
EngineeringRunner string `json:"engineering_runner"`
// Triage is what Equipo is doing about the task instead of asking its
// person, or, when the task needs them, Equipo's recommendation;
// absent when neither.
Triage *TaskTriage `json:"triage,omitempty"`
// Kind is KindExplore for an exploration, which ends at the person's
// choice of direction, never a merge; absent for a change.
Kind string `json:"kind,omitempty"`
// ExploredFrom is the exploration this change was built from; BuiltAs
// the change an exploration became.
ExploredFrom *TaskRef `json:"explored_from,omitempty"`
// Maker is the data-defined specialist that makes the task's work
// now (absent when Engineering does).
Maker *Maker `json:"maker,omitempty"`
BuiltAs *TaskRef `json:"built_as,omitempty"`
// Direction is what the direction card shows while an exploration
// waits for its person's choice.
Direction *TaskDirection `json:"direction,omitempty"`
// Priority is the task's priority and deadline (the scheduler); absent
// on shapes that predate it.
Priority *TaskPriority `json:"priority,omitempty"`
// PreviewURL is the newest candidate's preview link while it is up
// (an unexpired temporary site, or a devbox link until the task
// ends); absent when there is none.
PreviewURL string `json:"preview_url,omitempty"`
// Site is a merged website's publishing: asked, publishing, published
// with its public URL, or how it ended; absent when there is none.
Site *TaskSite `json:"site,omitempty"`
}
// TaskRef names another task.
type TaskRef struct {
ID string `json:"id"`
Title string `json:"title"`
Stage string `json:"stage"`
Creator string `json:"creator"`
}
// TaskFold is how Equipo combined a duplicate into another task: Into
// keeps the work; this task is cancelled until someone undoes it
// (POST /api/v1/tasks/{id}/uncombine restores it exactly as it was).
type TaskFold struct {
Into TaskRef `json:"into"`
At time.Time `json:"at"`
}
// CardCombined is the quiet receipt in the creator's conversation when
// Equipo combined two of their tasks (TaskID the folded task, Name the
// line); ChoiceUndo restores the folded task.
const CardCombined = "combined"
// TaskActivity is the coordinator at work on a task: Kind is
// CoordinatorLooking (its turn that noted the task is still running) or
// CoordinatorMerging (the merge step), since Since.
type TaskActivity struct {
Kind string `json:"kind"`
Since time.Time `json:"since"`
}
// Coordinator activities on a task.
const (
CoordinatorLooking = "looking"
CoordinatorMerging = "merging"
)
// ActivityLine is one thing a specialist started during a step: Kind is
// an Activity* constant and Subject the file (repository-relative) or the
// command's first line, clipped; At is when the runner saw it.
type ActivityLine struct {
Kind string `json:"kind"`
Subject string `json:"subject"`
At time.Time `json:"at"`
}
// Step activity kinds.
const (
ActivityRead = "read"
ActivitySearch = "search"
ActivityEdit = "edit"
ActivityRun = "run"
ActivityOther = "other"
)
// MaxHeadline bounds a headline: one sentence, about 80 characters.
const MaxHeadline = 120
// MaxStepActivity is how many activity lines a step keeps;
// MaxActivitySubject bounds a line's subject.
const (
MaxStepActivity = 5
MaxActivitySubject = 160
)
// FrameStepActivity reports what a running step's specialist started
// (runner to instance, not durable: a lost line is only a lost line).
const FrameStepActivity = "step_activity"
// StepActivityReport is one activity line of a running step attempt.
type StepActivityReport struct {
TaskID string `json:"task_id"`
StepID string `json:"step_id"`
Attempt int64 `json:"attempt"`
Kind string `json:"kind"`
Subject string `json:"subject"`
}
// StepActivity is the activity event's data for resource "step": the
// step's newest lines, oldest first.
type StepActivity struct {
TaskID string `json:"task_id"`
StepID string `json:"step_id"`
Attempt int64 `json:"attempt"`
Activity []ActivityLine `json:"activity"`
}
// ResourceStep is the activity event's resource for a step.
const ResourceStep = "step"
// MarkDuplicate is the body of POST /api/v1/tasks/{id}/duplicate: the
// task's creator folds it into Of, an open task in the same project. The
// task is cancelled (its running step stopped first) and its brief goes
// on Of's thread as a report.
type MarkDuplicate struct {
Of string `json:"of"`
}
// PersonRef is a team member as screens show them: the address, a
// display name and initials for an avatar.
type PersonRef struct {
Address string `json:"address"`
Name string `json:"name"`
Initials string `json:"initials"`
}
// ProjectChecks says whether the project's checks can run on the team's
// runner: Here with the Gate that runs, or not with Reason (a checks
// reason such as needs_macos, or none when no gate was found).
type ProjectChecks struct {
Here bool `json:"here"`
Gate string `json:"gate"`
Reason string `json:"reason"`
}
// Merged is how Equipo merged a task: SHA on Into, with Strategy;
// WithoutChecks when the person chose to merge without checks.
type Merged struct {
SHA string `json:"sha"`
Into string `json:"into"`
Strategy string `json:"strategy"`
WithoutChecks bool `json:"without_checks"`
At time.Time `json:"at"`
}
// TaskList is GET /api/v1/tasks: the team's tasks, newest first.
type TaskList struct {
Items []Task `json:"items"`
}
// TaskAccepted is the 202 body of POST /tasks/{id}/cancel and
// /tasks/{id}/retry: the attempt the request applies to.
type TaskAccepted struct {
Attempt int64 `json:"attempt"`
}
// StepLog is GET /api/v1/steps/{id}/log: the bounded tail.
type StepLog struct {
StepID string `json:"step_id"`
Attempt int64 `json:"attempt"`
Tail string `json:"tail"`
}
// PostThread is the body of POST /api/v1/tasks/{id}/thread.
type PostThread struct {
Text string `json:"text"`
IdempotencyKey string `json:"idempotency_key"`
}
// TaskBranch is the task's own branch: equipo/-, the slug
// from the title, so two tasks never share one.
func TaskBranch(id, title string) string {
var b strings.Builder
dash := false
for _, r := range strings.ToLower(title) {
switch {
case r >= 'a' && r <= 'z' || r >= '0' && r <= '9':
b.WriteRune(r)
dash = false
case !dash && b.Len() > 0:
b.WriteByte('-')
dash = true
}
}
slug := strings.Trim(b.String(), "-")
// At most 40 characters, cut at a word boundary when there is one.
if len(slug) > 40 {
cut := slug[:41]
if i := strings.LastIndexByte(cut, '-'); i > 0 {
slug = cut[:i]
} else {
slug = slug[:40]
}
slug = strings.Trim(slug, "-")
}
if slug == "" {
return "equipo/" + id
}
return "equipo/" + id + "-" + slug
}
var taskBranch = regexp.MustCompile(`^equipo/[a-z0-9]+(?:-[a-z0-9]+)*$`)
var branchName = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._/-]{0,99}$`)
// ValidBranchName reports whether b is a plain branch name (a default
// branch a task merged into).
func ValidBranchName(b string) bool {
return branchName.MatchString(b) && !strings.Contains(b, "..") && !strings.HasSuffix(b, ".lock") && !strings.HasSuffix(b, "/")
}
// ValidTaskBranch reports whether b is a task branch name.
func ValidTaskBranch(b string) bool {
return len(b) <= MaxBranchLength && taskBranch.MatchString(b)
}
// Frames for steps. dispatch and cancel_step go to the runner; step comes
// back. recheck asks the runner to look at what its agent reaches now.
const (
FrameDispatch = "dispatch"
FrameCancelStep = "cancel_step"
FrameStep = "step"
FrameRecheck = "recheck"
// FrameWatchMerge asks the runner to watch a task's branch until its
// candidate lands on the default branch (an empty candidate stops
// watching); FrameMerged reports that it landed.
FrameWatchMerge = "watch_merge"
FrameMerged = "merged"
// FrameBranch reports the task branch's head when it differs from the
// watched candidate (or is back at it).
FrameBranch = "branch"
)
// DispatchCommand starts one attempt of a step on the person's runner.
// BaseSHA is empty for the first attempt: the runner takes the default
// branch's tip and reports it.
type DispatchCommand struct {
PreviewUnsafeDigest string `json:"preview_unsafe_digest,omitempty"`
AvoidFamilies []string `json:"avoid_families,omitempty"`
Copy *CopyDispatch `json:"copy,omitempty"`
Person string `json:"person"`
TaskID string `json:"task_id"`
StepID string `json:"step_id"`
Attempt int64 `json:"attempt"`
Specialist string `json:"specialist"`
Repo string `json:"repo"`
Branch string `json:"branch"`
BaseSHA string `json:"base_sha"`
Title string `json:"title"`
Brief string `json:"brief"`
PersonWords []string `json:"person_words,omitempty"`
Findings []Finding `json:"findings"`
// CandidateSHA is the commit a checks or review step judges (BaseSHA
// is then the task's base, for the diff), or the recorded commit a
// republish attempt pushes again (Republish, from FromAttempt's
// private repository) without running the specialist.
CandidateSHA string `json:"candidate_sha"`
Republish bool `json:"republish"`
FromAttempt int64 `json:"from_attempt"`
// AvoidAccount is the account binding Engineering used; Review runs
// elsewhere when it can.
AvoidAccount string `json:"avoid_account"`
// AvoidFamily (ProtocolModels) is the family Engineering's attempt
// recorded: Review reads it from that record, never from the
// connection, which may allow several models (§16.5).
AvoidFamily string `json:"avoid_family,omitempty"`
Round int `json:"round"`
// Feedback (an Engineering fix round): what checks and review said
// about the commit this round starts from, the fix-round part of
// Brief. A runner holding the session that made that commit sends it
// as that session's next message instead of starting afresh.
// Protocol 3: an older runner never gets it, and runs the round fresh.
Feedback string `json:"feedback,omitempty"`
// Rebase (Engineering): put the change of CandidateSHA, made on
// FromBase, on top of the default branch's tip (BaseSHA is empty: the
// runner takes the tip), resolving any conflicts.
Rebase bool `json:"rebase"`
FromBase string `json:"from_base"`
// Protocol 2: the tags the step needs and the runner it is placed on;
// a runner lacking a need refuses it (placement_refused).
Needs []string `json:"needs,omitempty"`
RunnerID string `json:"runner_id,omitempty"`
// Protocol 3: RevertSHA is the merge commit a revert task undoes; the
// review measures whether the candidate reverts exactly that.
RevertSHA string `json:"revert_sha,omitempty"`
// Protocol 5: HostedChecks offers a checks step on the primary the
// hub's own CI verdict on the candidate, when the repository's hosted
// CI is on (release slice 1). An older runner never gets it.
HostedChecks bool `json:"hosted_checks,omitempty"`
// Protocol 7: Unsandboxed is the task creator's recorded choice to
// run this attempt's checks on this Mac outside the sandbox. Without
// it a Mac whose sandbox is not proven refuses the checks
// (ReasonSandboxUnproven) and runs nothing.
Unsandboxed bool `json:"unsandboxed,omitempty"`
// Protocol 13: Research is a Research step's inputs (Specialist
// research, with no Repo, Branch, BaseSHA or CandidateSHA). Encode
// refuses a Research dispatch below 13 and drops the field from any
// other.
Research *ResearchDispatch `json:"research,omitempty"`
// ResearchNote (protocol 13) is an Engineering or Review step's view of
// the task's latest Research findings: quoted data, never instructions.
ResearchNote *ResearchHandoff `json:"research_note,omitempty"`
// Protocol 14 (the scheduler): the task's priority and deadline, and
// a Run now not yet consumed for this step revision (its id). Encode
// drops all three for an older runner, which never spends.
Priority string `json:"priority,omitempty"`
By *time.Time `json:"by,omitempty"`
Release string `json:"release,omitempty"`
// ReleaseConnection pins Release (protocol 29): the runner admits the
// step on that connection only (ReleaseCommand.Connection).
ReleaseConnection string `json:"release_connection,omitempty"`
// PriorityRevision orders the task's priority and deadline: the
// runner keeps a priority frame's value only while no dispatch carries
// a newer one. Housekeeping marks an attempt housekeeping dispatched:
// it counts as low and never spends, whatever its task's priority or
// a release (§7, Housekeeping).
PriorityRevision int64 `json:"priority_revision,omitempty"`
Housekeeping bool `json:"housekeeping,omitempty"`
// Protocol 16: Publish is a publish step's target (Specialist
// publish; CandidateSHA the merged commit). Encode refuses a publish
// dispatch below 16.
Publish *PublishDispatch `json:"publish,omitempty"`
// Protocol 37: XcodeAccess (XcodeAccessSandboxed or "") gives a Mac
// worker's Engineering the Mach services Xcode needs.
XcodeAccess string `json:"xcode_access,omitempty"`
// ProtocolDesign: the specialist binding of a maker step made by a
// data-defined specialist (Design is a maker on Engineering's step
// kind): its id, the revision and project ("" the team) of its grant,
// and its profile and capabilities, recorded when dispatched. All
// empty for Engineering itself (ValidSpecialistBinding). Encode
// refuses a dispatch carrying any of them below ProtocolDesign.
SpecialistID string `json:"specialist_id,omitempty"`
SpecialistRevision int64 `json:"specialist_revision,omitempty"`
SpecialistProject string `json:"specialist_project,omitempty"`
Profile string `json:"profile,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
// Explore and SpecialistBrief go with a binding only (part of it for
// ValidSpecialistBinding and Encode): the task is an exploration, and
// the specialist's brief as its owner added it (at most
// MaxSpecialistBrief bytes), for the maker's prompt.
Explore bool `json:"explore,omitempty"`
SpecialistBrief string `json:"specialist_brief,omitempty"`
}
// WatchMergeCommand watches a task's branch for its candidate landing on
// the default branch. CandidateSHA "" stops watching the task.
type WatchMergeCommand struct {
Person string `json:"person"`
TaskID string `json:"task_id"`
Repo string `json:"repo"`
Branch string `json:"branch"`
CandidateSHA string `json:"candidate_sha"`
}
// MergedReport says a task's candidate is on the repository's default
// branch now.
type MergedReport struct {
TaskID string `json:"task_id"`
CandidateSHA string `json:"candidate_sha"`
}
// BranchReport is the task branch's head on Amadan as the runner saw it,
// sent when it changes: Head "" means the branch is gone.
type BranchReport struct {
TaskID string `json:"task_id"`
CandidateSHA string `json:"candidate_sha"`
Head string `json:"head"`
}
// CancelStepCommand interrupts one attempt of a step.
type CancelStepCommand struct {
Person string `json:"person"`
TaskID string `json:"task_id"`
StepID string `json:"step_id"`
Attempt int64 `json:"attempt"`
}
// StepReport moves a step attempt forward: running (started, then with
// its candidate), done (pushed), failed or cancelled. Termination is true
// once the attempt's namespace exit was observed. Reason is a fixed code.
type StepReport struct {
// Protocol 31: Engineering file-list facts, presentation only.
ChangeDiffs string `json:"change_diffs,omitempty"`
ChangeFiles *ChangeFiles `json:"change_files,omitempty"`
BaseChecks string `json:"base_checks,omitempty"`
BaseChecksSHA string `json:"base_checks_sha,omitempty"`
Failure *copydesk.Signature `json:"failure,omitempty"`
Copy *CopyResult `json:"copy,omitempty"`
TaskID string `json:"task_id"`
StepID string `json:"step_id"`
Attempt int64 `json:"attempt"`
State string `json:"state"`
Reason string `json:"reason"`
BaseSHA string `json:"base_sha"`
CandidateSHA string `json:"candidate_sha"`
Pushed bool `json:"pushed"`
Termination bool `json:"termination"`
Summary string `json:"summary"`
Headline string `json:"headline"`
LogTail string `json:"log_tail"`
// What ran (family, account binding) and, for checks and review,
// their result on CandidateSHA. Output is the checks' last 200 lines.
Family string `json:"family"`
Account string `json:"account"`
Verdict string `json:"verdict"`
ReviewLabel string `json:"review_label"`
Findings []Finding `json:"findings"`
Checks string `json:"checks"`
Gate string `json:"gate"`
ExitCode *int `json:"exit_code"`
Output string `json:"output"`
// Askable: the runner kept the step's session for questions.
Askable bool `json:"askable"`
// Merge: the commit the hub made on Into with Strategy, once the hub
// confirmed it (done), or what refused it (failed with Reason).
MergeSHA string `json:"merge_sha"`
Into string `json:"into"`
Strategy string `json:"strategy"`
// Usage is the attempt's token use (null for checks and merges);
// Switched is set when the attempt moved to another connection after
// the first was limited (its partial work was discarded).
Usage []Usage `json:"usage"`
Switched *Switched `json:"switched"`
// Protocol 2: how termination was proven (namespace or
// process_group), the commits a worker holds for thin packs, and the
// phase (committed: a worker's candidate, not pushed).
TerminationKind string `json:"termination_kind,omitempty"`
Have []string `json:"have,omitempty"`
Phase string `json:"phase,omitempty"`
// Apple: Engineering's change touched Swift, Objective-C or Xcode
// files, so its checks need macOS.
Apple bool `json:"apple,omitempty"`
// ChecksSandbox is how a worker's checks were confined: seatbelt
// (srt, P2 denied every hostile attempt) or none (they ran outside
// the sandbox, Paul's ruling 2).
ChecksSandbox string `json:"checks_sandbox,omitempty"`
// Protocol 3. Change is what the reviewed change is, measured by the
// runner on exactly the reviewed pair (review steps). MergeSource says
// where a merge's SHA came from (MergeSourceHub: this request's answer)
// and MergeParents are that commit's parents, read after the merge.
Change *ChangeFacts `json:"change,omitempty"`
MergeSource string `json:"merge_source,omitempty"`
MergeParents []string `json:"merge_parents,omitempty"`
// Protocol 5. Hosted binds a checks verdict taken from the hub's
// hosted CI (Gate GateHosted) to what it judged.
Hosted *HostedResult `json:"hosted,omitempty"`
// Protocol 9. HasPreview: Review found release/preview.json on the
// candidate (scheduling evidence only). Preview is a preview step's
// result: built (the exported digest) or done.
HasPreview bool `json:"has_preview,omitempty"`
Preview *PreviewResult `json:"preview,omitempty"`
// Protocol 13. Research is a Research step's result: its findings,
// its fetch log and the images it kept (their bytes travel first, in
// research_file frames).
Research *ResearchResult `json:"research,omitempty"`
// Protocol 14. Hold: the scheduler holds the step (state running;
// the instance keeps it queued until it starts). A report without it
// ends the hold. Encode refuses a held report below 14.
Hold *StepHold `json:"hold,omitempty"`
// Protocol 16. Publish is a publish step's export and, once done, its
// outcome.
Publish *PublishResult `json:"publish,omitempty"`
// Protocol 37. XcodeAccess echoes what Engineering ran with;
// SessionID names the kept Engineering session (from any runner);
// OutcomePhase is what the commit is (OutcomeCommitted,
// OutcomeUnfinished, OutcomeNoShell), apart from Phase.
XcodeAccess string `json:"xcode_access,omitempty"`
SessionID string `json:"session_id,omitempty"`
OutcomePhase string `json:"outcome_phase,omitempty"`
// ProtocolDesign. Options are a Design step's mockup options and the
// captures it names for each (ValidOptions); their bytes travel
// first, in render_file frames. Encode drops them below it.
Options []DesignOption `json:"options,omitempty"`
// ProtocolDesign. Renders are a Design step's render_page calls
// (ValidRenderAudits), on its final report. Encode drops them below
// it.
Renders []RenderAudit `json:"renders,omitempty"`
}
// ReasonRunnerOutdated settles a preview step whose primary connected
// below protocol 9.
const ReasonRunnerOutdated = "runner_outdated"
// PreviewResult is a preview step's word: Phase built with the export's
// digest, files and bytes; then, done, the app, URL, version, the
// platform's expiry and the Outcome (deployed once the marker answered,
// unconfirmed when it never did).
type PreviewResult struct {
Unsafe bool `json:"unsafe,omitempty"`
Phase string `json:"phase"`
App string `json:"app,omitempty"`
URL string `json:"url,omitempty"`
Version string `json:"version,omitempty"`
Digest string `json:"digest"`
Files int `json:"files"`
Bytes int64 `json:"bytes"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
Outcome string `json:"outcome,omitempty"`
}
// Preview phases and outcomes.
const (
PreviewBuilt = "built"
PreviewDone = "done"
PreviewDeployed = "deployed"
PreviewUnconfirmed = "unconfirmed"
)
// GateHosted is the gate a checks report names when its verdict is the
// hub's hosted CI on the candidate, not a gate the runner ran.
const GateHosted = "hosted CI"
// Hosted CI states the hub reports that end a run with a verdict.
const (
HostedSuccess = "success"
HostedFailure = "failure"
)
// HostedResult is a hosted CI verdict as the hub reported it: the
// repository and branch asked about, the tip it judged (the candidate),
// its state, when the hub recorded the run (ReportedAt, Unix seconds; the
// hub exposes no run id) and the units that failed.
type HostedResult struct {
Repo string `json:"repo"`
Branch string `json:"branch"`
SHA string `json:"sha"`
State string `json:"state"`
ReportedAt int64 `json:"reported_at"`
Failed []string `json:"failed"`
}
// MaxHostedFailed bounds the failing units a hosted result names, and
// MaxHostedName each name.
const (
MaxHostedFailed = 20
MaxHostedName = 120
)
// Merge sources: the hub's answer to this request, the default branch
// read after an uncertain answer, or the runner's earlier record.
const (
MergeSourceHub = "hub"
MergeSourceReconciled = "reconciled"
MergeSourceCached = "cached"
)
// ChangeFacts is a reviewed change as the runner measured it, with no
// model: git diff --raw and --numstat of Base..SHA, both paths of every
// entry, and the signing lines of Xcode project files. Complete is false
// when the listings disagree, an error occurred or there were more than
// MaxChangeEntries entries.
type ChangeFacts struct {
GateFilesChanged bool `json:"gate_files_changed,omitempty"`
ReviewTruncated bool `json:"review_truncated,omitempty"`
ReviewStep string `json:"review_step"`
Attempt int64 `json:"attempt"`
Repo string `json:"repo"`
Base string `json:"base"`
SHA string `json:"sha"`
Files int `json:"files"`
Lines int `json:"lines"`
Binary int `json:"binary"`
Special bool `json:"special"`
Signing bool `json:"signing"`
Entries []ChangeEntry `json:"entries"`
Complete bool `json:"complete"`
Revert *RevertCheck `json:"revert,omitempty"`
}
// ChangeEntry is one changed path: its status letter, both paths (Old
// is "" unless renamed or copied) and both modes.
type ChangeEntry struct {
Status string `json:"status"`
Old string `json:"old"`
New string `json:"new"`
OldMode string `json:"old_mode"`
NewMode string `json:"new_mode"`
}
// RevertCheck says whether a revert task's candidate exactly reverts SHA:
// OnTop when its parent is SHA itself, Exact when its tree is SHA's first
// parent's tree.
type RevertCheck struct {
SHA string `json:"sha"`
OnTop bool `json:"on_top"`
Exact bool `json:"exact"`
}
// MaxChangeEntries bounds a ChangeFacts listing.
const MaxChangeEntries = 200
// RecheckCommand asks the runner to check now what its agent reaches.
type RecheckCommand struct {
Person string `json:"person"`
}
// StepRun is a step attempt the runner holds, in sync.
type StepRun struct {
TaskID string `json:"task_id"`
StepID string `json:"step_id"`
Attempt int64 `json:"attempt"`
State string `json:"state"`
CandidateSHA string `json:"candidate_sha"`
}
// ReasonShellUnavailable is a pushed Engineering fix round whose engineer
// ran shell commands and none worked, so it could not check its work
// (stopped-jobs audit, 2026-11-25, fix 4): the round does not count
// against the task's rounds, up to MaxFixRounds such rounds.
const ReasonShellUnavailable = "shell_unavailable"
// DoneOnlyReasons are reasons a runner reports only on a done step, where
// no reason is shown as a stop: on any other state the instance records
// them as unknown, so they need no words of their own.
var DoneOnlyReasons = map[string]bool{ReasonShellUnavailable: true}
// StepReasons are the failure codes a runner may report for a step.
var StepReasons = map[string]bool{
"copy_budget": true,
"copy_budget_unknown": true,
"copy_update_required": true,
"copy_question": true,
"": true,
"cancelled": true,
"runner_restarted": true,
"step_timeout": true,
"provider_failed": true,
"provider_rejected": true,
"policy_rejected": true,
"account_unavailable": true,
"sign_in_again": true,
"no_changes": true,
"workspace_refused": true,
"clone_failed": true,
"push_failed": true,
"proposal_failed": true,
"push_conflict": true,
"superseded": true,
"interrupted": true,
// An Engineering step that committed nothing after Equipo refused
// tool requests it made (no_changes otherwise). An older instance
// records it as unknown.
"tools_refused": true,
// A pushed Engineering fix round whose shell commands all failed: it
// does not count against the task's rounds. An older instance takes
// the step as done.
ReasonShellUnavailable: true,
// Checks and review.
"candidate_unavailable": true,
"no_verdict": true,
"needs_macos": true,
"checks_timeout": true,
"checks_unavailable": true,
"base_gate_unavailable": true,
"base_checks_failed": true,
"preview_secrets": true,
"preview_headers": true,
"preview_header_missing": true,
"preview_scanner": true,
"preview_public_disabled": true,
"preview_host": true,
"needs_network": true,
// Merge: the branch conflicts with the default branch; the branch is
// no longer at the judged SHA; the hub's own CI on the commit is not
// green (still running, or failed); the agent may not merge here; or
// the hub refused it otherwise.
"merge_conflict": true,
"branch_moved": true,
"amadan_ci_pending": true,
"amadan_ci_failed": true,
"merge_forbidden": true,
"merge_failed": true,
// The first merge into an empty repository waits on the hub
// (ReasonMergeUnbornDefault).
ReasonMergeUnbornDefault: true,
// merge_not_authorized: the instance refused the merge request's
// confirmation (merge authority); nothing was sent to the hub.
"merge_not_authorized": true,
// The runner has no usable forge credential for the repository and
// refused the merge itself; nothing was sent to the hub
// (ReasonMergeCredential).
ReasonMergeCredential: true,
// The hub could not confirm write access in time; nothing was sent
// (ReasonAmadanUnreachable).
ReasonAmadanUnreachable: true,
// Previews (protocol 9): the runner is too old (settled at its
// connection); the account's 20 temporary apps are taken; the task's
// preview expired and its name is still in the Trash; the config is
// not one this version uses; the output is over its caps; the
// preview's state could not be read; a Carloku command failed.
ReasonRunnerOutdated: true,
"preview_cap": true,
"preview_expired": true,
"preview_config": true,
"preview_too_large": true,
"preview_state": true,
"preview_failed": true,
// Publishing a site (protocol 16): the runner has no site host; the
// merged commit is not on the default branch; the config or output is
// refused or over its caps; the deploy failed.
"publish_off": true,
"publish_not_merged": true,
"publish_config": true,
"publish_too_large": true,
"publish_failed": true,
// The account already holds the app's name: nothing was deployed.
"publish_app_taken": true,
// Places (protocol 31).
"carlos_outdated": true,
"publish_secrets": true,
"publish_scanner": true,
"publish_key_missing": true,
"publish_mint_failed": true,
"publish_app_missing": true,
"publish_app_unproven": true,
// Connections: the provider refused on quota and no other connection
// could take the attempt over (limited); nothing the person connected
// can run this specialist (no_connection).
"limited": true,
ReasonNoConnection: true,
// Runners (protocol 2): the runner lacks a need of the step; the
// attempt was withdrawn before it started; a pack transfer was
// refused; the runner that fits was offline too long (checks).
"placement_refused": true,
"withdrawn": true,
// The Mac's sandbox is not proven and nobody chose to run outside it:
// nothing ran (protocol 7).
ReasonSandboxUnproven: true,
"transfer_refused": true,
"runner_offline": true,
// Mac Engineering (slice F): the primary could not resolve the base of
// an attempt on a worker; nothing ran. Its commits were too large to
// relay to the Mac (workspace_too_large); it never runs on Linux.
ReasonBaseUnavailable: true,
ReasonWorkspaceTooLarge: true,
// A worker found one of its known secrets (or gitleaks found a
// secret) in the candidate, or could not tell: nothing was uploaded.
// It could not launch Engineering as certified: nothing ran
// (slice F task 12).
ReasonSecretInCandidate: true,
ReasonEngineeringUnavailable: true,
// machine_removed: the runner was removed while the step may have been
// running; nothing proves its end (only Recover settles it).
"machine_removed": true,
// Research (protocol 13): nothing to read, no usable grant, a
// primary too old for it, or one with no address to confirm.
ReasonResearchNoSources: true,
ReasonResearchNoGrant: true,
ReasonResearchUnsupported: true,
ReasonResearchNoInventory: true,
// ReasonUnknown is what the instance records for a reason it does not
// know (a newer runner), rather than refusing the report.
ReasonUnknown: true,
}
// ReasonUnknown stands in for a step reason the instance does not know.
const ReasonUnknown = "unknown"
// ReasonSandboxUnproven is a Mac worker's refusal to run checks outside a
// sandbox it has not proven, without the person's choice: nothing ran and
// the Mac is not tainted. The instance puts the step back to wait.
const ReasonSandboxUnproven = "sandbox_unproven"
// Coordinator tools for tasks.
const (
ToolRecordTask = "record_task"
ToolAddFinding = "add_finding"
ToolStartTask = "start_task"
ToolReadTask = "read_task"
ToolCancelTask = "cancel_task"
// ToolAddReport attaches the person's new report to an existing open
// task instead of recording a duplicate.
ToolAddReport = "add_report"
)
// MaxSimilarTasks bounds the open tasks record_task returns as possibly
// the same problem.
const MaxSimilarTasks = 3
// ReasonMergeUnbornDefault: the hub refused a merge step because the
// repository's default branch has no commits yet and the hub cannot make
// the first merge (before amadan#139). Nothing merged; it waits on the
// platform, never retried on its own (protocol 8).
const ReasonMergeUnbornDefault = "merge_unborn_default"
// ReasonMergeCredential: the runner refused a merge step before contacting
// the hub because no forge credential it holds serves the repository. A
// definite refusal: nothing was sent, and a later Merge may try again
// once the credential is there. An older instance records it as unknown.
const ReasonMergeCredential = "merge_credential"
// ReasonAmadanUnreachable: the hub could not be asked whether the runner
// may still write to the repository, for longer than the merge waits.
// Nothing was sent; a later Merge may try again. An older instance records
// it as unknown.
const ReasonAmadanUnreachable = "amadan_unreachable"
// Maker is a data-defined specialist that makes a task's work: its id
// (GET /api/v1/specialists) and its profile (design-v1).
type Maker struct {
ID string `json:"id"`
Profile string `json:"profile"`
}
// Category is the specialist a maker is, as the apps name one: its
// profile without the version (design for design-v1).
func (m *Maker) Category() string {
if m == nil {
return ""
}
if i := strings.LastIndex(m.Profile, "-v"); i > 0 {
return m.Profile[:i]
}
return m.Profile
}