Documentation
¶
Overview ¶
Package client is a thin HTTP client for the gofer control plane. It mirrors the /v1/jobs API (plan §7) and reuses the job package's JobRequest/JobResult structs as the wire types so the CLI (P6) and the MCP server (P8) share one transport.
Index ¶
- Constants
- Variables
- func EnrollSecretHash(secret string) string
- func IsNotifyTargetRejected(err error) bool
- func MatchProjectPath(projects []ProjectMeta, cwd string) (key, root string, ok bool)
- func NewEnrollSecret() (secret, hash string, err error)
- func NormalizeBaseURL(addr string) string
- func ResolveCurrentSessionID(getenv func(string) string) (string, error)
- func SessionIDFromEnv(getenv func(string) string) (id, source string)
- func SetRequestLogPath(path string)
- func StatusOf(err error) int
- type APIResponse
- type AdminAuditEntry
- type AdminAuditPage
- type AdminAuditQuery
- type AgentHealth
- type AgentMeta
- type AgentProbe
- type AgentSession
- type AssignableProject
- type AuthCatalog
- type AuthCatalogEntry
- type AuthCeiling
- type AuthGrant
- type AuthPermission
- type AuthPreset
- type AuthRoute
- type AuthWhoami
- type Caller
- type CallerAddRequest
- type CallerAuditEntry
- type CallerCeiling
- type CallerCeilingRequest
- type CallerChange
- type CallerLimitsRequest
- type Client
- func (c *Client) AcceptEnrollment(id, pairingCode, workerID string, labels, projects []string) (EnrollAccepted, error)
- func (c *Client) AcceptJob(id, note string) (job.ReviewOutcome, error)
- func (c *Client) AcceptJobWithoutDelivery(id, note string) (job.ReviewOutcome, error)
- func (c *Client) AcceptMemoryCandidate(id int64, in job.AcceptMemoryCandidateInput) (job.MemoryCandidateDecision, error)
- func (c *Client) AcceptMergeSuggestion(id int64) (work.DetailView, error)
- func (c *Client) AcceptWorkSuggestion(id, field string) (work.DetailView, error)
- func (c *Client) AckMail(id int64) (Mail, error)
- func (c *Client) AddCaller(req CallerAddRequest) (CallerChange, error)
- func (c *Client) AddSessionJobWatch(sid, jobID string) (SessionJobWatch, error)
- func (c *Client) AddTodo(planID, title, jobID, note string, patch jobstore.TodoPatch) (Todo, error)
- func (c *Client) AddWorkNote(id, text, level string) error
- func (c *Client) AnswerDecision(id, answer string) (Decision, error)
- func (c *Client) AnswerInteraction(jobID, interactionID, answer string) (job.Interaction, error)
- func (c *Client) AnswerSessionPermission(sid, id, answer string) (Decision, error)
- func (c *Client) ApprovalURL(id, reported string) string
- func (c *Client) ApproveJob(id, note string) (job.JobResult, error)
- func (c *Client) ArchiveAutoWork(dryRun bool) (work.ArchiveResult, error)
- func (c *Client) AskDecision(planID, title, question string, options []string, timeoutSec int64) (Decision, error)
- func (c *Client) AttachJob(planID, jobID string) (Plan, error)
- func (c *Client) AttachWorkSession(id, sid string) (work.DetailView, error)
- func (c *Client) AuthCatalog() (AuthCatalog, error)
- func (c *Client) AuthRoutes() ([]AuthRoute, error)
- func (c *Client) BackgroundAgents() (bgagent.View, error)
- func (c *Client) BaseURL() string
- func (c *Client) BindSeat(id, ref string, replace bool) (Seat, error)
- func (c *Client) CancelEnroll(id, secret string) error
- func (c *Client) CancelJob(id string) (job.JobResult, error)
- func (c *Client) CancelMail(id int64) (Mail, error)
- func (c *Client) CancelRetry(id string) error
- func (c *Client) CancelWorkflow(id string) (Workflow, error)
- func (c *Client) CaptureWork(text, kind, project, workspace string) (work.DetailView, error)
- func (c *Client) ClaimSessionMail(sid string, take MailTake) (MailClaim, error)
- func (c *Client) CloseJobPreview(jobID, previewID string) (JobPreview, error)
- func (c *Client) CompleteSessionMailTurn(sid, turnID string, take MailTake) (bool, []TakenMail, error)
- func (c *Client) CompleteSessionWatchTurn(sid, turnID string, jobIDs []string) (bool, error)
- func (c *Client) CompleteSessionWatches(sid string, jobIDs []string) (bool, error)
- func (c *Client) ConfirmEnroll(id, secret string) error
- func (c *Client) ConfirmSessionMail(sid string, ids []int64) ([]int64, error)
- func (c *Client) CreateInteraction(jobID string, req CreateInteractionRequest) (job.Interaction, error)
- func (c *Client) CreateJobPreview(id string, port, ttl int) (JobPreview, error)
- func (c *Client) CreatePlan(planID, title, description, project, leader string, tags ...[]string) (Plan, error)
- func (c *Client) CreatePlanAutoSupervisor(planID, title, description, project, leader string, tags []string, ...) (Plan, SupervisorAutoBind, error)
- func (c *Client) CreatePlanWithSupervisorSession(planID, title, description, project, leader, supervisorSessionID string, ...) (Plan, error)
- func (c *Client) CreateSchedule(req CreateScheduleRequest) (Schedule, error)
- func (c *Client) CreateScopedMemory(scope, scopeKey, key, content string, tags []string, meta *tracker.MemoryMeta) (ScopedMemory, error)
- func (c *Client) CreateSeat(in SeatCreate) (Seat, error)
- func (c *Client) CreateSessionNudge(sid, kind string, intervalSec int64, text string, untilAt int64) (SessionNudge, error)
- func (c *Client) CreateWakeup(jobID string, spec job.WakeupSpec) (Wakeup, error)
- func (c *Client) CreateWorkItem(fields map[string]any) (work.DetailView, error)
- func (c *Client) DeleteJob(id string) error
- func (c *Client) DeleteSchedule(id string) error
- func (c *Client) DeleteScopedMemory(scope, scopeKey, key string) error
- func (c *Client) DeleteSeat(id string) error
- func (c *Client) DeleteSession(sid string) error
- func (c *Client) DeleteSessionNudge(id string) error
- func (c *Client) DeleteTrackerRepo(trackerID string) (TrackerDeleteResult, error)
- func (c *Client) DeleteTunnelPreset(name string) error
- func (c *Client) DeleteWakeup(id string) error
- func (c *Client) DeleteWorkItems(ids []string, status string) (work.DeleteResult, error)
- func (c *Client) DeleteWorkflowTemplate(name, scope, project string) (workflow.TemplateWriteResult, error)
- func (c *Client) DeliverJob(id, mode string, draft *bool, branch string) (job.DeliveryResult, error)
- func (c *Client) DeliverSession(sid, text string, allowTakeover bool) (SessionDeliverResult, error)
- func (c *Client) DetachWorkSession(id, sid string) (work.DetailView, error)
- func (c *Client) DialTunnel(ctx context.Context, workerID, target string, networks ...string) (TunnelConn, error)
- func (c *Client) DisableCaller(id string) (CallerChange, error)
- func (c *Client) DisablePlanDriver(planID string) (job.PlanDriverStatus, error)
- func (c *Client) DismissMergeSuggestion(id int64) error
- func (c *Client) DismissWorkSuggestion(id, field string) (work.DetailView, error)
- func (c *Client) DispatchTodo(todoID string) (TodoDispatch, error)
- func (c *Client) DispatchWork(id, to, sessionID, jobID, planID, newPlanTitle, trackerID, title string) (work.DetailView, error)
- func (c *Client) DoRaw(method, path string, body []byte, contentType string) (APIResponse, error)
- func (c *Client) DropFollowUp(id string, followUpID int64) error
- func (c *Client) EnableCaller(id string) (CallerChange, error)
- func (c *Client) EndJob(id string) (job.JobResult, error)
- func (c *Client) EndMailAgent(name, project string) error
- func (c *Client) Enroll(req EnrollRequest) (EnrollTicket, error)
- func (c *Client) ExportSettings() ([]byte, error)
- func (c *Client) ExportWorkflow(id string) (workflow.Spec, bool, error)
- func (c *Client) FindSessions(o SessionFindOpts) ([]SessionFound, error)
- func (c *Client) FlagScopedMemory(scope, scopeKey, key, reason, jobID string) (ScopedMemory, error)
- func (c *Client) GetDecision(id string) (Decision, error)
- func (c *Client) GetInteractions(id string) ([]job.Interaction, error)
- func (c *Client) GetJob(id string) (job.JobResult, error)
- func (c *Client) GetJobDiagnosis(id string) (job.Diagnosis, error)
- func (c *Client) GetJobDiffFull(id string) (string, error)
- func (c *Client) GetJobRequest(id string) (job.JobRequest, error)
- func (c *Client) GetJobReviewHints(id string) (job.ReviewHints, error)
- func (c *Client) GetJobTranscript(id string, q streaming.TranscriptQuery) (streaming.JobTranscriptPage, error)
- func (c *Client) GetJobWorktree(id string) (job.WorktreeStatus, error)
- func (c *Client) GetLogs(id, stream string) (string, error)
- func (c *Client) GetLogsTail(id, stream string, maxBytes int) (string, error)
- func (c *Client) GetLogsWindow(id string, opts LogOpts) (string, error)
- func (c *Client) GetMail(id int64) (Mail, error)
- func (c *Client) GetMailConversation(id, box string) (MailConversation, error)
- func (c *Client) GetMemorySynthesis(id string) (jobstore.MemorySynthesisRun, error)
- func (c *Client) GetPlan(id string) (Plan, error)
- func (c *Client) GetPlanDriver(planID string) (job.PlanDriverStatus, error)
- func (c *Client) GetPlanDriverReport(planID string) (job.PlanDriverReport, error)
- func (c *Client) GetPlanHandoff(id string, version int) (PlanHandoff, error)
- func (c *Client) GetSchedule(id string) (Schedule, error)
- func (c *Client) GetScopedMemory(scope, scopeKey, key string) (ScopedMemory, error)
- func (c *Client) GetSeat(id string) (Seat, error)
- func (c *Client) GetServerTZOffset() (offset int, ok bool, err error)
- func (c *Client) GetSession(sid string, limit int, before string) (SessionDetail, error)
- func (c *Client) GetSetting(key string) (SettingItem, error)
- func (c *Client) GetStage(workItemID string) (stage.View, error)
- func (c *Client) GetTemplate(projectKey, name string, vars map[string]string) (template.Preview, error)
- func (c *Client) GetTrigger(name string) (trigger.View, error)
- func (c *Client) GetTunnelPreset(name string) (TunnelPreset, error)
- func (c *Client) GetUsageStats() (StatsUsage, error)
- func (c *Client) GetWakeup(id string) (Wakeup, error)
- func (c *Client) GetWorkItem(id string) (work.DetailView, error)
- func (c *Client) GetWorker(id string) (WorkerDetail, error)
- func (c *Client) GetWorkerProjects(id string) (WorkerDetail, error)
- func (c *Client) GetWorkflow(id string) (Workflow, error)
- func (c *Client) GetWorkflowTemplateSource(name, project string) (workflow.TemplateSource, error)
- func (c *Client) HealthChecks() ([]HealthCheck, error)
- func (c *Client) HeartbeatSession(sid string, hb SessionHeartbeat) (AgentSession, error)
- func (c *Client) HeartbeatTunnelForwarder(id string, specs []TunnelSpecView) (TunnelForwarder, error)
- func (c *Client) ImportLocalTunnelPreset(name string) (TunnelPreset, error)
- func (c *Client) ImportSettings(doc []byte, dryRun bool) (SettingImport, error)
- func (c *Client) InvokeTrigger(name string, body []byte, headers map[string]string) (TriggerInvokeResult, error)
- func (c *Client) IssueGet(id, trackerID string) (IssueGetResp, error)
- func (c *Client) IssueList(o IssueListOpts) (IssueListResp, error)
- func (c *Client) LinkWork(id, kind, ref string) (work.DetailView, error)
- func (c *Client) LinkWorkRole(id, kind, ref, role string) (work.DetailView, error)
- func (c *Client) ListAdminAudit(q AdminAuditQuery) (AdminAuditPage, error)
- func (c *Client) ListAgents() ([]AgentMeta, error)
- func (c *Client) ListArtifacts(id string) (json.RawMessage, error)
- func (c *Client) ListCallerAudit(limit int) ([]CallerAuditEntry, error)
- func (c *Client) ListCallers() ([]Caller, error)
- func (c *Client) ListComments(scope, id string) ([]Comment, error)
- func (c *Client) ListDecisions(state, planID string) ([]Decision, error)
- func (c *Client) ListEnrollments() (EnrollmentList, error)
- func (c *Client) ListFollowUps(id string) ([]FollowUp, error)
- func (c *Client) ListJobEvents(id string) ([]jobstore.JobEvent, error)
- func (c *Client) ListJobPreviews(id string) ([]JobPreview, error)
- func (c *Client) ListJobs(opts job.ListOpts) ([]job.JobResult, error)
- func (c *Client) ListLocalTunnelPresets() ([]TunnelPreset, error)
- func (c *Client) ListMail(o MailListOpts) ([]Mail, error)
- func (c *Client) ListMailAgents() (MailAgents, error)
- func (c *Client) ListMemoryCandidates(o MemoryCandidateListOpts) ([]jobstore.MemoryCandidate, error)
- func (c *Client) ListMemorySyntheses(o MemorySynthesisListOpts) ([]jobstore.MemorySynthesisRun, error)
- func (c *Client) ListMergeSuggestions() ([]jobstore.WorkMergeSuggestion, error)
- func (c *Client) ListOpenStages(projectKey string) ([]stage.View, error)
- func (c *Client) ListPendingInteractions() ([]job.Interaction, error)
- func (c *Client) ListPlanHandoffHistory(id string) ([]PlanHandoff, error)
- func (c *Client) ListPlans(opts PlanListOpts) (PlanList, error)
- func (c *Client) ListProjects() ([]ProjectMeta, error)
- func (c *Client) ListRefs(kind, id string) ([]Ref, error)
- func (c *Client) ListRetries(jobID string) ([]Retry, error)
- func (c *Client) ListRunners() ([]RunnerMeta, error)
- func (c *Client) ListScheduleEvents(id string, limit int, before int64) ([]ScheduleEvent, error)
- func (c *Client) ListSchedules(project string) ([]Schedule, error)
- func (c *Client) ListScopedMemories(opts ScopedMemoryListOpts) ([]ScopedMemory, error)
- func (c *Client) ListSeats(o SeatListOpts) ([]Seat, error)
- func (c *Client) ListSessionJobWatches(sid string) ([]SessionJobWatch, error)
- func (c *Client) ListSessionMessages(sid string) ([]SessionMessage, error)
- func (c *Client) ListSessionNudges(sid string, all bool) ([]SessionNudge, error)
- func (c *Client) ListSessionWatches(sid string) (SessionWatches, error)
- func (c *Client) ListSessions(opts SessionListOpts) ([]AgentSession, error)
- func (c *Client) ListSettings() ([]SettingItem, error)
- func (c *Client) ListTemplates(projectKey string) ([]template.Info, error)
- func (c *Client) ListTrackerRepos() ([]TrackerRepo, error)
- func (c *Client) ListTrackerSyncClients(trackerID string) ([]TrackerSyncClient, error)
- func (c *Client) ListTriggers() ([]trigger.View, error)
- func (c *Client) ListTunnelForwarders() ([]TunnelForwarder, error)
- func (c *Client) ListTunnelPresets() ([]TunnelPreset, error)
- func (c *Client) ListTunnels() ([]TunnelInfo, error)
- func (c *Client) ListWakeups(jobID string) ([]Wakeup, error)
- func (c *Client) ListWorkItems(o WorkListOpts) (WorkList, error)
- func (c *Client) ListWorkRequests(id string, activeOnly bool, limit int) ([]jobstore.WorkRequest, error)
- func (c *Client) ListWorkers() ([]WorkerMeta, error)
- func (c *Client) ListWorkflowEvents(id string, sinceSeq int64) ([]WorkflowEvent, error)
- func (c *Client) ListWorkflowTemplates(name, project string) ([]workflow.WorkflowTemplate, error)
- func (c *Client) ListWorkflows(status string) ([]Workflow, error)
- func (c *Client) ListWorkflowsFiltered(status, template string) ([]Workflow, error)
- func (c *Client) LookupCurrentAgentSession(getenv func(string) string, project string) SupervisorAutoBind
- func (c *Client) MCPServer(name string) (MCPServerInfo, error)
- func (c *Client) MCPServers() ([]MCPServerInfo, error)
- func (c *Client) MemoryFindings(trackerID string) ([]today.MemoryFinding, error)
- func (c *Client) MergeJobWorktree(id string, opts job.MergeOptions) (job.MergeResult, error)
- func (c *Client) MergeSuggest(targetID, sourceID, reason string) (jobstore.WorkMergeSuggestion, bool, error)
- func (c *Client) MergeWorkItems(target string, sources []string) (work.DetailView, error)
- func (c *Client) Meta() (Meta, error)
- func (c *Client) OpenSessionPermission(sid string, p SessionPermission) (Decision, error)
- func (c *Client) OpenSessionTurn(sid, msg string, timeoutSec int64, needsReply bool) (Decision, error)
- func (c *Client) OpenStream(ctx context.Context, id string) (*http.Response, error)
- func (c *Client) PatchSchedule(id string, req PatchScheduleRequest) (Schedule, error)
- func (c *Client) PatchSeat(id string, p SeatPatch) (Seat, error)
- func (c *Client) PatchSession(sid string, p SessionTopicPatch) (AgentSession, error)
- func (c *Client) PatchTodo(todoID string, u TodoUpdate) (Todo, error)
- func (c *Client) PatchWorkItem(id string, fields map[string]any) (work.DetailView, error)
- func (c *Client) PausePlan(planID string) (Plan, error)
- func (c *Client) PickWorkflowFan(id string, step, fan int) (Workflow, error)
- func (c *Client) PollEnroll(id, secret string, wait time.Duration) (EnrollPoll, error)
- func (c *Client) PostComment(scope, id, body string) (Comment, error)
- func (c *Client) PostSessionReply(sid, text, to string) (SessionMessage, error)
- func (c *Client) PreviewDelivery(id, mode string, draft *bool, branch string) (job.DeliveryPreview, error)
- func (c *Client) ProbeAgent(key, project string, timeoutSec int) (AgentProbe, error)
- func (c *Client) PuntInteraction(jobID, interactionID string) error
- func (c *Client) PutScopedMemory(scope, scopeKey, key, content string, tags []string, title string) (ScopedMemory, error)
- func (c *Client) PutStewardNotes(body string, version int) (StewardNotesResp, error)
- func (c *Client) PutTunnelPreset(name string, p TunnelPreset, force bool) (TunnelPreset, error)
- func (c *Client) QueueFollowUp(id, prompt string, reviewEach bool) (FollowUp, error)
- func (c *Client) ReadMail(id int64) (Mail, error)
- func (c *Client) ReaddressMail(id int64, to string) (MailSent, error)
- func (c *Client) RebuildJob(id string, ov job.RebuildOverrides) (job.JobResult, error)
- func (c *Client) RedactJob(id string, req JobRedactRequest) (jobstore.RedactReport, error)
- func (c *Client) RedactJobSecrets(req JobSecretScanRequest) (jobstore.SecretBatchRedactReport, error)
- func (c *Client) RedactMail(id int64, req MailRedactRequest) (jobstore.RedactReport, error)
- func (c *Client) RegisterSession(in SessionRegister) (AgentSession, error)
- func (c *Client) RegisterTunnelForwarder(reg TunnelForwarderRegistration) (TunnelForwarder, error)
- func (c *Client) RegisterWorker(id string, labels, projects []string) (WorkerRegistration, error)
- func (c *Client) RejectEnrollment(id, reason string, blockSourceMin int) error
- func (c *Client) RejectJob(id, note string, resume bool) (job.ReviewOutcome, error)
- func (c *Client) RejectMemoryCandidate(id int64) (jobstore.MemoryCandidate, error)
- func (c *Client) ReleaseSessionTakeover(sid string) (AgentSession, error)
- func (c *Client) ReleaseSessionTurn(sid, decisionID string, idleSec int64) (bool, error)
- func (c *Client) ReloadConfig() (ConfigReload, error)
- func (c *Client) ReloadWorker(workerID, reason string, wait time.Duration) (WorkerReload, error)
- func (c *Client) RemoveJobWorktree(id string, force, deleteBranch bool) (job.WorktreeStatus, error)
- func (c *Client) RemoveSessionJobWatch(sid, jobID string) error
- func (c *Client) RemoveWorker(id string) error
- func (c *Client) RenameTrackerRepo(oldID, newID string) (TrackerRenameResult, error)
- func (c *Client) RenewAuthGrant(id string, expiresSec int64) (AuthGrant, error)
- func (c *Client) RenewJobPreview(jobID, previewID string, ttl int) (JobPreview, error)
- func (c *Client) ReplyMail(id int64, body string, urgent bool) (MailSent, error)
- func (c *Client) ReportWork(id string, fields map[string]any) (work.DetailView, error)
- func (c *Client) ReportWorkBySession(fields map[string]any) (out work.DetailView, created bool, err error)
- func (c *Client) RequestWorkReport(id, sessionID, kind string) (bool, []WorkReportRequestResult, error)
- func (c *Client) RerunWorkflow(id, mode, step string) (Workflow, error)
- func (c *Client) ResetBackgroundAgent(kind string) (bgagent.ResetView, error)
- func (c *Client) ResetSetting(key string) (SettingReset, error)
- func (c *Client) ResolveSessionPermission(sid, fp string) (int, error)
- func (c *Client) RespondMail(id int64, done bool) (Mail, error)
- func (c *Client) RestartSeat(id string) (SeatOpenPlan, error)
- func (c *Client) ResumeJob(id, prompt, runner string) (job.JobResult, error)
- func (c *Client) ResumeJobWith(id, prompt, runner string, opts job.ResumeOptions) (job.JobResult, error)
- func (c *Client) ResumePlan(planID string) (Plan, error)
- func (c *Client) ResumeSession(sid, input string) (SessionDeliverResult, error)
- func (c *Client) RotateCaller(id, expires string) (CallerChange, error)
- func (c *Client) RotateScheduleToken(id string) (Schedule, error)
- func (c *Client) RuleList() ([]rule.Rule, error)
- func (c *Client) RuleRemove(name string) error
- func (c *Client) RuleSet(name string, content []byte) (RuleView, error)
- func (c *Client) RuleShow(name string) (RuleView, error)
- func (c *Client) RunMemorySynthesis(o MemorySynthesisRunOpts) (MemorySynthesisRunResult, error)
- func (c *Client) RunPlan(planID string) (Plan, error)
- func (c *Client) RunSchedule(id string, params map[string]string) (job.JobResult, error)
- func (c *Client) RunnersOverview() (RunnersOverview, error)
- func (c *Client) SaveWorkflowAsTemplate(id, name, scope, project string) (workflow.TemplateWriteResult, error)
- func (c *Client) SaveWorkflowTemplate(name, content, scope, project string) (workflow.TemplateWriteResult, error)
- func (c *Client) SayJob(id, message string) (job.JobResult, error)
- func (c *Client) SaySession(sid, answer string) (Decision, error)
- func (c *Client) ScanJobSecrets(req JobSecretScanRequest) (jobstore.SecretScanReport, error)
- func (c *Client) SeatCandidates(sessionID string) ([]Seat, error)
- func (c *Client) SeatOpenPlan(id string) (SeatOpenPlan, error)
- func (c *Client) SendHeldSessionMessages(sid string) error
- func (c *Client) SendMail(to, body string, urgent bool) (MailSent, error)
- func (c *Client) SendMailTo(to []string, body string, urgent bool) (MailSent, error)
- func (c *Client) SendSessionMessage(sid, message string) (SessionMessage, error)
- func (c *Client) SessionAsk(sid, text, workID string) (work.AskResult, error)
- func (c *Client) SessionFocus(sid string) (SessionFocus, error)
- func (c *Client) SessionID() (id, source string)
- func (c *Client) SessionScreen(sid string, n int) (SessionScreen, error)
- func (c *Client) SessionTail(sid string, bytes int64) (work.SessionTailResult, error)
- func (c *Client) SessionTakeoverPlan(sid string) (SessionResumePlan, error)
- func (c *Client) SetCallerCeiling(id string, req CallerCeilingRequest) (CallerChange, error)
- func (c *Client) SetCallerLimits(id string, req CallerLimitsRequest) (CallerChange, error)
- func (c *Client) SetJobTitle(id, title string) (job.JobResult, error)
- func (c *Client) SetPlanCompleteOn(planID, completeOn string) (Plan, error)
- func (c *Client) SetPlanDriver(planID, level string, budget job.PlanDriverBudget) (job.PlanDriverStatus, error)
- func (c *Client) SetPlanHandoff(id, body string, expectedVersion int) (PlanHandoff, error)
- func (c *Client) SetPlanLeader(planID, leader string) (Plan, error)
- func (c *Client) SetPlanNotify(planID, notify string) (Plan, error)
- func (c *Client) SetPlanSupervisorSessionID(planID string, sessionID *string) (Plan, error)
- func (c *Client) SetScheduleEnabled(id string, enable bool) (Schedule, error)
- func (c *Client) SetSessionInjectMode(sid, mode string) (AgentSession, error)
- func (c *Client) SetSessionMailPaused(sid string, paused bool) (AgentSession, error)
- func (c *Client) SetSessionNudgeState(id, state string) (SessionNudge, error)
- func (c *Client) SetSessionOwner(sid, callerID string) (AgentSession, error)
- func (c *Client) SetSessionRelayMode(sid, mode string) (AgentSession, error)
- func (c *Client) SetSetting(key string, value any) (SettingItem, error)
- func (c *Client) SetWakeupEnabled(id string, enabled bool) (Wakeup, error)
- func (c *Client) SkillExport(name string, w io.Writer) error
- func (c *Client) SkillImportFile(path string) (SkillImportResult, error)
- func (c *Client) SkillImportSource(src string) (SkillImportResult, error)
- func (c *Client) SkillList() ([]skill.Skill, error)
- func (c *Client) SkillRemove(name string) error
- func (c *Client) SkillShow(name string) (SkillView, error)
- func (c *Client) SkillUpdate(name string) (SkillUpdateResult, error)
- func (c *Client) SplitWorkItem(id, title, goal string, sessionIDs []string, keep bool) (WorkSplitResult, error)
- func (c *Client) StageApprove(workItemID string) (stage.Result, error)
- func (c *Client) StageBack(workItemID, reason string) (stage.View, error)
- func (c *Client) StageBlocked(workItemID, reason string) (stage.View, error)
- func (c *Client) StageDone(workItemID string) (stage.Result, error)
- func (c *Client) StageDrop(workItemID, reason string) (stage.View, error)
- func (c *Client) StageStartByIssue(issue, template, projectKey, title, sessionID string) (stage.View, error)
- func (c *Client) StageStartOn(workItemID, issue, template, sessionID string) (stage.View, error)
- func (c *Client) StageWorkerUpgrade(id, path string) (sha256 string, size int64, err error)
- func (c *Client) StartHostedTunnelForwarder(name string) (TunnelForwarder, string, error)
- func (c *Client) StartWorkerUpgrade(id string, opt WorkerUpgradeOptions) (WorkerUpgradeRecord, error)
- func (c *Client) StatsBackfill(req StatsBackfillRequest) (StatsBackfillResult, error)
- func (c *Client) StewardAsk(text string) (steward.AskResult, error)
- func (c *Client) StewardNotes(version int) (StewardNotesResp, error)
- func (c *Client) StewardNotesHistory() ([]steward.Notes, error)
- func (c *Client) StewardObservations(limit int) ([]jobstore.StewardObservation, error)
- func (c *Client) StewardRestart() (steward.StartResult, error)
- func (c *Client) StewardReview(force bool) (steward.ReviewResult, error)
- func (c *Client) StewardReviewSummary(text string) error
- func (c *Client) StewardStart() (steward.StartResult, error)
- func (c *Client) StewardStatus() (StewardState, error)
- func (c *Client) StewardStop() (bool, error)
- func (c *Client) StopHostedTunnelForwarder(name string) error
- func (c *Client) StopTunnelForwarder(id string) (TunnelForwarder, error)
- func (c *Client) StreamJob(ctx context.Context, id string, from int, onEvent func(SSEEvent)) error
- func (c *Client) SubmitJob(req job.JobRequest) (job.JobResult, error)
- func (c *Client) SubmitJobResult(id string, in job.SelfResultInput) (job.JobResult, error)
- func (c *Client) SubmitJobSync(req job.JobRequest) (SubmitResult, error)
- func (c *Client) SubmitMarkdown(body []byte) (SubmitResult, error)
- func (c *Client) SubmitWorkflow(spec workflow.Spec) (Workflow, error)
- func (c *Client) SubmitWorkflowTemplate(name, project string, vars map[string]string) (Workflow, error)
- func (c *Client) SummarizeWork(id string) (jobstore.WorkRequest, error)
- func (c *Client) SyncTrackerRepo(trackerID string) (TrackerRepoSyncResult, error)
- func (c *Client) Today(includeExec bool) (today.Response, error)
- func (c *Client) TodayAdvise(in today.AdviceInput) (today.Advice, error)
- func (c *Client) Token() string
- func (c *Client) TriggerDeliveries(name string, limit int) ([]trigger.DeliveryView, error)
- func (c *Client) UnbindSeat(id string) (Seat, error)
- func (c *Client) UnflagScopedMemory(scope, scopeKey, key string) (ScopedMemory, error)
- func (c *Client) UnlinkWork(id, kind, ref string) (work.DetailView, error)
- func (c *Client) UnregisterTunnelForwarder(id string) error
- func (c *Client) UpdatePlan(planID, status string, progress *int) (Plan, error)
- func (c *Client) UpdatePlanTags(planID string, tags *[]string, untag []string) (Plan, error)
- func (c *Client) UpdateTodo(todoID string, done bool) (Todo, error)
- func (c *Client) WaitSession(sid string, until []string, timeout time.Duration) (SessionWaitResult, error)
- func (c *Client) WaitSessionTurn(sid, decisionID string, waitSec int) (TurnStatus, error)
- func (c *Client) WatchJob(ctx context.Context, id string, from int, h WatchHandlers) (final string, err error)
- func (c *Client) WatchWorkflow(ctx context.Context, id string, onStep func(st WorkflowStep)) (Workflow, error)
- func (c *Client) Whoami() (AuthWhoami, error)
- func (c *Client) WorkDigest(send bool) (work.Digest, int, error)
- func (c *Client) WorkDispatchTargets(id string) ([]WorkDispatchTarget, error)
- func (c *Client) WorkSummarizerStatus() (map[string]any, error)
- func (c *Client) WorkToTodo(id, planID, newPlanTitle string) (WorkToTodoResult, error)
- func (c *Client) WorkerAssignable(workerID string) (WorkerAssignable, error)
- func (c *Client) XferDownload(ctx context.Context, id, destPath string) (int64, string, error)
- func (c *Client) XferGet(ctx context.Context, runner, project, path string) (XferRecord, error)
- func (c *Client) XferList(state, runner string) ([]XferRecord, error)
- func (c *Client) XferPrecheck(ctx context.Context, runner, project, path string, size int64, force bool) error
- func (c *Client) XferPut(ctx context.Context, runner, project, path, localPath string, force bool, ...) (XferRecord, error)
- func (c *Client) XferRemove(id string) error
- func (c *Client) XferStage(ctx context.Context, runner, project, path, localPath string) (XferRecord, error)
- func (c *Client) XferStatus(id string) (XferRecord, error)
- type Comment
- type CommentDispatch
- type ConfigReload
- type CreateInteractionRequest
- type CreateScheduleRequest
- type Decision
- type EnrollAccepted
- type EnrollHost
- type EnrollPoll
- type EnrollRequest
- type EnrollTicket
- type Enrollment
- type EnrollmentList
- type ErrStewardNotesConflict
- type FollowUp
- type HealthCheck
- type IssueBrief
- type IssueGetResp
- type IssueListOpts
- type IssueListResp
- type JobPreview
- type JobRedactRequest
- type JobSecretScanRequest
- type LogOpts
- type MCPServerInfo
- type Mail
- type MailAgents
- type MailBroadcast
- type MailBroadcastRecipient
- type MailCandidate
- type MailClaim
- type MailConversation
- type MailListOpts
- type MailParty
- type MailRedactRequest
- type MailResidentAgent
- type MailResidentSession
- type MailSent
- type MailTake
- type MemoryCandidateListOpts
- type MemorySynthesisListOpts
- type MemorySynthesisRunOpts
- type MemorySynthesisRunResult
- type Meta
- type MetaAgent
- type MetaRunner
- type PatchScheduleRequest
- type PermissionSuggestionLabel
- type Plan
- type PlanHandoff
- type PlanLeaderRound
- type PlanList
- type PlanListOpts
- type PlanSessionUsage
- type PlanUsage
- type ProjectMeta
- type Ref
- type RetriesResp
- type Retry
- type RuleView
- type RunnerAgentMeta
- type RunnerCapabilities
- type RunnerMeta
- type RunnerServer
- type RunnerTool
- type RunnerWorkerBrief
- type RunnerWorkerDetail
- type RunnersOverview
- type SSEEvent
- type Schedule
- type ScheduleEvent
- type ScopedMemory
- type ScopedMemoryListOpts
- type Seat
- type SeatCreate
- type SeatListOpts
- type SeatOpenPlan
- type SeatPatch
- type SessionCandidate
- type SessionDeliverResult
- type SessionDetail
- type SessionFindOpts
- type SessionFocus
- type SessionFocusMail
- type SessionFocusPlan
- type SessionFound
- type SessionHeartbeat
- type SessionHit
- type SessionJobWatch
- type SessionListOpts
- type SessionMessage
- type SessionNudge
- type SessionPermission
- type SessionQuestion
- type SessionQuestionOption
- type SessionRegister
- type SessionResumePlan
- type SessionScreen
- type SessionSeat
- type SessionTopicPatch
- type SessionWaitResult
- type SessionWatches
- type SettingChange
- type SettingImport
- type SettingItem
- type SettingReset
- type SkillImportResult
- type SkillUpdateResult
- type SkillView
- type StatsBackfillRequest
- type StatsBackfillResult
- type StatsUsage
- type StatusError
- type StewardNotesResp
- type StewardSettings
- type StewardState
- type SubmitResult
- type SupervisorAutoBind
- type TakenMail
- type Todo
- type TodoDispatch
- type TodoJob
- type TodoUpdate
- type TrackerDeleteResult
- type TrackerRenameResult
- type TrackerRepo
- type TrackerRepoSyncResult
- type TrackerSyncClient
- type TriggerInvokeResult
- type TunnelConn
- type TunnelError
- type TunnelForwarder
- type TunnelForwarderRegistration
- type TunnelInfo
- type TunnelPreset
- type TunnelSpecView
- type TurnStatus
- type UsageAgent
- type UsageWindow
- type Wakeup
- type WakeupsResp
- type WatchHandlers
- type WorkDispatchTarget
- type WorkList
- type WorkListOpts
- type WorkReportRequestResult
- type WorkSplitResult
- type WorkTargetHit
- type WorkToTodoResult
- type WorkerAssignable
- type WorkerCaps
- type WorkerDetail
- type WorkerMeta
- type WorkerRegistration
- type WorkerReload
- type WorkerReplaced
- type WorkerUpgradeOptions
- type WorkerUpgradeRecord
- type Workflow
- type WorkflowEvent
- type WorkflowStep
- type XferRecord
Constants ¶
const ( WaitModeOn = "mode_on" WaitIdleProbe = "idle_probe" WaitTurnAge = "turn_age" )
Relay wait reasons reported by the server (see sessionrelay.WaitReason); the Stop hook picks its poll cadence from these.
const ( RelayModeAuto = "auto" RelayModeOn = "on" RelayModeOff = "off" )
Relay modes the switch can be set to (R1; server-side source of truth is jobstore.RelayMode*): `on` always waits, `off` never does, `auto` lets the server's idle / turn-age rules decide.
const ( WorkerUpgradePending = "pending" WorkerUpgradeSucceeded = "succeeded" WorkerUpgradeRolledBack = "rolled_back" WorkerUpgradeFailed = "failed" )
Worker upgrade states (mirror of workerupgrade.State*; the client keeps its own wire types so commands never import server packages).
const ( XferOpPut = "put" XferOpGet = "get" )
Transfer operations: a put uploads bytes into the staging area for the runner to write, a get asks the runner to read a file out of its project root.
const ( XferStateStaged = "staged" XferStateDispatched = "dispatched" XferStateDone = "done" XferStateFailed = "failed" XferStateExpired = "expired" )
Transfer states as the wire reports them (server side: internal/xfer). They are re-exported so a caller can poll without depending on the server's own package.
const AgentSessionLookupTimeout = 3 * time.Second
AgentSessionLookupTimeout bounds the "is this a registered session" probe that plan auto-binding runs before creating a plan: binding is a convenience and must never make `plan create` hang on a slow server.
const ExplicitSessionEnv = "GOFER_SESSION_ID"
ExplicitSessionEnv is the environment variable a caller sets to name its session itself. It wins over every agent variable below, because a person (or a wrapper) saying which session this is knows better than a heuristic.
const ForwarderCapStop = "stop"
ForwarderCapStop is the capability a forwarder advertises when it exits on a remote stop (the heartbeat's 410 Gone).
const SessionHeader = "X-Gofer-Session-Id"
SessionHeader is the request header that names the terminal agent session a request belongs to (design §4「会话 id 的携带」).
const SugaSessionEnv = "SUGA_SESSION_ID"
SugaSessionEnv is the variable suga exports, in every process a model starts, with the full id of its own session (the id gofer registered for it). suga does not set GOFER_SESSION_ID.
Variables ¶
var ( ErrNoCurrentSession = fmt.Errorf("cannot tell which session this is: no SUGA_SESSION_ID / GOFER_SESSION_ID / CLAUDE_CODE_SESSION_ID / CODEX_THREAD_ID in the environment; pass --session <id> (see `gofer session ls`)") ErrAmbiguousCurrentSession = fmt.Errorf("cannot tell which session this is: the environment names several different sessions; pass --session <id> (see `gofer session ls`)") )
ErrNoCurrentSession / ErrAmbiguousCurrentSession are what ResolveCurrentSessionID returns when the environment names no session or several different ones.
var AgentSessionEnvKeys = []string{SugaSessionEnv, "GOFER_SESSION_ID", "CLAUDE_CODE_SESSION_ID", "CODEX_THREAD_ID", "CODEX_SESSION_ID"}
AgentSessionEnvKeys are the environment variables an agent terminal session exports to the commands it runs, in the order a plan created from that session looks for "the current session":
- SUGA_SESSION_ID: suga. A suga session's identity comes before an explicit GOFER_SESSION_ID override: only suga sets it, only on the child processes it starts itself, so it is the most specific identity there is (a gofer job that runs suga carries the job's GOFER_SESSION_ID too, and that one must not win);
- GOFER_SESSION_ID: explicit, set by the user or any generic agent wrapper;
- CLAUDE_CODE_SESSION_ID: Claude Code (the same id its hooks register);
- CODEX_THREAD_ID / CODEX_SESSION_ID: Codex CLI (both carry the thread id its hooks register as session_id).
SUGA_SESSION_NAME is for display and logs only and is never an address.
Functions ¶
func EnrollSecretHash ¶ added in v0.169.0
EnrollSecretHash is the SHA-256 hex digest the server stores for a secret.
func IsNotifyTargetRejected ¶ added in v0.171.0
IsNotifyTargetRejected reports whether err is the server refusing a submit only because its end-notification target is unusable (matched by the server's error code, never by message text).
func MatchProjectPath ¶
func MatchProjectPath(projects []ProjectMeta, cwd string) (key, root string, ok bool)
MatchProjectPath finds the project whose host_path or container_path contains cwd, longest prefix wins. A tie between different projects matches nothing. root is the matched path. Both views are tried because a client node may sit on the host or inside a container.
func NewEnrollSecret ¶ added in v0.169.0
NewEnrollSecret returns a fresh random enroll secret and its SHA-256 hex hash.
func NormalizeBaseURL ¶
NormalizeBaseURL makes a user-supplied server address connectable:
- a bare `host:port` (or `host`) gets an `http://` scheme;
- a `0.0.0.0` host (the default listen address, not a connectable address) is rewritten to `127.0.0.1`;
- a trailing slash is trimmed.
func ResolveCurrentSessionID ¶ added in v0.166.0
ResolveCurrentSessionID names the session the calling process belongs to, from the environment only (SessionIDFromEnv's rule; never the working directory, never a marker file). No candidate or several different ones is an error that asks for an explicit id.
func SessionIDFromEnv ¶ added in v0.163.0
SessionIDFromEnv resolves the terminal session a CLI invocation names and the variable the id came from ("" when nothing is attached), following the rule of design §4:
- $SUGA_SESSION_ID, when set, is used as it is, before everything else (see AgentSessionEnvKeys: suga sets it itself, so it beats an inherited GOFER_SESSION_ID);
- an explicitly set $GOFER_SESSION_ID is used as it is;
- otherwise the agent session variables (AgentSessionEnvKeys) must agree on exactly ONE id; with no candidate, or with two different ones, NOTHING is attached.
The caution is the point: attaching the wrong session id would hand the request the grants of somebody else's terminal, and being silently unattached is always safe — the request then holds exactly what its own caller id holds. Identification looks at the environment and nothing else: never the working directory, never a marker file, so gofer behaves the same in every descendant process of a terminal and a container without an agent session in its environment attaches nothing.
func SetRequestLogPath ¶ added in v0.209.3
func SetRequestLogPath(path string)
SetRequestLogPath names the file client request failures are appended to. The CLI entry point points it at <config-dir>/run/client.log; the default (empty) disables the log, which is what keeps a library embedder or a test process from writing into the user's config dir behind the caller's back.
The sink is opened lazily on the first loggable request and then kept: writes are synchronous (lumberjack), so a short-lived CLI process loses nothing when it exits right after a failure.
Types ¶
type APIResponse ¶ added in v0.179.0
APIResponse is one raw answer of the server: the status, the response headers and the body verbatim. It exists for callers that must see what the server actually said — `gofer tool api` — instead of the decoded value doJSON would give them.
type AdminAuditEntry ¶ added in v0.215.0
type AdminAuditEntry struct {
ID int64 `json:"id"`
At int64 `json:"at"`
CallerID string `json:"caller_id,omitempty"`
CallerKind string `json:"caller_kind,omitempty"`
SessionID string `json:"session_id,omitempty"`
JobID string `json:"job_id,omitempty"`
Method string `json:"method"`
Route string `json:"route"`
Target string `json:"target,omitempty"`
QueryKeys string `json:"query_keys,omitempty"`
Status int `json:"status"`
DurationMs int64 `json:"duration_ms"`
IP string `json:"ip,omitempty"`
Error string `json:"error,omitempty"`
}
AdminAuditEntry is one line of GET /v1/audit: a write request, who made it and how it ended.
type AdminAuditPage ¶ added in v0.215.0
type AdminAuditPage struct {
Entries []AdminAuditEntry `json:"entries"`
Count int `json:"count"`
NextCursor int64 `json:"next_cursor,omitempty"`
}
AdminAuditPage is one page of the audit; NextCursor is non-zero while more lines exist.
type AdminAuditQuery ¶ added in v0.215.0
type AdminAuditQuery struct {
Caller string
Route string
Status string // ok | fail
Since string
Until string
Cursor int64
Limit int
}
AdminAuditQuery is the filter of GET /v1/audit; empty fields are not sent.
type AgentHealth ¶
type AgentHealth struct {
State string `json:"state"`
WindowSec int `json:"window_sec"`
Jobs int `json:"jobs"`
OK int `json:"ok"`
TransientFail int `json:"transient_fail"`
LastTransientAt int64 `json:"last_transient_at,omitempty"`
LastOKAt int64 `json:"last_ok_at,omitempty"`
}
AgentHealth is one agent's recent-job health as GET /v1/agents reports it (SUP-01 P3): the classified state plus the evidence behind it.
type AgentMeta ¶
type AgentMeta struct {
Name string `json:"name"`
Type string `json:"type"`
Available bool `json:"available"`
Detail string `json:"detail,omitempty"`
// Health is the agent's recent-job health (SUP-01 P3), nil when the server
// reported none (older server, or the aggregate could not be read).
Health *AgentHealth `json:"health,omitempty"`
}
AgentMeta is one agent as the mcp bridge contract exposes it (name/type/available/detail), matching mcpserver.agentEntry so the client backend (E28 P3) can map it 1:1. The /v1/agents endpoint actually returns the httpapi.agentView wire shape (key/type/available/version/error); ListAgents folds that into this view (name=key, detail=version when available else the probe error), exactly like the local mcpserver handler does.
type AgentProbe ¶
type AgentProbe struct {
JobID string `json:"job_id"`
Status string `json:"status"`
ExitCode int `json:"exit_code"`
DurationMs int64 `json:"duration_ms"`
FirstLine string `json:"first_line,omitempty"`
}
AgentProbe is the outcome of a probe (POST /v1/agents/{key}/probe, SUP-01 P3): the ordinary job that carried it, its terminal status, and the first line the agent produced.
type AgentSession ¶
type AgentSession struct {
SessionID string `json:"session_id"`
Agent string `json:"agent"`
ProjectKey string `json:"project_key,omitempty"`
Runner string `json:"runner,omitempty"`
Cwd string `json:"cwd,omitempty"`
Title string `json:"title,omitempty"`
Transcript string `json:"transcript,omitempty"`
TmuxPane string `json:"tmux_pane,omitempty"`
State string `json:"state"`
// RelayMode is the three-state switch (auto|on|off, R1). WaitReason reports
// whether a Stop would wait right now and why (mode_on / idle_probe /
// turn_age; empty = it would not wait) — it is what the Stop hook keys on.
RelayMode string `json:"relay_mode"`
// InjectMode is how a message that must be TYPED into the terminal is handled
// (auto|hold|force, design 2026-10-22 D5).
InjectMode string `json:"inject_mode"`
// RelayDemotedAt: when `on` fell back to `auto` because the human typed in the
// terminal (single-session reads; 0 = not the current story).
RelayDemotedAt int64 `json:"relay_demoted_at,omitempty"`
WaitReason string `json:"wait_reason,omitempty"`
// WaitReasonDetail explains a session that does NOT wait right now (SUP-01 D):
// "supervising N jobs". The hook only logs it.
WaitReasonDetail string `json:"wait_reason_detail,omitempty"`
// WaitBudgetSec caps how long the Stop hook blocks for a reply (0 = the server
// gave no cap); SubagentCount is the sub-agents running in the session.
WaitBudgetSec int `json:"wait_budget_sec,omitempty"`
SubagentCount int `json:"subagent_count,omitempty"`
// PermissionWaitReason / PermissionWaitBudgetSec are the same verdict for a
// terminal PERMISSION prompt: no supervising gate (the dialog blocks the terminal
// anyway). Empty on a server that predates them — the hook then falls back to
// WaitReason / WaitBudgetSec.
PermissionWaitReason string `json:"permission_wait_reason,omitempty"`
PermissionWaitBudgetSec int `json:"permission_wait_budget_sec,omitempty"`
// StopJobWait is session.stop_job_wait (gofer-rhux, away|always|never): what the
// Stop hook should do about this session's WATCHED JOBS. Empty on a server that
// predates it — the hook then uses its own config setting, or the `away` default.
StopJobWait string `json:"stop_job_wait,omitempty"`
// CallerID is the authenticated caller that registered the session (its
// owner): who may answer it, and whose live jobs keep it from auto-arming.
CallerID string `json:"caller_id,omitempty"`
// RefusedCallerID / RefusedAt record the last hook report that was refused
// because it came from a caller other than the owner (gofer-eh53). `gofer
// session show` prints them; the owner's next successful report clears them.
RefusedCallerID string `json:"refused_caller_id,omitempty"`
RefusedAt int64 `json:"refused_at,omitempty"`
TurnNo int64 `json:"turn_no"`
LastMessage string `json:"last_message,omitempty"`
LastEvent string `json:"last_event,omitempty"`
LastSeenAt int64 `json:"last_seen_at"`
StartedAt int64 `json:"started_at"`
EndedAt int64 `json:"ended_at,omitempty"`
// AutoArmed reports that the server's KEYBOARD IDLE rule alone arms relay for
// this session (the human has been away for >= session.auto_relay_idle_sec);
// IdleSec is the idle reading the hook reported last, -1 = unknown.
// LastHumanAt is when a human last acted here (0 = never), the anchor of the
// turn-age fallback.
AutoArmed bool `json:"auto_armed"`
IdleSec int64 `json:"idle_sec"`
// HandedOffJobID is set while the session is taken over by path B's pty job
// (§9.1 B); Notice is the one-liner the hook prints on stderr so the person at
// the ORIGINAL terminal learns where the conversation went.
HandedOffJobID string `json:"handed_off_job_id,omitempty"`
HandedOffAt int64 `json:"handed_off_at,omitempty"`
Notice string `json:"notice,omitempty"`
LastHumanAt int64 `json:"last_human_at,omitempty"`
WatchCount int `json:"watch_count,omitempty"`
// MailPending is how many mailbox letters the session still has to read.
MailPaused bool `json:"mail_paused"`
MailPending int `json:"mail_pending,omitempty"`
PeerName string `json:"peer_name,omitempty"`
// PeerNameSource is where Claude Code says the name came from (user / auto...).
PeerNameSource string `json:"peer_name_source,omitempty"`
PeerStatus string `json:"peer_status,omitempty"`
PeerMessaging bool `json:"peer_messaging"`
ProgressText string `json:"progress_text,omitempty"`
ProgressAt int64 `json:"progress_at,omitempty"`
// LastCwd is the directory the hook last reported (display only).
LastCwd string `json:"last_cwd,omitempty"`
// Language is the language gofer writes the text IT sends this session in
// (its project's language, else the server's; design 2026-10-27-i18n §3).
// The hook has no config of its own, so it reads the setting here to generate
// the prefixes and blocks it injects in the same language.
Language string `json:"language,omitempty"`
// Topic / Scope / TopicSource / TopicAt: what the session works on (topic one sentence,
// scope the project-relative sub-paths it owns). TopicSource is self | human | inferred;
// an inferred topic is derived on every read.
Topic string `json:"topic,omitempty"`
Scope []string `json:"scope,omitempty"`
TopicSource string `json:"topic_source,omitempty"`
TopicAt int64 `json:"topic_at,omitempty"`
// Seat is the resident seat this session sits in (nil = none): its name, purpose and
// charter. Continuation is the one-time text of a session that has just taken the seat;
// the server hands it out on the registration answer only.
Seat *SessionSeat `json:"seat,omitempty"`
// Stage is where the stage flow of the work item this session is on stands (or {enabled}
// when it has none and its project has the flow on); the hooks inject their reminder from it.
Stage *stagenote.Brief `json:"stage,omitempty"`
}
AgentSession mirrors httpapi's sessionView (a terminal agent-CLI session registered through its hooks). Timestamps are unix seconds.
type AssignableProject ¶
type AssignableProject struct {
Key string `json:"key"`
HostPath string `json:"host_path,omitempty"`
}
AssignableProject is one project a worker may be dispatched to, as returned by GET /v1/workers/{id}/assignable. HostPath is the SERVER's logical path — what a worker's `roots` must map onto a local tree.
type AuthCatalog ¶ added in v0.162.0
type AuthCatalog struct {
Permissions []AuthCatalogEntry `json:"permissions"`
Presets []AuthPreset `json:"presets"`
}
AuthCatalog is GET /v1/auth/catalog.
type AuthCatalogEntry ¶ added in v0.162.0
type AuthCatalogEntry struct {
Name string `json:"name"`
Description string `json:"description"`
Risk string `json:"risk"`
RiskLabel string `json:"risk_label"`
SessionGrantable bool `json:"session_grantable"`
Scope string `json:"scope"`
ScopeLabel string `json:"scope_label"`
Source string `json:"source"`
SourceLabel string `json:"source_label"`
SeedVersion int `json:"seed_version,omitempty"`
}
AuthCatalogEntry is one permission of GET /v1/auth/catalog (design §1: name, what it covers, risk, whether it may be granted to a session, scope, source).
type AuthCeiling ¶ added in v0.172.0
type AuthCeiling struct {
Projects []string `json:"projects,omitempty"`
Runners []string `json:"runners,omitempty"`
Workers []string `json:"workers,omitempty"`
Agents []string `json:"agents,omitempty"`
AllowExec bool `json:"allow_exec"`
GlobalMemory bool `json:"global_memory"`
ReadOnly bool `json:"read_only"`
}
AuthCeiling is the caller's scope ceiling as whoami reports it. An omitted list does not restrict that dimension, except Runners: an omitted runners list allows worker runners only.
type AuthGrant ¶ added in v0.171.0
type AuthGrant struct {
ID string `json:"id"`
Subject string `json:"subject"`
// Source is db | config.
Source string `json:"source"`
// Pattern is the granted pattern (with its optional scope), e.g. tunnel.*:project-a.
Pattern string `json:"pattern,omitempty"`
Scope string `json:"scope,omitempty"`
// State is active | orphaned | revoked | expired | unmatched.
State string `json:"state"`
// Effective is whether the grant is in force right now: for a session grant that is the state
// plus the deadline plus the session's own facts (not ended, owner and incarnation unchanged).
Effective bool `json:"effective"`
// ExpiresAt is the unix-second deadline. Only a session grant has one: for a users / caller
// grant the field is absent (0 here).
ExpiresAt int64 `json:"expires_at,omitempty"`
GrantedBy string `json:"granted_by,omitempty"`
GrantedAt int64 `json:"granted_at,omitempty"`
// Permissions is what the pattern expands to today, in catalog order.
Permissions []string `json:"permissions,omitempty"`
}
AuthGrant is one grant as the management routes report it — the answer of a renewal is the same row with its deadline moved: its id, the subject it grants to, the state it is in, and whether it is in force right now (设计 §4「生效条件」).
type AuthPermission ¶ added in v0.162.0
type AuthPermission struct {
Name string `json:"name"`
Source string `json:"source"`
GrantID string `json:"grant_id,omitempty"`
}
AuthPermission is one effective permission of a caller: its name, where it came from (root | config | db) and, when a database grant is behind it, which grant.
type AuthPreset ¶ added in v0.162.0
type AuthPreset struct {
Key string `json:"key"`
Label string `json:"label"`
Patterns []string `json:"patterns"`
Permissions []string `json:"permissions"`
}
AuthPreset is one quick-fill of the design's preset list: the patterns a console fills in and what they really hand out.
type AuthRoute ¶ added in v0.162.0
type AuthRoute struct {
Method string `json:"method"`
Path string `json:"path"`
User string `json:"user"`
Mode string `json:"mode,omitempty"`
Permissions []string `json:"permissions,omitempty"`
JobCredential string `json:"job_credential,omitempty"`
WorkerSelf bool `json:"worker_self,omitempty"`
External string `json:"external,omitempty"`
Static bool `json:"static,omitempty"`
}
AuthRoute is one route of GET /v1/auth/routes: the route and the declaration it carries — User is the user-class category (require | in_handler | public | no_user_surface | pending) and Mode is InHandler's mode (deny | filter).
type AuthWhoami ¶ added in v0.162.0
type AuthWhoami struct {
CallerID string `json:"caller_id"`
// CallerName is the configured display name of the caller (empty when none).
CallerName string `json:"caller_name,omitempty"`
// CallerNames maps caller id to display name for every named caller.
CallerNames map[string]string `json:"caller_names,omitempty"`
// Kind is user | worker | job.
Kind string `json:"kind"`
// Root reports the root administrator: it holds every permission.
Root bool `json:"root"`
// Permissions is the effective set, in catalog order.
Permissions []AuthPermission `json:"permissions"`
// SessionID is the session the request named, when it named one.
SessionID string `json:"session_id,omitempty"`
// GrantsVersion is the generation of the grant table the answer was computed from.
GrantsVersion int64 `json:"grants_version"`
// Roots lists the deployment's root administrators (empty: nobody can grant anything).
Roots []string `json:"roots,omitempty"`
// Hint explains an empty or unattached answer.
Hint string `json:"hint,omitempty"`
// Ceiling is the caller's own scope ceiling (nil = not restricted).
Ceiling *AuthCeiling `json:"ceiling,omitempty"`
}
AuthWhoami is GET /v1/auth/whoami: the caller this credential authenticates as, whether it is a root administrator, the permissions it holds with their sources, and the session the request was attached to. Roots and Hint answer the next question — who can grant me this, and what is wrong when nobody can.
type Caller ¶ added in v0.211.0
type Caller struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Source string `json:"source"`
State string `json:"state"`
TokenSet bool `json:"token_set"`
TokenHint string `json:"token_hint,omitempty"`
MaxConcurrentJobs int `json:"max_concurrent_jobs,omitempty"`
RateLimit float64 `json:"rate_limit,omitempty"`
RateBurst int `json:"rate_burst,omitempty"`
Ceiling *CallerCeiling `json:"ceiling,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"`
RotatedAt int64 `json:"rotated_at,omitempty"`
UpdatedAt int64 `json:"updated_at,omitempty"`
ExpiresAt int64 `json:"expires_at,omitempty"`
LastUsedAt int64 `json:"last_used_at,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
Caller is one caller as GET /v1/callers lists it: where it comes from (file | db), whether it is in force (active | disabled | superseded), the credential hint and what it is limited to. The token itself is never part of a list.
type CallerAddRequest ¶ added in v0.211.0
type CallerAddRequest struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
MaxConcurrentJobs int `json:"max_concurrent_jobs,omitempty"`
RateLimit float64 `json:"rate_limit,omitempty"`
RateBurst int `json:"rate_burst,omitempty"`
Ceiling *CallerCeiling `json:"ceiling,omitempty"`
NoCeiling bool `json:"no_ceiling,omitempty"`
// Expires is when the token stops working: 90d, a date, or never (left out = never).
Expires string `json:"expires,omitempty"`
}
CallerAddRequest is the body of POST /v1/callers: exactly one of Ceiling / NoCeiling.
type CallerAuditEntry ¶ added in v0.211.0
type CallerAuditEntry struct {
ID int64 `json:"id,omitempty"`
Actor string `json:"actor"`
Path string `json:"path"`
BeforeMasked string `json:"before_masked,omitempty"`
AfterMasked string `json:"after_masked,omitempty"`
At int64 `json:"at"`
}
CallerAuditEntry is one config_audit line of a caller change: who, when, which entry, and the masked before / after values (never a token, never its hash).
type CallerCeiling ¶ added in v0.211.0
type CallerCeiling struct {
Projects []string `json:"projects,omitempty"`
Runners []string `json:"runners,omitempty"`
Workers []string `json:"workers,omitempty"`
Agents []string `json:"agents,omitempty"`
AllowExec *bool `json:"allow_exec,omitempty"`
GlobalMemory *bool `json:"global_memory,omitempty"`
ReadOnly *bool `json:"read_only,omitempty"`
}
CallerCeiling is a caller's upper bound on the wire. An omitted list does not restrict that dimension, EXCEPT runners: an omitted runners list means the machine runner is not allowed (worker runners only). A nil switch means the key was not set (the strict default applies).
type CallerCeilingRequest ¶ added in v0.211.0
type CallerCeilingRequest struct {
Ceiling *CallerCeiling `json:"ceiling,omitempty"`
NoCeiling bool `json:"no_ceiling,omitempty"`
}
CallerCeilingRequest is the body of PUT /v1/callers/{id}/ceiling.
type CallerChange ¶ added in v0.211.0
type CallerChange struct {
Caller Caller `json:"caller"`
Token string `json:"token,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
CallerChange is the answer of a caller write: the caller as it is now, the token when the write minted one (add / rotate — the only two answers that carry it), and the notices.
type CallerLimitsRequest ¶ added in v0.211.0
type CallerLimitsRequest struct {
MaxConcurrentJobs int `json:"max_concurrent_jobs,omitempty"`
RateLimit float64 `json:"rate_limit,omitempty"`
RateBurst int `json:"rate_burst,omitempty"`
}
CallerLimitsRequest is the body of PUT /v1/callers/{id}/limits.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a running gofer server. It is safe for sequential use; the zero value is not usable — construct it with New.
func New ¶
New builds a Client for baseURL with an optional bearer token. baseURL is normalised (scheme added, 0.0.0.0 rewritten to 127.0.0.1) via NormalizeBaseURL so callers may pass a bare `host:port`. When token is empty no Authorization header is sent (the server must then allow empty-token auth).
func NewWithTimeout ¶
NewWithTimeout is New with a caller-selected HTTP deadline, used by best-effort session-prime lookups so an unreachable server cannot delay a hook.
Construction is also where the session header is decided: the process environment names at most one terminal agent session (SessionIDFromEnv), and every request of the returned client carries it.
func (*Client) AcceptEnrollment ¶ added in v0.169.0
func (c *Client) AcceptEnrollment(id, pairingCode, workerID string, labels, projects []string) (EnrollAccepted, error)
AcceptEnrollment accepts a pending request with the pairing code read off the worker's terminal.
func (*Client) AcceptJob ¶
func (c *Client) AcceptJob(id, note string) (job.ReviewOutcome, error)
AcceptJob POSTs to /v1/jobs/{id}/accept, recording a human's ACCEPTANCE of a needs_review job (GATE-01 S3): the job becomes done and the reviewer/note are kept as its audit trail. note is optional.
There is no in-job identity to declare: since SEC-01 a job authenticates with its OWN credential (GOFER_JOB_TOKEN), and the server refuses accept/reject for every job caller from that credential — not from anything the body claims.
func (*Client) AcceptJobWithoutDelivery ¶ added in v0.146.0
func (c *Client) AcceptJobWithoutDelivery(id, note string) (job.ReviewOutcome, error)
AcceptJobWithoutDelivery accepts but does not deliver the worktree branch (GIT-02).
func (*Client) AcceptMemoryCandidate ¶
func (c *Client) AcceptMemoryCandidate(id int64, in job.AcceptMemoryCandidateInput) (job.MemoryCandidateDecision, error)
AcceptMemoryCandidate files candidate id as a scoped memory.
func (*Client) AcceptMergeSuggestion ¶
func (c *Client) AcceptMergeSuggestion(id int64) (work.DetailView, error)
AcceptMergeSuggestion is a person's yes: it performs the merge.
func (*Client) AcceptWorkSuggestion ¶
func (c *Client) AcceptWorkSuggestion(id, field string) (work.DetailView, error)
AcceptWorkSuggestion adopts a pending suggestion ("goal", "blocker", "next", ...).
func (*Client) AckMail ¶ added in v0.173.0
AckMail marks the letter read by its recipient (state delivered, read_at stamped).
func (*Client) AddCaller ¶ added in v0.211.0
func (c *Client) AddCaller(req CallerAddRequest) (CallerChange, error)
AddCaller creates a caller (POST /v1/callers) and answers the credential ONCE.
func (*Client) AddSessionJobWatch ¶
func (c *Client) AddSessionJobWatch(sid, jobID string) (SessionJobWatch, error)
AddSessionJobWatch registers a job for the session's Stop hook.
func (*Client) AddTodo ¶
AddTodo creates a plan todo. jobID may be empty for a plain checklist item; note is an optional short remark. patch carries the PLAN-02 dispatch fields; the item is created `pending`, so nothing is dispatched until it is set ready.
func (*Client) AddWorkNote ¶
AddWorkNote appends a note to the journal. level is optional (milestone | detail; "" = the server's default for the caller).
func (*Client) AnswerDecision ¶
AnswerDecision POSTs /v1/decisions/{id}/answer. A non-2xx surfaces via errorFor: unknown id → 404 error, already answered/expired → 409 error.
func (*Client) AnswerInteraction ¶
func (c *Client) AnswerInteraction(jobID, interactionID, answer string) (job.Interaction, error)
AnswerInteraction POSTs an answer to a peer interaction (P9 passthrough / E28 client mode) and returns the updated job.Interaction the server echoes back (the answer endpoint returns a bare job.Interaction). Fire-and-forget callers may ignore the returned Interaction.
func (*Client) AnswerSessionPermission ¶
AnswerSessionPermission answers a pending prompt: allow | always:<i> | deny[:<reason>].
func (*Client) ApprovalURL ¶ added in v0.137.0
ApprovalURL is where a person approves the held job id: the server-reported approve_url when there is one, else the console page on the server address this client talks to.
func (*Client) ApproveJob ¶ added in v0.137.0
ApproveJob POSTs to /v1/jobs/{id}/approve, recording a human's APPROVAL of a job awaiting approval (gofer-9b1b): the job moves to queued and runs under the same id; the returned snapshot is the started job. note is optional. Like accept, a job credential is refused server-side.
func (*Client) ArchiveAutoWork ¶ added in v0.208.0
func (c *Client) ArchiveAutoWork(dryRun bool) (work.ArchiveResult, error)
ArchiveAutoWork archives every auto-generated work item nobody touched (POST /v1/work-items/archive-auto) and reports how many; dryRun only lists what would go.
func (*Client) AskDecision ¶
func (c *Client) AskDecision(planID, title, question string, options []string, timeoutSec int64) (Decision, error)
AskDecision POSTs /v1/decisions and returns the created OPEN decision. planID may be "" (global question); options empty = free-text answer. timeoutSec <= 0 / out-of-range values are clamped server-side (the authoritative clamp lives in jobstore.InsertDecision, plan HIGH-2).
func (*Client) AttachWorkSession ¶
func (c *Client) AttachWorkSession(id, sid string) (work.DetailView, error)
AttachWorkSession makes a session a current session of the item.
func (*Client) AuthCatalog ¶ added in v0.162.0
func (c *Client) AuthCatalog() (AuthCatalog, error)
AuthCatalog fetches the permission catalog (GET /v1/auth/catalog).
func (*Client) AuthRoutes ¶ added in v0.162.0
AuthRoutes fetches the route declarations of the running server (GET /v1/auth/routes).
func (*Client) BackgroundAgents ¶ added in v0.208.0
BackgroundAgents is GET /v1/background-agents.
func (*Client) BaseURL ¶
BaseURL exposes the normalized endpoint for narrow extension APIs such as repository tracker sync; request authentication remains owned by Client.
func (*Client) BindSeat ¶ added in v0.217.0
BindSeat makes ref (a terminal session id, or an ACP job id for an acp seat) the session sitting in the seat. replace takes over a seat that already has another session.
func (*Client) CancelEnroll ¶ added in v0.169.0
CancelEnroll gives the request up.
func (*Client) CancelJob ¶
CancelJob POSTs to /v1/jobs/{id}/cancel and returns the resulting snapshot. Cancelling a terminal job is a stable no-op server-side.
func (*Client) CancelRetry ¶
CancelRetry drops one retry that has not run yet (pending, or claimed) so the sweeper will not submit it. A retry that already ran or was already cancelled is terminal: the server answers 404 and this returns that error.
func (*Client) CancelWorkflow ¶
CancelWorkflow POSTs to /v1/workflows/{id}/cancel and returns the resulting header snapshot. Cancelling a terminal workflow is a stable no-op server-side.
func (*Client) CaptureWork ¶ added in v0.166.0
func (c *Client) CaptureWork(text, kind, project, workspace string) (work.DetailView, error)
CaptureWork records one capture-box item (POST /v1/work-items/capture). kind is idea|issue|request|note ("" = the server's default, note); project / workspace are optional. The source session comes from the request's session header.
func (*Client) ClaimSessionMail ¶ added in v0.173.0
ClaimSessionMail claims the session's letters for injection (pending → delivering, with a lease).
func (*Client) CloseJobPreview ¶ added in v0.204.0
func (c *Client) CloseJobPreview(jobID, previewID string) (JobPreview, error)
func (*Client) CompleteSessionMailTurn ¶ added in v0.173.0
func (c *Client) CompleteSessionMailTurn(sid, turnID string, take MailTake) (bool, []TakenMail, error)
CompleteSessionMailTurn closes the open relay turn and takes the letters in one server operation (the Stop delivery). completed=false: a web answer won, or nothing was pending.
func (*Client) CompleteSessionWatchTurn ¶
func (*Client) CompleteSessionWatches ¶
CompleteSessionWatches marks terminal watched jobs delivered without a relay turn (Stop with relay off, and the UserPromptSubmit / SessionStart catch-up). completed=false: another hook delivered them first.
func (*Client) ConfirmEnroll ¶ added in v0.169.0
ConfirmEnroll acknowledges that the token has been written locally.
func (*Client) ConfirmSessionMail ¶ added in v0.173.0
ConfirmSessionMail confirms claimed letters (delivering → delivered) and returns the ids the server confirmed; only those may be injected.
func (*Client) CreateInteraction ¶ added in v0.215.0
func (c *Client) CreateInteraction(jobID string, req CreateInteractionRequest) (job.Interaction, error)
CreateInteraction raises an interaction on a live job (POST /v1/jobs/{id}/interactions) and returns the created job.Interaction.
func (*Client) CreateJobPreview ¶ added in v0.204.0
func (c *Client) CreateJobPreview(id string, port, ttl int) (JobPreview, error)
func (*Client) CreatePlan ¶
func (c *Client) CreatePlan(planID, title, description, project, leader string, tags ...[]string) (Plan, error)
CreatePlan POSTs /v1/plans and returns the created header. project is the project its todos are dispatched into (PLAN-02 P2); "" names none. leader is "" (off / not asked for), "on" or "off" (LEAD-02).
func (*Client) CreatePlanAutoSupervisor ¶
func (c *Client) CreatePlanAutoSupervisor(planID, title, description, project, leader string, tags []string, getenv func(string) string) (Plan, SupervisorAutoBind, error)
CreatePlanAutoSupervisor creates a plan bound to the agent session the caller runs in (LookupCurrentAgentSession). When no session is found, or the server refuses the binding (session not owned by this caller / no authenticated caller), the plan is created unbound and the result's Reason says why — the binding never fails the plan.
func (*Client) CreatePlanWithSupervisorSession ¶
func (c *Client) CreatePlanWithSupervisorSession(planID, title, description, project, leader, supervisorSessionID string, tags ...[]string) (Plan, error)
CreatePlanWithSupervisorSession creates a plan and optionally binds the authenticated terminal session that will supervise its dispatches.
func (*Client) CreateSchedule ¶
func (c *Client) CreateSchedule(req CreateScheduleRequest) (Schedule, error)
CreateSchedule creates a cron schedule via POST /v1/schedules.
func (*Client) CreateScopedMemory ¶
func (c *Client) CreateScopedMemory(scope, scopeKey, key, content string, tags []string, meta *tracker.MemoryMeta) (ScopedMemory, error)
CreateScopedMemory upserts a scoped memory. A non-nil meta sends every meta field (the caller passes the merged record, so empty values clear); nil keeps the stored ones.
func (*Client) CreateSeat ¶ added in v0.217.0
func (c *Client) CreateSeat(in SeatCreate) (Seat, error)
CreateSeat creates a vacant seat.
func (*Client) CreateSessionNudge ¶
func (c *Client) CreateSessionNudge(sid, kind string, intervalSec int64, text string, untilAt int64) (SessionNudge, error)
CreateSessionNudge sets a nudge on a session (POST /v1/sessions/{sid}/nudges).
func (*Client) CreateWakeup ¶
CreateWakeup registers a wakeup on a job (POST /v1/jobs/{id}/wakeups). spec.JobID is taken from the path, so a body value is ignored.
func (*Client) CreateWorkItem ¶
CreateWorkItem creates a work item; fields: title (required), goal, status, project_key, workspace, next_step, priority, session_ids.
func (*Client) DeleteSchedule ¶
DeleteSchedule deletes one schedule by id.
func (*Client) DeleteScopedMemory ¶
func (*Client) DeleteSeat ¶ added in v0.217.0
DeleteSeat removes a seat and its history.
func (*Client) DeleteSession ¶
DeleteSession removes a session registration.
func (*Client) DeleteSessionNudge ¶
DeleteSessionNudge removes a nudge.
func (*Client) DeleteTrackerRepo ¶ added in v0.139.0
func (c *Client) DeleteTrackerRepo(trackerID string) (TrackerDeleteResult, error)
DeleteTrackerRepo removes one mirrored repository from the server (DELETE /v1/tracker/repos/{tracker_id}; admin only).
func (*Client) DeleteTunnelPreset ¶
DeleteTunnelPreset removes one preset.
func (*Client) DeleteWakeup ¶
DeleteWakeup removes a wakeup (DELETE /v1/wakeups/{id}).
func (*Client) DeleteWorkItems ¶
DeleteWorkItems permanently deletes finished (done / dropped) work items: the listed ids and/or every item in status (dropped | done). Items that cannot go are reported in Failed rather than failing the call.
func (*Client) DeleteWorkflowTemplate ¶ added in v0.181.0
func (c *Client) DeleteWorkflowTemplate(name, scope, project string) (workflow.TemplateWriteResult, error)
DeleteWorkflowTemplate removes a global or project template (DELETE /v1/workflow-templates/{name}).
func (*Client) DeliverJob ¶ added in v0.146.0
func (c *Client) DeliverJob(id, mode string, draft *bool, branch string) (job.DeliveryResult, error)
DeliverJob hands a done worktree job's branch over now (POST /v1/jobs/{id}/deliver).
func (*Client) DeliverSession ¶
func (c *Client) DeliverSession(sid, text string, allowTakeover bool) (SessionDeliverResult, error)
DeliverSession sends a reply to a session that is NOT waiting for one (POST /v1/sessions/{sid}/deliver, design §9.1): an OPEN turn is answered like SaySession, otherwise the text is typed into the session's tmux pane. With allowTakeover the server may instead start a NEW `--resume` process when the session has no usable pane (path B) — that moves the conversation off the terminal the human left, so it is opt-in.
A 409 means the session cannot be reached (its body names the reason: no_runner / no_tmux / ended / handed_off:<job> / no_resume_template / interactive_not_allowed / cwd_outside_project), 502 that the dispatch failed, 400 that the text is empty or over 8KB.
func (*Client) DetachWorkSession ¶
func (c *Client) DetachWorkSession(id, sid string) (work.DetailView, error)
DetachWorkSession moves a session to the item's history.
func (*Client) DialTunnel ¶
func (c *Client) DialTunnel(ctx context.Context, workerID, target string, networks ...string) (TunnelConn, error)
DialTunnel opens a worker TCP tunnel websocket.
func (*Client) DisableCaller ¶ added in v0.211.0
func (c *Client) DisableCaller(id string) (CallerChange, error)
DisableCaller switches a caller off (POST /v1/callers/{id}/disable).
func (*Client) DisablePlanDriver ¶ added in v0.215.0
func (c *Client) DisablePlanDriver(planID string) (job.PlanDriverStatus, error)
DisablePlanDriver turns a plan's driver off (DELETE /v1/plans/{id}/driver). It is idempotent server-side, so asking twice answers the same off state.
func (*Client) DismissMergeSuggestion ¶
DismissMergeSuggestion is a person's no.
func (*Client) DismissWorkSuggestion ¶
func (c *Client) DismissWorkSuggestion(id, field string) (work.DetailView, error)
DismissWorkSuggestion drops a pending suggestion.
func (*Client) DispatchTodo ¶
func (c *Client) DispatchTodo(todoID string) (TodoDispatch, error)
DispatchTodo explicitly dispatches a todo's assignee (PLAN-02 P2), ignoring the item's status: the caller asked for it, so a `pending` or `done` item is a legitimate target. The server still requires an assignee and no live job.
func (*Client) DispatchWork ¶ added in v0.166.0
func (c *Client) DispatchWork(id, to, sessionID, jobID, planID, newPlanTitle, trackerID, title string) (work.DetailView, error)
DispatchWork hands a captured item over (POST /v1/work-items/{id}/dispatch). to is session|job|todo|issue|archive|drop; sessionID / jobID / planID / newPlanTitle / trackerID / title apply to their target only. The updated item comes back; a refusal (409 not captured, a failed hand-over) is the error.
func (*Client) DoRaw ¶ added in v0.179.0
DoRaw sends one request and returns the answer as it is, treating no status specially: a non-2xx answer is data for the caller, not an error of the transport. The token and the session header ride along through applyAuth like on every other request, so a raw call carries exactly the credentials the rest of the CLI would.
func (*Client) DropFollowUp ¶ added in v0.201.0
func (*Client) EnableCaller ¶ added in v0.211.0
func (c *Client) EnableCaller(id string) (CallerChange, error)
EnableCaller brings a caller back (POST /v1/callers/{id}/enable).
func (*Client) EndMailAgent ¶ added in v0.185.0
EndMailAgent ends the resident session of one `agent:<名字>[@<项目>]` address by hand.
func (*Client) Enroll ¶ added in v0.169.0
func (c *Client) Enroll(req EnrollRequest) (EnrollTicket, error)
Enroll starts a self-enrollment (POST /v1/worker-enroll, anonymous).
func (*Client) ExportSettings ¶ added in v0.179.0
ExportSettings returns the YAML document of the MODIFIED keys only, exactly as the server wrote it (the CLI hands it to a file or stdout verbatim).
func (*Client) ExportWorkflow ¶
ExportWorkflow fetches a workflow's reconstructed WorkflowSpec (GET /v1/workflows/{id}/export, T4.1). The server strips credential-looking values (SR403); the returned bool reports whether anything was redacted (from the X-Gofer-Redacted response header) so `workflow export` can warn that a placeholder must be filled in before re-running. An unknown id surfaces as a 404 error.
func (*Client) FindSessions ¶ added in v0.166.0
func (c *Client) FindSessions(o SessionFindOpts) ([]SessionFound, error)
FindSessions finds sessions by topic / scope (ranked by the server).
func (*Client) FlagScopedMemory ¶
func (c *Client) FlagScopedMemory(scope, scopeKey, key, reason, jobID string) (ScopedMemory, error)
FlagScopedMemory reports a scoped memory as out of date (reason required). jobID is informational: a job credential is recorded as its own job by the server.
func (*Client) GetDecision ¶
GetDecision fetches one decision (GET /v1/decisions/{id}); the read path applies lazy expiry, so a past-deadline decision comes back EXPIRED.
func (*Client) GetInteractions ¶
func (c *Client) GetInteractions(id string) ([]job.Interaction, error)
GetInteractions lists a job's running-time interactions (GET /v1/jobs/{id}/interactions), unwrapping the {"interactions":[...]} envelope. job.Interaction's JSON tags match the endpoint's element shape, so the slice decodes directly. Used by the mcp client backend (E28) to surface a peer job's pending/answered interactions. An unknown id surfaces as a 404 error.
func (*Client) GetJobDiagnosis ¶ added in v0.215.0
GetJobDiagnosis fetches a job's diagnosis (R10): the derived termination reason, the continuation chain with its earliest failure, the stage timeline and the next steps. Same visibility as GetJob; an unknown id is an error (the server 404s).
func (*Client) GetJobDiffFull ¶
GetJobDiffFull fetches a job's captured diff as text (GET /v1/jobs/{id}/diff?full=1). The summary form lives on the job row (JobResult.DiffSummary); this is the PATCH, and a job that captured none is a 404 (an error here), because "the diff is missing" is worth saying rather than printing an empty screen.
func (*Client) GetJobRequest ¶
func (c *Client) GetJobRequest(id string) (job.JobRequest, error)
GetJobRequest fetches a job's ORIGINAL request, SECRET-STRIPPED (GET /v1/jobs/{id}/ request, P5: the endpoint now redacts by default — env values and secret-looking prompt/cmd become ***REDACTED***). It is for audit/display; it is NO LONGER used to re-submit (that moved server-side to RebuildJob). Unknown id / no request → error.
func (*Client) GetJobReviewHints ¶ added in v0.181.0
func (c *Client) GetJobReviewHints(id string) (job.ReviewHints, error)
GetJobReviewHints fetches a job's review hints (GET /v1/jobs/{id}/review-hints, gofer-hjj1): the deletion hotspots, the removed comment lines and the report's verification result lines, computed server-side from the same changes.diff and stdout tail the review screen shows. A job with neither gets empty sections, not an error.
func (*Client) GetJobTranscript ¶ added in v0.214.0
func (c *Client) GetJobTranscript(id string, q streaming.TranscriptQuery) (streaming.JobTranscriptPage, error)
GetJobTranscript reads one page of a job's per-turn transcript (GET /v1/jobs/{id}/transcript, gofer-mmh0). The response types are the streaming package's own: the server and its clients share one definition. A page with Next set continues with q.Cursor = Next.String().
func (*Client) GetJobWorktree ¶
func (c *Client) GetJobWorktree(id string) (job.WorktreeStatus, error)
GetJobWorktree fetches the live state of a job's WT-01 managed worktree (branch, HEAD, commits ahead of the base, uncommitted changes, merged-into-base). A job without a managed worktree is a 404 from the server.
func (*Client) GetLogsTail ¶
GetLogsTail reads the last maxBytes of a job log stream (GET /v1/jobs/{id}/logs/{stream}?bytes=n). It is the byte-window counterpart of GetLogsWindow: callers that want a bounded tail of a report (the review screen) pick the window themselves instead of taking the 256KB default.
func (*Client) GetLogsWindow ¶
GetLogsWindow reads a log using a line window, or the legacy byte tail when Lines is zero.
func (*Client) GetMailConversation ¶ added in v0.192.0
func (c *Client) GetMailConversation(id, box string) (MailConversation, error)
GetMailConversation reads ONE conversation by its short id (cv-…). The server resolves it inside what this caller may see, so an id of somebody else's conversation is a 404.
func (*Client) GetMemorySynthesis ¶ added in v0.205.0
func (c *Client) GetMemorySynthesis(id string) (jobstore.MemorySynthesisRun, error)
GetMemorySynthesis reads GET /v1/memory-syntheses/{id}.
func (*Client) GetPlanDriver ¶ added in v0.215.0
func (c *Client) GetPlanDriver(planID string) (job.PlanDriverStatus, error)
GetPlanDriver reads a plan's driver state (GET /v1/plans/{id}/driver): whether it is on, at which level, and with which budget. A plan without a driver answers Enabled=false.
func (*Client) GetPlanDriverReport ¶ added in v0.215.0
func (c *Client) GetPlanDriverReport(planID string) (job.PlanDriverReport, error)
GetPlanDriverReport reads a plan's driver report (GET /v1/plans/{id}/driver/report): the recorded actions against what actually happened, per action and per rule.
func (*Client) GetPlanHandoff ¶
func (c *Client) GetPlanHandoff(id string, version int) (PlanHandoff, error)
func (*Client) GetSchedule ¶
GetSchedule fetches one schedule by id.
func (*Client) GetScopedMemory ¶
func (c *Client) GetScopedMemory(scope, scopeKey, key string) (ScopedMemory, error)
func (*Client) GetServerTZOffset ¶
GetServerTZOffset reads the server's local UTC offset in seconds (bd h-aii-tnua) from GET /v1/stats. ok=false means the server did not report it (an older build), which is what lets the CLI mark a fallback timestamp "(local)".
func (*Client) GetSession ¶
GetSession fetches one session with its recent turns.
func (*Client) GetSetting ¶ added in v0.179.0
func (c *Client) GetSetting(key string) (SettingItem, error)
GetSetting fetches one setting; an unregistered key is a 404.
func (*Client) GetStage ¶ added in v0.219.0
GetStage reads a work item's flow with the current step's gate evaluated.
func (*Client) GetTemplate ¶
func (c *Client) GetTemplate(projectKey, name string, vars map[string]string) (template.Preview, error)
GetTemplate reads ONE template plus the SERVER's render of it (vars are sent as repeated `var=k=v` query params). Rendering server-side is deliberate: it is the only side that can expand {{include: …}} and resolve {{head}} against the project the job would actually run in, so the preview equals the prompt a submit produces.
func (*Client) GetTrigger ¶ added in v0.207.0
GetTrigger is GET /v1/triggers/{name}.
func (*Client) GetTunnelPreset ¶
func (c *Client) GetTunnelPreset(name string) (TunnelPreset, error)
GetTunnelPreset reads one preset. A missing name is a *StatusError with Status 404, which is what the local-fallback path branches on.
func (*Client) GetUsageStats ¶
func (c *Client) GetUsageStats() (StatsUsage, error)
GetUsageStats fetches the token/cost aggregate behind /v1/stats (SUP-01 E). It decodes that endpoint and keeps only the usage block — which is what `agent status` prints — so the dashboard can grow new blocks without touching this caller.
func (*Client) GetWorkItem ¶
func (c *Client) GetWorkItem(id string) (work.DetailView, error)
GetWorkItem reads one work item with its journal and sessions.
func (*Client) GetWorkerProjects ¶
func (c *Client) GetWorkerProjects(id string) (WorkerDetail, error)
func (*Client) GetWorkflow ¶
GetWorkflow fetches a workflow header + its step chain by id (GET /v1/workflows/{id}). An unknown id surfaces as a 404 error.
func (*Client) GetWorkflowTemplateSource ¶ added in v0.181.0
func (c *Client) GetWorkflowTemplateSource(name, project string) (workflow.TemplateSource, error)
GetWorkflowTemplateSource fetches a template's own text plus where it came from (project / global / builtin) via GET /v1/workflow-templates/{name}/source.
func (*Client) HealthChecks ¶ added in v0.215.0
func (c *Client) HealthChecks() ([]HealthCheck, error)
HealthChecks fetches the server's self-check items (GET /v1/health/checks).
func (*Client) HeartbeatSession ¶
func (c *Client) HeartbeatSession(sid string, hb SessionHeartbeat) (AgentSession, error)
HeartbeatSession applies a hook event; the returned session's Relay is the switch the Stop hook keys on. A 404 error means the session is unknown.
func (*Client) HeartbeatTunnelForwarder ¶
func (c *Client) HeartbeatTunnelForwarder(id string, specs []TunnelSpecView) (TunnelForwarder, error)
HeartbeatTunnelForwarder renews a registration. specs may be nil to keep the rules the hub already holds.
func (*Client) ImportLocalTunnelPreset ¶
func (c *Client) ImportLocalTunnelPreset(name string) (TunnelPreset, error)
func (*Client) ImportSettings ¶ added in v0.179.0
func (c *Client) ImportSettings(doc []byte, dryRun bool) (SettingImport, error)
ImportSettings posts a YAML document; dryRun reports the per-key differences without writing anything.
func (*Client) InvokeTrigger ¶ added in v0.207.0
func (c *Client) InvokeTrigger(name string, body []byte, headers map[string]string) (TriggerInvokeResult, error)
InvokeTrigger posts body to the trigger's invoke endpoint with exactly the given headers. The endpoint is authenticated by the signature in those headers, not by a gofer token, so this request deliberately carries no Authorization header.
func (*Client) IssueGet ¶
func (c *Client) IssueGet(id, trackerID string) (IssueGetResp, error)
IssueGet reads one issue from the server's tracker mirror (read-only).
func (*Client) IssueList ¶
func (c *Client) IssueList(o IssueListOpts) (IssueListResp, error)
IssueList reads the server's tracker mirror (read-only).
func (*Client) LinkWork ¶
func (c *Client) LinkWork(id, kind, ref string) (work.DetailView, error)
LinkWork links an issue / plan / todo / job.
func (*Client) LinkWorkRole ¶ added in v0.219.0
func (c *Client) LinkWorkRole(id, kind, ref, role string) (work.DetailView, error)
LinkWorkRole links a doc (role design | plan) or a job (role review); the role is what the stage gates look for, and re-linking the same (kind, ref) with another role changes it.
func (*Client) ListAdminAudit ¶ added in v0.215.0
func (c *Client) ListAdminAudit(q AdminAuditQuery) (AdminAuditPage, error)
ListAdminAudit fetches GET /v1/audit with the given filter.
func (*Client) ListAgents ¶
ListAgents fetches the server's agents (GET /v1/agents) and returns them in the mcp bridge contract shape. It decodes the endpoint's agentView wire shape then folds version/error into a single Detail (mirroring the in-process mcpserver list-agents handler) so client mode and standalone mode surface an identical agent listing.
func (*Client) ListArtifacts ¶
func (c *Client) ListArtifacts(id string) (json.RawMessage, error)
ListArtifacts fetches a peer job's artifact manifest (GET /v1/jobs/{id}/artifacts) and returns the bare `[]ArtifactItem` array as raw JSON (the inner "artifacts" array, unwrapped from the {"artifacts":[...]} envelope). It is used by the peer-http runner to回传 the产物清单 metadata onto the host job (P4-b); the raw bytes flow straight into the jobs.artifacts_json column without re-marshalling, so the manifest round-trips byte-for-byte. An empty/absent manifest yields a nil slice (no error).
func (*Client) ListCallerAudit ¶ added in v0.211.0
func (c *Client) ListCallerAudit(limit int) ([]CallerAuditEntry, error)
ListCallerAudit fetches GET /v1/callers/audit?limit=.
func (*Client) ListCallers ¶ added in v0.211.0
ListCallers fetches GET /v1/callers.
func (*Client) ListComments ¶
ListComments reads one object's thread (oldest first). The {"comments":[...]} envelope is unwrapped; an unknown scope/id surfaces as a 404 error.
func (*Client) ListDecisions ¶
ListDecisions queries GET /v1/decisions, optionally filtered by state and/or plan id ("" = no filter).
func (*Client) ListEnrollments ¶ added in v0.169.0
func (c *Client) ListEnrollments() (EnrollmentList, error)
ListEnrollments fetches GET /v1/worker-enrollments (needs worker.manage).
func (*Client) ListFollowUps ¶ added in v0.201.0
func (*Client) ListJobEvents ¶ added in v0.214.0
ListJobEvents fetches a job's event timeline (GET /v1/jobs/{id}/events), oldest first.
func (*Client) ListJobPreviews ¶ added in v0.204.0
func (c *Client) ListJobPreviews(id string) ([]JobPreview, error)
func (*Client) ListJobs ¶
ListJobs queries GET /v1/jobs with the given filters and returns the unwrapped job array (from the {"jobs":[...]} envelope). Empty filter fields are omitted from the query string. It reuses job.ListOpts (the same shape the server consumes) so the CLI (P2-c) and the server stay in lockstep; a zero-value opts lists every project's jobs up to the server default limit.
func (*Client) ListLocalTunnelPresets ¶
func (c *Client) ListLocalTunnelPresets() ([]TunnelPreset, error)
func (*Client) ListMail ¶ added in v0.173.0
func (c *Client) ListMail(o MailListOpts) ([]Mail, error)
ListMail lists the letters the caller may see.
func (*Client) ListMailAgents ¶ added in v0.185.0
func (c *Client) ListMailAgents() (MailAgents, error)
ListMailAgents lists the configured 收件 agents and their resident sessions.
func (*Client) ListMemoryCandidates ¶
func (c *Client) ListMemoryCandidates(o MemoryCandidateListOpts) ([]jobstore.MemoryCandidate, error)
ListMemoryCandidates reads the knowledge candidates of delivered jobs.
func (*Client) ListMemorySyntheses ¶ added in v0.205.0
func (c *Client) ListMemorySyntheses(o MemorySynthesisListOpts) ([]jobstore.MemorySynthesisRun, error)
ListMemorySyntheses reads GET /v1/memory-syntheses: the daily synthesis run records, metadata only (no result or material snapshot).
func (*Client) ListMergeSuggestions ¶
func (c *Client) ListMergeSuggestions() ([]jobstore.WorkMergeSuggestion, error)
ListMergeSuggestions lists the pending merge suggestions.
func (*Client) ListOpenStages ¶ added in v0.219.0
ListOpenStages lists the flows in progress (project "" = every project the caller sees).
func (*Client) ListPendingInteractions ¶
func (c *Client) ListPendingInteractions() ([]job.Interaction, error)
ListPendingInteractions fetches the pending interactions across all active jobs (E25 监督, GET /v1/interactions?status=pending), unwrapping the {"interactions":[...]} envelope. Used by the mcp client backend's gofer_list_pending_interactions tool (supervisor discovery in client mode).
func (*Client) ListPlanHandoffHistory ¶
func (c *Client) ListPlanHandoffHistory(id string) ([]PlanHandoff, error)
func (*Client) ListPlans ¶
func (c *Client) ListPlans(opts PlanListOpts) (PlanList, error)
ListPlans queries GET /v1/plans with the given filter/paging (F-d).
func (*Client) ListProjects ¶
func (c *Client) ListProjects() ([]ProjectMeta, error)
ListProjects returns the server's live projects (GET /v1/meta → projects). It is the remote counterpart to reading the local config's projects, so a node (esp. a worker) can see what the SERVER has registered.
func (*Client) ListRefs ¶ added in v0.204.0
ListRefs returns visible sources that reference kind/id.
func (*Client) ListRetries ¶
ListRetries returns a job's durable retry chain, oldest attempt first. An unknown job is an error (the server 404s rather than reporting an empty chain).
func (*Client) ListRunners ¶
func (c *Client) ListRunners() ([]RunnerMeta, error)
ListRunners fetches the server's configured runners and their advertised capabilities (GET /v1/runners). The endpoint is read-only and uses the same runner rows consumed by the web console.
func (*Client) ListScheduleEvents ¶ added in v0.178.0
ListScheduleEvents fetches a schedule's event stream (GET /v1/schedules/{id}/events) newest first. limit<=0 takes the server default; before>0 returns only events strictly older than that seq. The {"events":[...]} envelope is unwrapped to the bare slice.
func (*Client) ListSchedules ¶
ListSchedules returns the unwrapped schedule array, optionally filtered by project key.
func (*Client) ListScopedMemories ¶
func (c *Client) ListScopedMemories(opts ScopedMemoryListOpts) ([]ScopedMemory, error)
func (*Client) ListSeats ¶ added in v0.217.0
func (c *Client) ListSeats(o SeatListOpts) ([]Seat, error)
ListSeats lists seats.
func (*Client) ListSessionJobWatches ¶
func (c *Client) ListSessionJobWatches(sid string) ([]SessionJobWatch, error)
ListSessionJobWatches returns the session's currently pending job watches.
func (*Client) ListSessionMessages ¶
func (c *Client) ListSessionMessages(sid string) ([]SessionMessage, error)
func (*Client) ListSessionNudges ¶
func (c *Client) ListSessionNudges(sid string, all bool) ([]SessionNudge, error)
ListSessionNudges lists one session's nudges, or every session's when sid is "".
func (*Client) ListSessionWatches ¶ added in v0.171.0
func (c *Client) ListSessionWatches(sid string) (SessionWatches, error)
ListSessionWatches returns the session's pending job watches together with the number of sub-agents running in it. A Stop hook that entered a job-only wait while sub-agents were running uses the count to release as soon as they finish (the main agent then reads their results); a server that predates the field answers 0.
func (*Client) ListSessions ¶
func (c *Client) ListSessions(opts SessionListOpts) ([]AgentSession, error)
ListSessions lists agent sessions (GET /v1/sessions).
func (*Client) ListSettings ¶ added in v0.179.0
func (c *Client) ListSettings() ([]SettingItem, error)
ListSettings returns every registered setting in registry order.
func (*Client) ListTemplates ¶
ListTemplates reads a project's task-book templates (SUP-01 P5): the project's own .gofer/templates first, then the server's global <config-dir>/templates. Templates live on the SERVER's disk, so a client (CLI/console) reads them over HTTP.
func (*Client) ListTrackerRepos ¶ added in v0.139.0
func (c *Client) ListTrackerRepos() ([]TrackerRepo, error)
ListTrackerRepos lists the repositories mirrored on the server.
func (*Client) ListTrackerSyncClients ¶ added in v0.152.0
func (c *Client) ListTrackerSyncClients(trackerID string) ([]TrackerSyncClient, error)
ListTrackerSyncClients lists the machines that synced trackerID, most recent first. trackerID may be the global memory tracker ("global").
func (*Client) ListTriggers ¶ added in v0.207.0
ListTriggers is GET /v1/triggers.
func (*Client) ListTunnelForwarders ¶
func (c *Client) ListTunnelForwarders() ([]TunnelForwarder, error)
ListTunnelForwarders lists the online forwarders.
func (*Client) ListTunnelPresets ¶
func (c *Client) ListTunnelPresets() ([]TunnelPreset, error)
ListTunnelPresets lists the server's presets.
func (*Client) ListTunnels ¶
func (c *Client) ListTunnels() ([]TunnelInfo, error)
ListTunnels lists active tunnels.
func (*Client) ListWakeups ¶
ListWakeups returns a job's wakeups, oldest first.
func (*Client) ListWorkItems ¶
func (c *Client) ListWorkItems(o WorkListOpts) (WorkList, error)
ListWorkItems lists work items.
func (*Client) ListWorkRequests ¶
func (c *Client) ListWorkRequests(id string, activeOnly bool, limit int) ([]jobstore.WorkRequest, error)
ListWorkRequests reads the request ledger of one item ("" = every item).
func (*Client) ListWorkers ¶
func (c *Client) ListWorkers() ([]WorkerMeta, error)
ListWorkers fetches the server's worker registry from GET /v1/meta. This includes configured workers even when they are currently disconnected.
func (*Client) ListWorkflowEvents ¶
func (c *Client) ListWorkflowEvents(id string, sinceSeq int64) ([]WorkflowEvent, error)
ListWorkflowEvents fetches a workflow's append-only lifecycle events (GET /v1/workflows/{id}/events, T4.3). sinceSeq>0 returns only events strictly after that cursor. The {"events":[...]} envelope is unwrapped to the bare slice.
func (*Client) ListWorkflowTemplates ¶
func (c *Client) ListWorkflowTemplates(name, project string) ([]workflow.WorkflowTemplate, error)
ListWorkflowTemplates lists (or, with name, shows) workflow templates; project, when set, also searches that project's .gofer/workflows.
func (*Client) ListWorkflows ¶
ListWorkflows queries GET /v1/workflows, optionally filtered by status, and returns the unwrapped header array (from the {"workflows":[...]} envelope).
func (*Client) ListWorkflowsFiltered ¶ added in v0.204.0
ListWorkflowsFiltered is ListWorkflows with an optional template filter (only the runs submitted from that template name).
func (*Client) LookupCurrentAgentSession ¶
func (c *Client) LookupCurrentAgentSession(getenv func(string) string, project string) SupervisorAutoBind
LookupCurrentAgentSession resolves the agent session the caller runs in from the environment and confirms it is a live registered session (one short GET per candidate; normally exactly one variable is set). project, when non-empty, must match the session's project — the server refuses a cross-project binding. A session on a worker / in a container binds too: a todo dispatched for another machine just does not claim it as its trusted source (job.dispatchTodo). Ownership is not visible to the client; the create call is the check.
func (*Client) MCPServer ¶ added in v0.144.0
func (c *Client) MCPServer(name string) (MCPServerInfo, error)
MCPServer returns one registry entry.
func (*Client) MCPServers ¶ added in v0.144.0
func (c *Client) MCPServers() ([]MCPServerInfo, error)
MCPServers lists the server's MCP registry.
func (*Client) MemoryFindings ¶
func (c *Client) MemoryFindings(trackerID string) ([]today.MemoryFinding, error)
MemoryFindings reads GET /v1/memory-findings: the server-side memory doctor over the tracker mirror.
func (*Client) MergeJobWorktree ¶
func (c *Client) MergeJobWorktree(id string, opts job.MergeOptions) (job.MergeResult, error)
MergeJobWorktree merges a local managed worktree branch into its main checkout and runs the closing steps asked for (close the job's todo, comment on the job, clean the checkout up). cleanupOthers also removes the sibling fan worktrees of the same workflow step.
func (*Client) MergeSuggest ¶
func (c *Client) MergeSuggest(targetID, sourceID, reason string) (jobstore.WorkMergeSuggestion, bool, error)
MergeSuggest records that source should merge into target (a person confirms it).
func (*Client) MergeWorkItems ¶
MergeWorkItems folds sources into the target item.
func (*Client) OpenSessionPermission ¶
func (c *Client) OpenSessionPermission(sid string, p SessionPermission) (Decision, error)
OpenSessionPermission opens a permission decision the hook then long-polls with WaitSessionTurn. 409 = the session does not wait for the web right now.
func (*Client) OpenSessionTurn ¶
func (c *Client) OpenSessionTurn(sid, msg string, timeoutSec int64, needsReply bool) (Decision, error)
OpenSessionTurn posts the agent's last message as a relay turn (hook Stop). A 409 error means relay is off.
func (*Client) OpenStream ¶
OpenStream issues a GET against /v1/jobs/{id}/stream under ctx, attaching the bearer token, and returns the live SSE response. The caller owns closing the body and parsing the SSE frames. Unlike the other helpers it streams (no per-request timeout) so a long-lived job stays connected; cancel via ctx.
It exists so a remote runner (internal/runner/peerhttp) can consume a peer's log stream without re-deriving the base URL / auth wiring.
func (*Client) PatchSchedule ¶ added in v0.183.0
func (c *Client) PatchSchedule(id string, req PatchScheduleRequest) (Schedule, error)
PatchSchedule edits a schedule in place and returns the updated view.
func (*Client) PatchSeat ¶ added in v0.217.0
PatchSeat edits a seat (purpose / charter changes are recorded with this client's session header as the writer, see Seat.CharterBy).
func (*Client) PatchSession ¶ added in v0.166.0
func (c *Client) PatchSession(sid string, p SessionTopicPatch) (AgentSession, error)
PatchSession sets a session's topic and/or scope. The server records the source as "self" when this client's session header equals sid, otherwise "human"; an ended session is a 409 (StatusError), an unknown one 404.
func (*Client) PatchTodo ¶
func (c *Client) PatchTodo(todoID string, u TodoUpdate) (Todo, error)
PatchTodo applies one todo update and returns the stored item. status "" keeps the lifecycle, note nil keeps the note, and the patch only touches the fields it names. The dispatch fields flatten into the same body (todoPatch's json tags are the wire names), so one request carries both.
func (*Client) PatchWorkItem ¶
PatchWorkItem updates fields (PATCH body keys: rev, title, goal, status, status_source, blocker_kind, blocker_text, next_step, summary, project_key, workspace, priority, park_until, park_note, remind_at, unsorted). A stale rev answers 409.
func (*Client) PausePlan ¶
PausePlan holds a plan's automatic chain advance (POST /v1/plans/{id}/pause).
func (*Client) PickWorkflowFan ¶
PickWorkflowFan selects one completed fan of a join=pick workflow step.
func (*Client) PollEnroll ¶ added in v0.169.0
PollEnroll long-polls the request for up to wait (the server caps one poll at 25 s).
func (*Client) PostComment ¶
PostComment records a comment on scope/id (MCP-05 阶段 A) and returns the stored row plus whatever its @-mentions dispatched. WHO wrote it is the server's decision, taken from the credential the request authenticated with (SEC-01): a caller presenting a job's GOFER_JOB_TOKEN comments as that job's agent (recorded, dispatching only for a leader inside its own plan), anyone else comments as themselves.
func (*Client) PostSessionReply ¶ added in v0.135.0
func (c *Client) PostSessionReply(sid, text, to string) (SessionMessage, error)
PostSessionReply reports the session's own answer to a web message (the hook saw it SendMessage the messenger, gofer-6er0); to is the address it was sent to.
func (*Client) PreviewDelivery ¶ added in v0.148.0
func (c *Client) PreviewDelivery(id, mode string, draft *bool, branch string) (job.DeliveryPreview, error)
PreviewDelivery returns the planned delivery without executing it.
func (*Client) ProbeAgent ¶
func (c *Client) ProbeAgent(key, project string, timeoutSec int) (AgentProbe, error)
ProbeAgent submits a probe job for one agent on the server (SUP-01 P3): a synchronous, tagged job whose result is the agent's liveness. project names the project to run it in ("" = the server's first project admitting the agent); timeoutSec bounds it (0 = the server default).
func (*Client) PuntInteraction ¶
PuntInteraction POSTs to the punt endpoint (E28 client mode): the通用 sup marks a pending interaction as needs_human ("高危/拿不准, 留给人", y5wt). No body, no useful response — the central serve flips needs_human and leaves the interaction pending for a human. Returns the transport error only.
func (*Client) PutScopedMemory ¶
func (c *Client) PutScopedMemory(scope, scopeKey, key, content string, tags []string, title string) (ScopedMemory, error)
PutScopedMemory writes content and tags; a non-empty title also sets the display title (empty keeps the stored one).
func (*Client) PutStewardNotes ¶
func (c *Client) PutStewardNotes(body string, version int) (StewardNotesResp, error)
PutStewardNotes writes a new notes version when version is the current one (0 = the first write). A moved version returns *ErrStewardNotesConflict.
func (*Client) PutTunnelPreset ¶
func (c *Client) PutTunnelPreset(name string, p TunnelPreset, force bool) (TunnelPreset, error)
PutTunnelPreset writes one preset. Without force the server refuses to replace an existing name (409), which `tun save` surfaces as "use --force".
func (*Client) QueueFollowUp ¶ added in v0.201.0
func (*Client) ReadMail ¶ added in v0.173.0
ReadMail reads one letter AS ITS RECIPIENT: it fetches the letter and acknowledges it, so reading is delivery and the letter is not injected again. A caller that is only the sender gets the letter back unchanged.
func (*Client) ReaddressMail ¶ added in v0.173.0
ReaddressMail hands a held letter to a new address.
func (*Client) RebuildJob ¶
RebuildJob re-runs a job from its stored request + edits (P5). Empty overrides == a faithful re-run (the old `job rerun`); env stays server-side (only EnvSet/EnvUnset carry new values). Returns the NEW job's JobResult (its source_job_id links back to the source).
func (*Client) RedactJob ¶
func (c *Client) RedactJob(id string, req JobRedactRequest) (jobstore.RedactReport, error)
func (*Client) RedactJobSecrets ¶
func (c *Client) RedactJobSecrets(req JobSecretScanRequest) (jobstore.SecretBatchRedactReport, error)
func (*Client) RedactMail ¶ added in v0.174.0
func (c *Client) RedactMail(id int64, req MailRedactRequest) (jobstore.RedactReport, error)
RedactMail erases secrets from one letter and from the collection-box summaries that quote it. The answer is aggregate-only (counts), so no matched text can travel back.
func (*Client) RegisterSession ¶
func (c *Client) RegisterSession(in SessionRegister) (AgentSession, error)
RegisterSession upserts an agent session (hook SessionStart / first contact).
func (*Client) RegisterTunnelForwarder ¶
func (c *Client) RegisterTunnelForwarder(reg TunnelForwarderRegistration) (TunnelForwarder, error)
RegisterTunnelForwarder announces a forwarder and returns the stored registration (with the hub-assigned id).
func (*Client) RegisterWorker ¶
func (c *Client) RegisterWorker(id string, labels, projects []string) (WorkerRegistration, error)
func (*Client) RejectEnrollment ¶ added in v0.169.0
RejectEnrollment rejects a pending request, optionally blocking its source for blockSourceMin minutes.
func (*Client) RejectJob ¶
RejectJob POSTs to /v1/jobs/{id}/reject, recording a human's REFUSAL of a needs_review job: the job becomes rejected (terminal) and the note — required — is kept as the reason. resume continues the work: a new job is started with the note as its prompt and its id comes back in the outcome. For a job awaiting approval (gofer-9b1b) the server rejects the hold instead: cancelled, the note optional, resume refused.
func (*Client) RejectMemoryCandidate ¶
func (c *Client) RejectMemoryCandidate(id int64) (jobstore.MemoryCandidate, error)
RejectMemoryCandidate marks candidate id rejected.
func (*Client) ReleaseSessionTakeover ¶
func (c *Client) ReleaseSessionTakeover(sid string) (AgentSession, error)
ReleaseSessionTakeover gives a taken-over session back to its terminal (POST /v1/sessions/{sid}/release-takeover, design §9.1 B): the server cancels the takeover job and returns the session to idle. 409 when the session is not handed off, 502 when the takeover job could not be stopped.
func (*Client) ReleaseSessionTurn ¶
ReleaseSessionTurn tells the server the hook's fresh idle reading while it blocks on an auto-armed turn: released=true means the human is back, the turn is closed (EXPIRED + released_by=user_returned) and the hook must let the agent stop. A false return (still away, explicit relay, turn already settled) leaves the wait running.
func (*Client) ReloadConfig ¶ added in v0.209.1
func (c *Client) ReloadConfig() (ConfigReload, error)
ReloadConfig asks the server to re-read its config file (POST /v1/config/reload).
func (*Client) ReloadWorker ¶
ReloadWorker asks the server to make one worker re-read its config and WAITS for the worker's receipt (POST /v1/workers/{id}/reload). A worker that refuses the new config comes back as a non-2xx whose error text carries the worker's OWN reason (errorFor keeps the server's {error,detail} verbatim) — the caller must print it as-is: it names the thing to fix.
wait is the server-side budget (0 = the server default). The HTTP timeout is set a little wider so the server's own timeout answer (504, with context) wins the race against a client-side abort, which would say nothing useful.
func (*Client) RemoveJobWorktree ¶
RemoveJobWorktree runs `git worktree remove` for a job's managed worktree on the machine serving the request. A worktree with uncommitted changes is refused (409) unless force is set; deleteBranch also deletes the branch (the deliverable, so it is opt-in). The returned status has Exists=false on success.
func (*Client) RemoveSessionJobWatch ¶
RemoveSessionJobWatch removes a pending completion watch.
func (*Client) RemoveWorker ¶
func (*Client) RenameTrackerRepo ¶
func (c *Client) RenameTrackerRepo(oldID, newID string) (TrackerRenameResult, error)
RenameTrackerRepo asks the server to move a mirrored repository from a legacy UUID tracker_id to its derived short id (POST /v1/tracker/repos/{tracker_id}/rename).
DEPRECATED(v0.126): remove in v0.129 (legacy UUID tracker_id migration).
func (*Client) RenewAuthGrant ¶ added in v0.171.0
RenewAuthGrant pushes back the deadline of a session grant that is still in force (POST /v1/auth/grants/{id}/renew): the new deadline is now + expiresSec, which the server caps at 24 hours. Only the deadline moves — the pattern, its expansion snapshot, the grantor, the session owner and the incarnation all stay, so a renewal can neither widen nor move a grant. A grant that expired, was revoked, or whose session ended is refused (409) and the error carries the server's reason: those need a new grant, not a longer one.
func (*Client) RenewJobPreview ¶ added in v0.205.0
func (c *Client) RenewJobPreview(jobID, previewID string, ttl int) (JobPreview, error)
func (*Client) ReplyMail ¶ added in v0.173.0
ReplyMail answers a letter in its thread; the answer goes back to the original sender.
func (*Client) ReportWork ¶
ReportWork writes a session's self-report (goal/status/blocker/next/summary).
func (*Client) ReportWorkBySession ¶ added in v0.208.0
func (c *Client) ReportWorkBySession(fields map[string]any) (out work.DetailView, created bool, err error)
ReportWorkBySession is ReportWork without an item id (POST /v1/work-items/report): the session (fields["session_id"], else the client's own session header) reports on its work item; a session without one gets it created by this first report, titled by fields["title"] (else its goal). created tells the two apart.
func (*Client) RequestWorkReport ¶
func (c *Client) RequestWorkReport(id, sessionID, kind string) (bool, []WorkReportRequestResult, error)
RequestWorkReport asks the item's running session(s) to report (kind "report", the default) or to write a hand-over ("handoff") through the request ledger; a session that is not running is tidied up instead.
func (*Client) RerunWorkflow ¶ added in v0.181.0
RerunWorkflow re-runs a finished workflow as a NEW one (POST /v1/workflows/{id}/rerun): mode "failed" keeps only its failed steps (and fans), mode "from" keeps step `step` (number or name) and every later step. The new workflow records rerun_of; the original is untouched. A running workflow is refused.
func (*Client) ResetBackgroundAgent ¶ added in v0.208.0
ResetBackgroundAgent is POST /v1/background-agents/{kind}/session/reset.
func (*Client) ResetSetting ¶ added in v0.179.0
func (c *Client) ResetSetting(key string) (SettingReset, error)
ResetSetting drops a stored value so the registered default applies again.
func (*Client) ResolveSessionPermission ¶
ResolveSessionPermission reports that the prompt of tool call fp ("" = every pending prompt) was settled in the terminal; it returns how many were closed.
func (*Client) RespondMail ¶ added in v0.203.0
RespondMail records a sender-visible received/done acknowledgement without creating a letter.
func (*Client) RestartSeat ¶ added in v0.217.0
func (c *Client) RestartSeat(id string) (SeatOpenPlan, error)
RestartSeat starts the ended ACP session of an acp seat again from its original session id and moves the seat to the new job (needs job.submit).
func (*Client) ResumeJob ¶
ResumeJob POSTs to /v1/jobs/{id}/resume to续接 the source job's底层 agent 会话 (session-capture P2). It returns the NEW job's snapshot (its session_id links back to the source session). runner is optional; when set the server enforces it equals the source runner (同 runner 约束). The default is async — the caller watches the returned job id.
func (*Client) ResumeJobWith ¶
func (c *Client) ResumeJobWith(id, prompt, runner string, opts job.ResumeOptions) (job.JobResult, error)
ResumeJobWith is ResumeJob with an explicit continuation form (opts.Mode: session|interactive|batch) and/or target agent (opts.Agent, same session family only). Zero opts behave exactly like ResumeJob.
func (*Client) ResumePlan ¶
ResumePlan releases a plan's pause and block and advances the chain (POST /v1/plans/{id}/resume).
func (*Client) ResumeSession ¶
func (c *Client) ResumeSession(sid, input string) (SessionDeliverResult, error)
ResumeSession wakes a session up (POST /v1/sessions/{sid}/resume): the server starts an interactive `--resume` process for it — an ended session included — and the answer names the job to attach to. input is optional first text for the new terminal. A 409 carries the reason code and a plain explanation.
func (*Client) RotateCaller ¶ added in v0.211.0
func (c *Client) RotateCaller(id, expires string) (CallerChange, error)
RotateCaller replaces a caller's token (POST /v1/callers/{id}/rotate). expires (90d, a date, or never) replaces the token's expiry; empty keeps the current one.
func (*Client) RotateScheduleToken ¶
RotateScheduleToken mints a fresh webhook secret for a schedule (AUTO-02b, POST /v1/schedules/{id}/rotate-token). It also ENABLES the webhook for a schedule that was created without one; the previous token stops working at once.
func (*Client) RuleList ¶
RuleList lists the library (GET /v1/rules). The server always answers with an array, but a null body is normalised to an empty slice so a caller may range and len() without a nil check.
func (*Client) RuleRemove ¶
RuleRemove deletes a rule (DELETE /v1/rules/{name}, 204).
func (*Client) RuleSet ¶
RuleSet creates or replaces a rule (PUT /v1/rules/{name}) with the text as the JSON `content` field. A rule is small by design (server.rules_max_bytes), so the body is buffered rather than streamed.
func (*Client) RunMemorySynthesis ¶ added in v0.207.0
func (c *Client) RunMemorySynthesis(o MemorySynthesisRunOpts) (MemorySynthesisRunResult, error)
RunMemorySynthesis posts an explicit run and waits for it: the server answers when the model call has finished, so this request outlives the default client deadline.
func (*Client) RunPlan ¶
RunPlan starts a plan's chain (POST /v1/plans/{id}/run, PLAN-03): it releases a pause and a block, queues every pending item whose dependencies are satisfied and that has an assignee, and returns the plan header as it stands.
func (*Client) RunSchedule ¶
RunSchedule triggers a schedule immediately without changing its next_run_at. params carries the run's parameter overrides (design 2026-10-22 §D3); nil runs with the declared defaults. An override the schedule does not declare is refused by the server (400 listing the declared names).
func (*Client) RunnersOverview ¶
func (c *Client) RunnersOverview() (RunnersOverview, error)
RunnersOverview fetches the runners together with the server's version.
func (*Client) SaveWorkflowAsTemplate ¶ added in v0.181.0
func (c *Client) SaveWorkflowAsTemplate(id, name, scope, project string) (workflow.TemplateWriteResult, error)
SaveWorkflowAsTemplate stores a workflow's exported spec as a named template (POST /v1/workflows/{id}/save-as-template), with the same scopes and validation as SaveWorkflowTemplate.
func (*Client) SaveWorkflowTemplate ¶ added in v0.181.0
func (c *Client) SaveWorkflowTemplate(name, content, scope, project string) (workflow.TemplateWriteResult, error)
SaveWorkflowTemplate writes a template to the global scope (scope=global) or a project's workspace (scope=project + project key): PUT /v1/workflow-templates/{name}. The body is validated server-side; a project template comes back flagged uncommitted with the git command that would commit it.
func (*Client) SaySession ¶
SaySession answers the session's newest OPEN turn. A 409 error means no turn is waiting.
func (*Client) ScanJobSecrets ¶
func (c *Client) ScanJobSecrets(req JobSecretScanRequest) (jobstore.SecretScanReport, error)
func (*Client) SeatCandidates ¶ added in v0.217.0
SeatCandidates lists the seats a terminal session could be bound to.
func (*Client) SeatOpenPlan ¶ added in v0.217.0
func (c *Client) SeatOpenPlan(id string) (SeatOpenPlan, error)
SeatOpenPlan returns how to open a seat. It only reads: an ended ACP session comes back as NeedsRestart, and RestartSeat starts it again.
func (*Client) SendHeldSessionMessages ¶ added in v0.186.0
SendHeldSessionMessages is 「现在送」: paste the session's waiting messages into its terminal right now, past the input-area guard and the delivery mode.
func (*Client) SendMail ¶ added in v0.173.0
SendMail sends one letter. to "" or "caller" is the caller's own capture box. The wire keeps the single-string form, so a single letter looks exactly as it did before broadcasts.
func (*Client) SendMailTo ¶ added in v0.184.0
SendMailTo sends one letter to several recipients (a broadcast): repeated addresses and `each:` selectors are resolved by the server, which answers with the addressee table.
func (*Client) SendSessionMessage ¶
func (c *Client) SendSessionMessage(sid, message string) (SessionMessage, error)
SendSessionMessage submits a web message. The server chooses relay for a waiting turn or a one-shot messenger job for every other session state.
func (*Client) SessionAsk ¶
SessionAsk "带话": delivers a short message to a running session (terminal session id or ACP / pty session job id). A session that is not online is a 409 error.
func (*Client) SessionFocus ¶ added in v0.186.0
func (c *Client) SessionFocus(sid string) (SessionFocus, error)
SessionFocus reads the session's own supervision state (plans, job watches, unreplied letters) for `repo prime`'s post-compact re-injection.
func (*Client) SessionID ¶ added in v0.163.0
SessionID reports the terminal session every request of this client names, and the environment variable the id came from ("" / "" when no session is attached). `gofer auth whoami` shows both, so an operator can tell a request that was attached to a session from one that was not.
func (*Client) SessionScreen ¶ added in v0.201.0
func (c *Client) SessionScreen(sid string, n int) (SessionScreen, error)
SessionScreen reads the tail of what a session shows (GET /v1/sessions/{sid}/screen): n bounds the returned lines (0 = the server default).
func (*Client) SessionTail ¶
SessionTail reads the read-only tail of a session's transcript.
func (*Client) SessionTakeoverPlan ¶
func (c *Client) SessionTakeoverPlan(sid string) (SessionResumePlan, error)
SessionTakeoverPlan asks what waking the session up would do, without doing it.
func (*Client) SetCallerCeiling ¶ added in v0.211.0
func (c *Client) SetCallerCeiling(id string, req CallerCeilingRequest) (CallerChange, error)
SetCallerCeiling replaces (or, with NoCeiling, removes) a caller's ceiling.
func (*Client) SetCallerLimits ¶ added in v0.211.0
func (c *Client) SetCallerLimits(id string, req CallerLimitsRequest) (CallerChange, error)
SetCallerLimits replaces a caller's quota overrides.
func (*Client) SetJobTitle ¶
SetJobTitle updates or clears a job's human-readable title.
func (*Client) SetPlanCompleteOn ¶ added in v0.214.0
SetPlanCompleteOn sets when a plan's todos count as done (PATCH /v1/plans/{id}): `job` (default) when the job finishes, `merge` when its delivery lands.
func (*Client) SetPlanDriver ¶ added in v0.215.0
func (c *Client) SetPlanDriver(planID, level string, budget job.PlanDriverBudget) (job.PlanDriverStatus, error)
SetPlanDriver enables (or re-configures) a plan's driver at level with budget (PUT /v1/plans/{id}/driver, plan R4). This version accepts the record level only: the server refuses assist / auto with a 400 that says so, before storing anything.
func (*Client) SetPlanHandoff ¶
func (c *Client) SetPlanHandoff(id, body string, expectedVersion int) (PlanHandoff, error)
func (*Client) SetPlanLeader ¶
SetPlanLeader flips a plan's leader-round switch (PATCH /v1/plans/{id}, LEAD-02) without touching its status: on|off. The returned plan carries the switch's new value and, when it was just turned on, the warnings about the members still in flight.
func (*Client) SetPlanNotify ¶ added in v0.160.0
SetPlanNotify flips a plan's end-notification switch (gofer-3db4, PATCH /v1/plans/{id}): with it `on`, every job the plan dispatches tells the plan's supervisor session that it ended. `off` is the server's default.
func (*Client) SetPlanSupervisorSessionID ¶
SetPlanSupervisorSessionID binds or clears the supervising session. A nil pointer preserves the current binding; a pointer to empty string clears it.
func (*Client) SetScheduleEnabled ¶
SetScheduleEnabled toggles a schedule through /enable or /disable.
func (*Client) SetSessionInjectMode ¶ added in v0.186.0
func (c *Client) SetSessionInjectMode(sid, mode string) (AgentSession, error)
SetSessionInjectMode sets the terminal delivery mode (auto|hold|force, design 2026-10-22 D5): whether a message may be typed into the session's terminal, and whether the input area has to be confirmed empty first.
func (*Client) SetSessionMailPaused ¶ added in v0.203.0
func (c *Client) SetSessionMailPaused(sid string, paused bool) (AgentSession, error)
SetSessionMailPaused pauses or resumes delivery to a session.
func (*Client) SetSessionNudgeState ¶
func (c *Client) SetSessionNudgeState(id, state string) (SessionNudge, error)
SetSessionNudgeState pauses ("paused") or resumes ("active") a nudge.
func (*Client) SetSessionOwner ¶ added in v0.155.1
func (c *Client) SetSessionOwner(sid, callerID string) (AgentSession, error)
SetSessionOwner hands a session to another caller (POST /v1/sessions/{sid}/owner, gofer-eh53): the admin's way out of a token split, where a terminal's hook now reports as a caller the session does not belong to. Needs can_admin; 400 for a caller id the server does not know, 404 for an unknown session.
func (*Client) SetSessionRelayMode ¶
func (c *Client) SetSessionRelayMode(sid, mode string) (AgentSession, error)
func (*Client) SetSetting ¶ added in v0.179.0
func (c *Client) SetSetting(key string, value any) (SettingItem, error)
SetSetting writes one setting. value is passed through as the JSON value the key's registered kind expects (a number, a bool, a []string), so the server validates it as the caller meant it rather than as a string.
func (*Client) SetWakeupEnabled ¶
SetWakeupEnabled flips a wakeup's switch (PATCH /v1/wakeups/{id}). Enabling a timer re-arms it from now — the ticks it missed while off are not replayed.
func (*Client) SkillExport ¶
SkillExport streams a skill's archive (GET /v1/skills/{name}/export) into w.
It streams rather than buffering for the same reason XferDownload does — the payload is a file the caller owns — and w is written as given: the caller owns the temp-name + rename policy, so a failed stream never leaves a usable-looking .zip behind.
func (*Client) SkillImportFile ¶
func (c *Client) SkillImportFile(path string) (SkillImportResult, error)
SkillImportFile uploads a local .zip as the multipart `file` part (POST /v1/skills/import). The CLI zips a local DIRECTORY into a temp .zip first: the wire carries an archive, never a client-side path, so the server never has to reach back into this machine's filesystem.
func (*Client) SkillImportSource ¶
func (c *Client) SkillImportSource(src string) (SkillImportResult, error)
SkillImportSource imports from a spec the SERVER resolves itself (`http(s)://…/x.zip`, `git+https://…#subdir`) via POST /v1/skills/import with a JSON body. Those sources are fetched server-side on purpose: a client node has no reason to download an archive it would only hand straight back.
func (*Client) SkillList ¶
SkillList lists the library (GET /v1/skills). The server always answers with an array, but a null body is normalised to an empty slice so a caller may range and len() without a nil check.
func (*Client) SkillRemove ¶
SkillRemove deletes a skill (DELETE /v1/skills/{name}, 204).
func (*Client) SkillShow ¶
SkillShow fetches one skill together with its SKILL.md text (GET /v1/skills/{name}).
func (*Client) SkillUpdate ¶
func (c *Client) SkillUpdate(name string) (SkillUpdateResult, error)
SkillUpdate re-fetches a skill from its recorded source (POST /v1/skills/{name}/update).
func (*Client) SplitWorkItem ¶
func (c *Client) SplitWorkItem(id, title, goal string, sessionIDs []string, keep bool) (WorkSplitResult, error)
SplitWorkItem creates a new item out of id.
func (*Client) StageApprove ¶ added in v0.219.0
StageApprove records a person's approval of the current step (the server refuses a job credential and a request that names a live session).
func (*Client) StageBack ¶ added in v0.219.0
StageBack sends the flow one step back; a reason is required.
func (*Client) StageBlocked ¶ added in v0.219.0
StageBlocked marks the flow blocked on its current step; a reason is required.
func (*Client) StageDone ¶ added in v0.219.0
StageDone asks the server to evaluate the current step's gate and move on when it passes.
func (*Client) StageDrop ¶ added in v0.219.0
StageDrop abandons the flow (the work item is untouched); the reason is optional.
func (*Client) StageStartByIssue ¶ added in v0.219.0
func (c *Client) StageStartByIssue(issue, template, projectKey, title, sessionID string) (stage.View, error)
StageStartByIssue starts a flow by issue: the open work item already linked to it, else a new item linked to it. projectKey / title are used only when the item is created.
func (*Client) StageStartOn ¶ added in v0.219.0
StageStartOn starts a flow on a work item, linking issue to it when given. template is a built-in name (feature | small) or "" for the server default; sessionID, when set, becomes a current session of the item.
func (*Client) StageWorkerUpgrade ¶
StageWorkerUpgrade uploads the file as worker id's upgrade binary. The server computes the digest itself; the returned values are what it stored.
func (*Client) StartHostedTunnelForwarder ¶
func (c *Client) StartHostedTunnelForwarder(name string) (TunnelForwarder, string, error)
StartHostedTunnelForwarder starts a server-local listener for one preset.
func (*Client) StartWorkerUpgrade ¶
func (c *Client) StartWorkerUpgrade(id string, opt WorkerUpgradeOptions) (WorkerUpgradeRecord, error)
StartWorkerUpgrade asks the server to upgrade worker id. It returns once the worker has accepted the new binary (HTTP 202) with the pending upgrade record; the final outcome is read from GetWorker(id).Upgrade.
func (*Client) StatsBackfill ¶
func (c *Client) StatsBackfill(req StatsBackfillRequest) (StatsBackfillResult, error)
StatsBackfill runs one dashboard-metrics backfill batch on the server.
func (*Client) StewardAsk ¶
StewardAsk puts a question to the steward (starting it when needed).
func (*Client) StewardNotes ¶
func (c *Client) StewardNotes(version int) (StewardNotesResp, error)
StewardNotes reads the latest notes (version 0) or one historical version.
func (*Client) StewardNotesHistory ¶
StewardNotesHistory lists every version, newest first.
func (*Client) StewardObservations ¶ added in v0.208.0
func (c *Client) StewardObservations(limit int) ([]jobstore.StewardObservation, error)
StewardObservations lists what the steward's proactive reviews would have done (observe mode), newest first; limit <= 0 = the server's default.
func (*Client) StewardRestart ¶
func (c *Client) StewardRestart() (steward.StartResult, error)
StewardRestart ends the session and opens a fresh one from the prime.
func (*Client) StewardReview ¶
func (c *Client) StewardReview(force bool) (steward.ReviewResult, error)
StewardReview runs a manual review now (force = even when nothing changed).
func (*Client) StewardReviewSummary ¶
StewardReviewSummary stores the review's point of view (the digest's steward comment).
func (*Client) StewardStart ¶
func (c *Client) StewardStart() (steward.StartResult, error)
StewardStart opens the steward session when none lives.
func (*Client) StewardStatus ¶
func (c *Client) StewardStatus() (StewardState, error)
StewardStatus reads the steward's status and settings.
func (*Client) StewardStop ¶
StewardStop ends the live session; stopped=false when none lived.
func (*Client) StopHostedTunnelForwarder ¶
StopHostedTunnelForwarder stops a server-local listener for one preset.
func (*Client) StopTunnelForwarder ¶
func (c *Client) StopTunnelForwarder(id string) (TunnelForwarder, error)
StopTunnelForwarder asks an external forwarder process to exit. The hub answers 202 with the marked entry; the process exits at its next heartbeat (<= 30s). A 409 means the process is too old to be stopped remotely (or is server-hosted).
func (*Client) StreamJob ¶
StreamJob opens the job's SSE stream (GET /v1/jobs/{id}/stream?from=) under ctx and invokes onEvent for each parsed frame in order. It returns when the stream emits an `end` event, the connection closes (EOF), or ctx is cancelled. The from offset resumes the stdout stream from a byte position (<=0 starts at the beginning). It reuses ParseSSE (the same Go-side frame parser the peer-http runner consumes), buffering across reads so a frame split over two reads is still parsed once whole. A transport error other than EOF is returned; ctx cancellation returns nil (a clean caller-driven stop).
func (*Client) SubmitJob ¶
SubmitJob POSTs a JobRequest to /v1/jobs and returns the initial JobResult (with the assigned id and queued/running status). It ignores the 202/async distinction; use SubmitJobSync when that matters.
func (*Client) SubmitJobResult ¶ added in v0.215.0
SubmitJobResult reports the outcome of the job the caller's credential belongs to (gofer_submit_result): a job credential may only report its own job, once.
func (*Client) SubmitJobSync ¶
func (c *Client) SubmitJobSync(req job.JobRequest) (SubmitResult, error)
SubmitJobSync POSTs a JobRequest as JSON and reports whether the server fell back to async (202 + X-Gofer-Async) so a sync caller can switch to polling.
func (*Client) SubmitMarkdown ¶
func (c *Client) SubmitMarkdown(body []byte) (SubmitResult, error)
SubmitMarkdown POSTs a md+yaml document (frontmatter + prose) to /v1/jobs with Content-Type text/markdown so the server parses it into a JobRequest (design §6.2). Like SubmitJobSync it surfaces the 202/async fallback.
func (*Client) SubmitWorkflow ¶
SubmitWorkflow POSTs a WorkflowSpec as JSON to /v1/workflows and returns the created workflow header (running, step 1 started). The caller id is stamped server-side, so the spec carries no caller field (design §5.7).
func (*Client) SubmitWorkflowTemplate ¶
func (c *Client) SubmitWorkflowTemplate(name, project string, vars map[string]string) (Workflow, error)
SubmitWorkflowTemplate asks the server to resolve a named workflow template.
func (*Client) SummarizeWork ¶
func (c *Client) SummarizeWork(id string) (jobstore.WorkRequest, error)
SummarizeWork triggers a tidy-up of the item now; it returns the ledger request that tracks it (the run is in the background).
func (*Client) SyncTrackerRepo ¶
func (c *Client) SyncTrackerRepo(trackerID string) (TrackerRepoSyncResult, error)
SyncTrackerRepo asks the server to run `gofer repo sync` in the mirrored repository trackerID (POST /v1/tracker/repos/{tracker_id}/sync; person credentials only).
func (*Client) TodayAdvise ¶
TodayAdvise writes the steward's (or a person's) advice on one 「今天」 card.
func (*Client) TriggerDeliveries ¶ added in v0.207.0
TriggerDeliveries is GET /v1/triggers/{name}/deliveries (limit <= 0: the server default).
func (*Client) UnbindSeat ¶ added in v0.217.0
UnbindSeat empties a seat.
func (*Client) UnflagScopedMemory ¶
func (c *Client) UnflagScopedMemory(scope, scopeKey, key string) (ScopedMemory, error)
UnflagScopedMemory clears every flag of a scoped memory (the human review).
func (*Client) UnlinkWork ¶
func (c *Client) UnlinkWork(id, kind, ref string) (work.DetailView, error)
UnlinkWork removes a link.
func (*Client) UnregisterTunnelForwarder ¶
UnregisterTunnelForwarder removes a registration (the forwarder's clean goodbye).
func (*Client) UpdatePlan ¶
UpdatePlan moves a plan along its lifecycle (PATCH /v1/plans/{id}, P6). status must be one of open/done/archived/blocked. A nil progress keeps the plan's current progress.
func (*Client) UpdatePlanTags ¶
UpdatePlanTags updates the plan's complete tag set and/or removes named tags.
func (*Client) UpdateTodo ¶
UpdateTodo sets a todo's manual done flag (legacy二态 wrapper over PatchTodo).
func (*Client) WaitSession ¶ added in v0.201.0
func (c *Client) WaitSession(sid string, until []string, timeout time.Duration) (SessionWaitResult, error)
WaitSession long-polls a session's state (GET /v1/sessions/{sid}/wait): it returns as soon as the state is one of until, or when timeout runs out (Reached=false). timeout <= 0 asks for the current state only.
The HTTP timeout is a little wider than the server-side budget, so the server's own answer wins the race against a client-side abort.
func (*Client) WaitSessionTurn ¶
func (c *Client) WaitSessionTurn(sid, decisionID string, waitSec int) (TurnStatus, error)
WaitSessionTurn long-polls a turn for up to waitSec seconds (server caps at 25).
func (*Client) WatchJob ¶
func (c *Client) WatchJob(ctx context.Context, id string, from int, h WatchHandlers) (final string, err error)
WatchJob streams a job's SSE (status + incremental logs) under ctx until the stream ends (terminal `end` frame / EOF) or ctx is cancelled, invoking the handlers on status changes and log text. It returns the terminal status it observed; when the stream ended without a terminal status frame it fetches the authoritative status via GetJob (final == "" only if that fetch also fails). ctx cancellation (e.g. Ctrl-C) returns the status seen so far (often ""), so the caller can detect an interrupt via ctx.Err(). The state-machine is the shared watch logic behind `job watch` and `job rerun --watch`.
func (*Client) WatchWorkflow ¶
func (c *Client) WatchWorkflow(ctx context.Context, id string, onStep func(st WorkflowStep)) (Workflow, error)
WatchWorkflow polls GetWorkflow until the workflow reaches a terminal state, invoking onStep on each step's status CHANGE (per step index). It returns the terminal workflow. Workflow-level SSE is a follow-up; v1 uses a simple poll loop (plan §P3-a range note). onStep may be nil.
func (*Client) Whoami ¶ added in v0.162.0
func (c *Client) Whoami() (AuthWhoami, error)
Whoami asks GET /v1/auth/whoami. The request carries the terminal session this client names (SessionIDFromEnv, attached by the single injection point of the client package), so the answer is the decision the server really makes for a request from this terminal.
func (*Client) WorkDigest ¶
WorkDigest previews the digest, or with send queues it to the webhooks now.
func (*Client) WorkDispatchTargets ¶ added in v0.166.0
func (c *Client) WorkDispatchTargets(id string) ([]WorkDispatchTarget, error)
WorkDispatchTargets returns the top candidate sessions for an item (GET /v1/work-items/{id}/dispatch-targets).
func (*Client) WorkSummarizerStatus ¶
WorkSummarizerStatus reads the summarizer's availability and the effective work settings as raw JSON (the console's shape).
func (*Client) WorkToTodo ¶
func (c *Client) WorkToTodo(id, planID, newPlanTitle string) (WorkToTodoResult, error)
WorkToTodo turns the item into a todo of planID (empty = a new plan titled newPlanTitle, default the item's title). A second conversion is a 409 error.
func (*Client) WorkerAssignable ¶
func (c *Client) WorkerAssignable(workerID string) (WorkerAssignable, error)
WorkerAssignable fetches GET /v1/workers/{id}/assignable — the read-only call `gofer worker init` makes before it can infer roots or probe agents. The endpoint requires a user caller or the worker's own token; a worker init runs with the latter (the token it is being handed).
func (*Client) XferDownload ¶
XferDownload streams a transfer's payload into destPath (GET /v1/xfer/{id}/content) and returns the bytes written plus their sha256.
The bytes are verified twice on the way in: the declared size against X-Gofer-Size, and the streaming digest against X-Gofer-Sha256. Anything that does not match — or a write error — REMOVES the file, so a caller never sees a truncated or corrupted payload it might mistake for the real one.
destPath is written as given: the caller owns the temp-name + rename policy (the CLI downloads to `<dst>.gofer-part` and renames), because only the caller knows what "never leave a partial file" means for its destination.
func (*Client) XferGet ¶
XferGet asks a runner to read project/path and stage it for us (POST /v1/xfer with a JSON meta, no payload). The returned record is dispatched already: poll XferStatus until it is done, then XferDownload the content.
func (*Client) XferList ¶
func (c *Client) XferList(state, runner string) ([]XferRecord, error)
XferList lists the staging area (GET /v1/xfer?state=&runner=), newest first as the server orders it. Empty filters are omitted.
func (*Client) XferPrecheck ¶
func (c *Client) XferPrecheck(ctx context.Context, runner, project, path string, size int64, force bool) error
XferPrecheck asks the server to validate a transfer target and size WITHOUT staging anything or sending a payload (bd h-aii-gnm3). xferPut calls it after the stat and BEFORE the digest pass, so an escaping path, an unknown project, an offline runner or an over-cap file fails while the file is still untouched — the alternative (found on a real machine) was a 400 after 34% of the bytes had been uploaded.
It carries the same meta object the multipart create sends, so the two can never validate different things.
func (*Client) XferPut ¶
func (c *Client) XferPut(ctx context.Context, runner, project, path, localPath string, force bool, progress func(sent, total int64)) (XferRecord, error)
XferPut pushes a local file to runner:project/path (POST /v1/xfer, multipart/form-data). The file is stat'ed and hashed first — the server verifies the DECLARED digest against the streamed one, so the meta field has to carry the real sha256 — then streamed in 1MB chunks, which is what lets progress fire and keeps the bytes off the heap. progress, when set, is called after every chunk with the bytes sent so far and the total.
force allows replacing a file that already exists at the target (without it a push onto an existing path fails with the server's own "exists").
The returned record is the meta we sent plus the created id and state: the create answer carries nothing else.
func (*Client) XferRemove ¶
XferRemove deletes a transfer and its staged payload (DELETE /v1/xfer/{id}).
func (*Client) XferStage ¶
func (c *Client) XferStage(ctx context.Context, runner, project, path, localPath string) (XferRecord, error)
XferStage pushes a local file into the staging area and STOPS there (no executor is dispatched): it is the `job run --upload` half of XFER-01 X2, where the file is placed by the job's executing machine — at the job's own cwd — once the job starts. The returned id goes into the request's uploads.
func (*Client) XferStatus ¶
func (c *Client) XferStatus(id string) (XferRecord, error)
XferStatus fetches one transfer's current record (GET /v1/xfer/{id}).
type Comment ¶
type Comment struct {
ID string `json:"id"`
Scope string `json:"scope"`
ScopeID string `json:"scope_id"`
Author string `json:"author"`
AuthorKind string `json:"author_kind"`
Body string `json:"body"`
Mentions []string `json:"mentions"`
CreatedAt int64 `json:"created_at"`
// TriggeredJobID is the job this comment dispatched ("" = none).
TriggeredJobID string `json:"triggered_job_id,omitempty"`
// Dispatched is the per-mention receipt, present on the POST response.
Dispatched []CommentDispatch `json:"dispatched,omitempty"`
}
Comment is one comment on the wire (MCP-05 阶段 A): a row of a job's, a plan's or a checklist item's thread. Mentions is the parsed @-name list (so a client highlights without re-parsing the body), TriggeredJobID the first job the comment started, and Dispatched the full set when one comment mentioned several agents.
type CommentDispatch ¶
type CommentDispatch struct {
Mention string `json:"mention"`
Kind string `json:"kind"`
JobID string `json:"job_id"`
}
CommentDispatch is one job an @-mention started.
type ConfigReload ¶ added in v0.209.1
type ConfigReload struct {
Status string `json:"status"`
Reloaded bool `json:"reloaded"`
Rev int64 `json:"rev"`
Path string `json:"path"`
Changed []string `json:"changed"`
RestartRequired []string `json:"restart_required"`
}
MergeJobWorktree merges a local managed worktree branch into its main checkout; cleanupOthers also removes the sibling fan worktrees of the same workflow step. ConfigReload is the receipt of POST /v1/config/reload.
type CreateInteractionRequest ¶ added in v0.215.0
type CreateInteractionRequest struct {
Type string `json:"type,omitempty"`
Prompt string `json:"prompt"`
Options []job.InteractionOption `json:"options,omitempty"`
Multi bool `json:"multi,omitempty"`
AllowOther bool `json:"allow_other,omitempty"`
Recommended string `json:"recommended,omitempty"`
TimeoutSec int `json:"timeout_sec,omitempty"`
}
CreateInteractionRequest is the body of POST /v1/jobs/{id}/interactions. A job credential opens question / choice / confirmation interactions on its own job with it (gofer_ask).
type CreateScheduleRequest ¶
type CreateScheduleRequest struct {
Name string `json:"name"`
Type string `json:"type,omitempty"`
Cron string `json:"cron"`
DelaySec int64 `json:"delay_sec,omitempty"`
RunAt int64 `json:"run_at,omitempty"`
Request job.JobRequest `json:"request"`
Enabled *bool `json:"enabled,omitempty"`
CatchUp *bool `json:"catch_up,omitempty"`
// Webhook enables the schedule's external trigger endpoint (AUTO-02b): the server
// mints a trigger_token, shown on the schedule from then on.
Webhook bool `json:"webhook,omitempty"`
// Params declares the schedule's parameters (design 2026-10-22 §D1).
Params []job.ScheduleParam `json:"params,omitempty"`
// Run health (design 2026-11-12 §1); nil = the server's new-schedule default.
Overlap string `json:"overlap,omitempty"`
MaxRuns *int `json:"max_runs,omitempty"`
MaxFailures *int `json:"max_failures,omitempty"`
// Precheck is the pre-run check; setting one needs the schedule.precheck permission.
Precheck *job.SchedulePrecheck `json:"precheck,omitempty"`
// Context is "on" or "off"; "" = the server default (on).
Context string `json:"context,omitempty"`
// Target is "seat:<seat id>" to deliver request.prompt to a seat instead of submitting a job.
Target string `json:"target,omitempty"`
}
CreateScheduleRequest is POST /v1/schedules. Enabled/CatchUp are pointers so callers can omit them and let the server defaults apply.
type Decision ¶
type Decision struct {
ID string `json:"id"`
PlanID string `json:"plan_id,omitempty"`
Title string `json:"title"`
Question string `json:"question"`
Options []string `json:"options,omitempty"`
Answer string `json:"answer,omitempty"`
State string `json:"state"`
TimeoutSec int64 `json:"timeout_sec"`
AskedAt int64 `json:"asked_at"`
AnsweredAt int64 `json:"answered_at,omitempty"`
AnsweredBy string `json:"answered_by,omitempty"`
// SessionID / Kind identify a session-relay turn (SESS-01); empty otherwise.
SessionID string `json:"session_id,omitempty"`
Kind string `json:"kind,omitempty"`
// ReleasedBy is set when a relay turn was closed without an answer (SR-A5,
// "user_returned"): the hook saw the human come back. Empty otherwise.
ReleasedBy string `json:"released_by,omitempty"`
// Detail is the JSON audit blob of a NON-turn delivery (SESS-01 §9.1 A):
// {"path":"tmux","job_id":"…"} when the relay typed the text into a terminal
// instead of answering a turn. Empty for real turns.
Detail string `json:"detail,omitempty"`
}
Decision is the client-side view of a plan_decisions row (decision channel, Part C §C3). PlanID "" is a global question; Options empty = free-text answer. State is OPEN|ANSWERED|EXPIRED; timestamps are unix seconds.
type EnrollAccepted ¶ added in v0.169.0
type EnrollAccepted struct {
WorkerID string `json:"worker_id"`
CollectUntil int64 `json:"collect_until"`
}
EnrollAccepted is the answer to an accept call (no token).
type EnrollHost ¶ added in v0.169.0
type EnrollHost struct {
Hostname string `json:"hostname,omitempty"`
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
GoferVersion string `json:"gofer_version,omitempty"`
ProtocolVersion string `json:"protocol_version,omitempty"`
Agents []string `json:"agents,omitempty"`
Roots []string `json:"roots,omitempty"`
}
EnrollHost is the host description a joining worker sends (display only).
type EnrollPoll ¶ added in v0.169.0
type EnrollPoll struct {
State string `json:"state"`
WorkerID string `json:"worker_id,omitempty"`
WorkerToken string `json:"worker_token,omitempty"`
CollectUntil int64 `json:"collect_until,omitempty"`
Reason string `json:"reason,omitempty"`
}
EnrollPoll is one poll result. WorkerToken is set only for an accepted request.
type EnrollRequest ¶ added in v0.169.0
type EnrollRequest struct {
RequestedID string `json:"requested_id,omitempty"`
Labels []string `json:"labels,omitempty"`
Host EnrollHost `json:"host"`
SecretHash string `json:"secret_hash"`
}
EnrollRequest is the body of POST /v1/worker-enroll. SecretHash is the SHA-256 hex of the enroll secret (see NewEnrollSecret); the raw secret never leaves the worker except in the X-Gofer-Enroll-Secret header of later calls.
type EnrollTicket ¶ added in v0.169.0
type EnrollTicket struct {
EnrollID string `json:"enroll_id"`
PairingCode string `json:"pairing_code"`
DecideUntil int64 `json:"decide_until"`
}
EnrollTicket is the server's answer to a new request.
type Enrollment ¶ added in v0.169.0
type Enrollment struct {
ID string `json:"id"`
State string `json:"state"`
RequestedID string `json:"requested_id,omitempty"`
WorkerID string `json:"worker_id,omitempty"`
Labels []string `json:"labels"`
Projects []string `json:"projects"`
Host EnrollHost `json:"host"`
Source string `json:"source"`
CreatedAt int64 `json:"created_at"`
DecideUntil int64 `json:"decide_until"`
CollectUntil int64 `json:"collect_until,omitempty"`
DecidedAt int64 `json:"decided_at,omitempty"`
DecidedBy string `json:"decided_by,omitempty"`
Reason string `json:"reason,omitempty"`
CollectedAt int64 `json:"collected_at,omitempty"`
}
Enrollment is one row of GET /v1/worker-enrollments (never carries a secret or token).
type EnrollmentList ¶ added in v0.169.0
type EnrollmentList struct {
Enabled bool `json:"enabled"`
PendingCount int `json:"pending_count"`
Items []Enrollment `json:"items"`
}
EnrollmentList is the body of GET /v1/worker-enrollments.
type ErrStewardNotesConflict ¶
ErrStewardNotesConflict is returned by PutStewardNotes when the version moved; Current carries the latest notes.
func (*ErrStewardNotesConflict) Error ¶
func (e *ErrStewardNotesConflict) Error() string
type FollowUp ¶ added in v0.201.0
FollowUp is a queued request that will continue a live job's session after it ends.
type HealthCheck ¶ added in v0.215.0
type HealthCheck struct {
Name string `json:"name"`
OK bool `json:"ok"`
ConsecutiveFailures int `json:"consecutive_failures"`
Failing bool `json:"failing"`
LastError string `json:"last_error,omitempty"`
CheckedAt int64 `json:"checked_at"`
}
HealthCheck is one item of the server self-check (design 2026-11-14 §5), as GET /v1/health/checks reports it: whether the latest probe run succeeded, how many runs failed in a row, and whether that streak reached the threshold (Failing).
type IssueBrief ¶
type IssueBrief struct {
TrackerID string `json:"tracker_id"`
ProjectKey string `json:"project_key,omitempty"`
ID string `json:"id"`
Title string `json:"title"`
Type string `json:"type,omitempty"`
Status string `json:"status"`
Priority int `json:"priority"`
Assignee string `json:"assignee,omitempty"`
Tags []string `json:"tags,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
IssueBrief is one row of the read-only issue list (GET /v1/issues).
type IssueGetResp ¶
type IssueGetResp struct {
TrackerID string `json:"tracker_id"`
Issue map[string]any `json:"issue"`
}
IssueGetResp is one issue in full plus the repo it came from.
type IssueListOpts ¶
type IssueListOpts struct {
Project, TrackerID, Repo, Status, Type, Query string
Tags []string
Limit int
}
IssueListOpts filters IssueList.
type IssueListResp ¶
type IssueListResp struct {
Issues []IssueBrief `json:"issues"`
Total int `json:"total"`
Truncated bool `json:"truncated"`
}
IssueListResp is the issue list with the unfiltered-by-limit total.
type JobPreview ¶ added in v0.204.0
type JobPreview struct {
ID string `json:"id"`
JobID string `json:"job_id"`
Port int `json:"port"`
State string `json:"state"`
CreatedAt int64 `json:"created_at"`
ExpiresAt int64 `json:"expires_at"`
CloseReason string `json:"close_reason,omitempty"`
URL string `json:"url,omitempty"`
TargetPort int `json:"target_port,omitempty"`
WorkerID string `json:"worker_id,omitempty"`
}
type JobRedactRequest ¶
type JobSecretScanRequest ¶
type JobSecretScanRequest struct {
Literals []string `json:"literals,omitempty"`
Patterns []string `json:"patterns,omitempty"`
Project string `json:"project,omitempty"`
Since int64 `json:"since,omitempty"`
Redact bool `json:"redact,omitempty"`
Yes bool `json:"yes,omitempty"`
Vacuum bool `json:"vacuum,omitempty"`
}
type MCPServerInfo ¶ added in v0.144.0
type MCPServerInfo struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Spec config.MCPServerConfig `json:"spec"`
Secrets []struct {
Env string `json:"env"`
Set bool `json:"set"`
Usage string `json:"usage"`
} `json:"secrets"`
Bound struct {
Server bool `json:"server"`
Agents []string `json:"agents"`
Projects []string `json:"projects"`
} `json:"bound"`
}
MCPServerInfo is one MCP registry entry as GET /v1/mcp-servers reports it (MCP-06).
type Mail ¶ added in v0.173.0
type Mail struct {
ID int64 `json:"id"`
ThreadID string `json:"thread_id"`
ReplyTo int64 `json:"reply_to,omitempty"`
From MailParty `json:"from"`
ToAddress string `json:"to_address"`
To MailParty `json:"to"`
JobID string `json:"job_id,omitempty"`
Urgent bool `json:"urgent,omitempty"`
Body string `json:"body"`
State string `json:"state"`
Attempts int `json:"attempts,omitempty"`
LastError string `json:"last_error,omitempty"`
CreatedAt int64 `json:"created_at"`
DeliveredAt int64 `json:"delivered_at,omitempty"`
ReadAt int64 `json:"read_at,omitempty"`
AckKind string `json:"ack,omitempty"`
AckBy string `json:"ack_by,omitempty"`
AckAt int64 `json:"ack_at,omitempty"`
DeliverBy int64 `json:"deliver_by,omitempty"`
CaptureItemID string `json:"capture_item_id,omitempty"`
// BroadcastID / Broadcast mark a copy of a broadcast and carry the group's addressee table
// (设计 2026-10-22「D3」: `session mail read <id>` lists the recipients).
BroadcastID int64 `json:"broadcast_id,omitempty"`
Broadcast *MailBroadcast `json:"broadcast,omitempty"`
}
Mail is one letter as the server reports it.
type MailAgents ¶ added in v0.185.0
type MailAgents struct {
MaxResident int `json:"agents_max_resident"`
Agents []MailResidentAgent `json:"agents"`
Residents []MailResidentSession `json:"residents"`
}
MailAgents is the `agent:` listing: what may be addressed and what is running.
type MailBroadcast ¶ added in v0.184.0
type MailBroadcast struct {
ID int64 `json:"id"`
Count int `json:"count"`
Delivered int `json:"delivered"`
Answered int `json:"answered"`
Expired int `json:"expired"`
Pending int `json:"pending"`
Recipients []MailBroadcastRecipient `json:"recipients"`
}
MailBroadcast is one broadcast's addressee table: every copy with its own delivery state.
type MailBroadcastRecipient ¶ added in v0.184.0
type MailBroadcastRecipient struct {
Address string `json:"address"`
Kind string `json:"kind"`
ID string `json:"id,omitempty"`
MailID int64 `json:"mail_id,omitempty"`
State string `json:"state,omitempty"`
Skipped bool `json:"skipped,omitempty"`
Reason string `json:"reason,omitempty"`
// DeliveredAt / Replied come with the group table of `mail read` (0 / false = not yet).
DeliveredAt int64 `json:"delivered_at,omitempty"`
Replied bool `json:"replied,omitempty"`
}
MailBroadcastRecipient is one addressee of a broadcast (a skipped one says why).
type MailCandidate ¶ added in v0.173.0
type MailCandidate struct {
Kind string `json:"kind"`
ID string `json:"id"`
Topic string `json:"topic,omitempty"`
Source string `json:"source,omitempty"`
Offline bool `json:"offline,omitempty"`
Why []string `json:"why,omitempty"`
Display string `json:"display"`
}
MailCandidate is a session an ambiguous address almost named.
type MailClaim ¶ added in v0.173.0
MailClaim is the answer of a claim: the claimed letters and how many eligible ones remain.
type MailConversation ¶ added in v0.192.0
type MailConversation struct {
ID string `json:"id"`
Key string `json:"key"`
A MailParty `json:"a"`
B MailParty `json:"b"`
Last Mail `json:"last_mail"`
Count int `json:"count"`
Unread int `json:"unread"`
Urgent int `json:"urgent"`
ActivityAt int64 `json:"activity_at"`
}
MailConversation is one conversation: the pair of people who exchanged the letters, the newest letter and the counts. ID is the stable short handle (cv-…) a person copies to ask about it.
type MailListOpts ¶ added in v0.173.0
MailListOpts filters a listing (GET /v1/mail): Box is in | out | all ("" = all). Conv is a conversation's short id (cv-…): it reads that one conversation without naming its two ends.
type MailParty ¶ added in v0.173.0
type MailParty struct {
Kind string `json:"kind"`
ID string `json:"id,omitempty"`
Caller string `json:"caller,omitempty"`
Display string `json:"display,omitempty"`
}
MailParty is one end of a letter.
type MailRedactRequest ¶ added in v0.174.0
type MailRedactRequest struct {
Literals []string `json:"literals,omitempty"`
Patterns []string `json:"patterns,omitempty"`
}
MailRedactRequest is the literal / pattern input of a letter redaction, the same shape job redaction takes (the literal itself travels in the body, never in argv).
type MailResidentAgent ¶ added in v0.185.0
type MailResidentAgent struct {
Name string `json:"name"`
Agent string `json:"agent"`
Runner string `json:"runner,omitempty"`
IdleMinutes int `json:"idle_minutes"`
MaxLetters int `json:"max_letters"`
MaxHours int `json:"max_hours"`
Args []string `json:"args,omitempty"`
}
MailResidentAgent is one configured 收件 agent (config mail.agents.<名字>): the names an `agent:` address may use.
type MailResidentSession ¶ added in v0.185.0
type MailResidentSession struct {
Name string `json:"name"`
Project string `json:"project,omitempty"`
JobID string `json:"job_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Letters int `json:"letters"`
Pending int `json:"pending"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
IdleSince int64 `json:"idle_since,omitempty"`
LastError string `json:"last_error,omitempty"`
}
MailResidentSession is one resident session that exists right now.
type MailSent ¶ added in v0.173.0
type MailSent struct {
Mail Mail `json:"mail"`
Held bool `json:"held"`
CaptureItemID string `json:"capture_item_id,omitempty"`
Candidates []MailCandidate `json:"candidates,omitempty"`
// BroadcastID / ThreadID / Matched / Delivered / Skipped / Recipients describe a broadcast
// (设计 2026-10-22「D5」); all empty for a single letter.
BroadcastID int64 `json:"broadcast_id,omitempty"`
ThreadID string `json:"thread_id,omitempty"`
Matched int `json:"matched,omitempty"`
Delivered int `json:"delivered_count,omitempty"`
Skipped int `json:"skipped_count,omitempty"`
Recipients []MailBroadcastRecipient `json:"recipients,omitempty"`
}
MailSent is the answer of a send / reply / readdress: the stored letter, and whether it was held in the capture box (with the candidates an ambiguous address matched).
type MailTake ¶ added in v0.173.0
type MailTake struct {
Limit int `json:"limit,omitempty"`
MaxChars int `json:"max_chars,omitempty"`
UrgentOnly bool `json:"urgent_only,omitempty"`
}
MailTake bounds one take; zero values take the server defaults (5 letters / 8000 characters).
type MemoryCandidateListOpts ¶
MemoryCandidateListOpts filters GET /v1/memory-candidates (gofer-3nxa.2). Status "" = pending, "all" = every state.
type MemorySynthesisListOpts ¶ added in v0.205.0
MemorySynthesisListOpts filters ListMemorySyntheses.
type MemorySynthesisRunOpts ¶ added in v0.207.0
type MemorySynthesisRunOpts struct {
Project string `json:"project"`
Day string `json:"day,omitempty"`
Force bool `json:"force,omitempty"`
}
MemorySynthesisRunOpts is the body of POST /v1/memory-syntheses/run.
type MemorySynthesisRunResult ¶ added in v0.207.0
type MemorySynthesisRunResult struct {
Outcome string `json:"outcome"`
Run jobstore.MemorySynthesisRun `json:"run"`
}
MemorySynthesisRunResult is the answer of a run: the outcome (succeeded | failed | reused | running | empty) and the run record (zero for "empty").
type Meta ¶
type Meta struct {
Projects []ProjectMeta `json:"projects"`
Agents []MetaAgent `json:"agents"`
Runners []MetaRunner `json:"runners"`
}
Meta is the server's read-only form-options aggregate (GET /v1/meta): the one authed round trip a config-less client node needs to answer what the server has.
type MetaAgent ¶
type MetaAgent struct {
Key string `json:"key"`
Type string `json:"type"`
Batch bool `json:"batch"`
Interactive bool `json:"interactive,omitempty"`
}
MetaAgent is one agent from the server's /v1/meta aggregate: its key/type plus the AGT-02 capability bits (batch = submittable as a plain job, interactive = has an interactive argv). Unlike AgentMeta (/v1/agents) it carries no availability probe — /v1/meta answers what is DEFINED, which is what a client node's `agent list` shows.
type MetaRunner ¶
type MetaRunner struct {
Name string `json:"name"`
Type string `json:"type"`
WorkerID string `json:"worker_id,omitempty"`
}
MetaRunner is one runner row from /v1/meta (name + type, plus the worker id a worker runner is pinned to in the server config).
type PatchScheduleRequest ¶ added in v0.183.0
type PatchScheduleRequest struct {
Cron *string `json:"cron,omitempty"`
At *int64 `json:"at,omitempty"`
Title *string `json:"title,omitempty"`
Params *[]job.ScheduleParam `json:"params,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
TimeoutSec *int `json:"timeout_sec,omitempty"`
// Run health (design 2026-11-12 §1).
Overlap *string `json:"overlap,omitempty"`
MaxRuns *int `json:"max_runs,omitempty"`
MaxFailures *int `json:"max_failures,omitempty"`
// Precheck: a JSON object sets the pre-run check, the literal null clears it, nil
// leaves it alone.
Precheck json.RawMessage `json:"precheck,omitempty"`
Context *string `json:"context,omitempty"`
}
PatchScheduleRequest is PATCH /v1/schedules/{id} (design 2026-10-22 §D4). Every field is a pointer so an untouched one stays absent; the command / agent / runner / project are not here at all — the server refuses them (delete and recreate instead).
type PermissionSuggestionLabel ¶
type PermissionSuggestionLabel struct {
Label string `json:"label"`
}
PermissionSuggestionLabel is one "always allow" choice of a permission prompt (only its human label travels to the server).
type Plan ¶
type Plan struct {
PlanID string `json:"plan_id"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Status string `json:"status"`
Owner string `json:"owner,omitempty"`
Progress int `json:"progress,omitempty"`
// Project is the project this plan's todos are dispatched into (PLAN-02 P2).
Project string `json:"project,omitempty"`
SupervisorSessionID string `json:"supervisor_session_id,omitempty"`
// Paused holds the chain advance (PLAN-03); BlockedTodo is the item a failed chain
// job parked the plan on.
Paused bool `json:"paused,omitempty"`
BlockedTodo string `json:"blocked_todo,omitempty"`
// Leader is this plan's leader-round switch (LEAD-02): on|off, `off` by default.
Leader string `json:"leader,omitempty"`
// Notify is this plan's end-notification switch (gofer-3db4): on|off, `off` by
// default. With it on, every job the plan dispatches tells the plan's supervisor
// session that it ended.
Notify string `json:"notify,omitempty"`
// CompleteOn is when this plan's todos count as done: job (default) | merge (a
// worktree todo waits for its delivery to land).
CompleteOn string `json:"complete_on,omitempty"`
Tags []string `json:"tags,omitempty"`
// Warnings carries what a write could not refuse outright — today the "N running
// job(s) will wake the leader when they finish" note a leader-on PATCH returns.
Warnings []string `json:"warnings,omitempty"`
// LeaderRound is the plan's round state, present while `leader` is on.
LeaderRound *PlanLeaderRound `json:"leader_round,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Counts *jobstore.PlanCounts `json:"counts,omitempty"`
TodoCounts *jobstore.PlanTodoCounts `json:"todo_counts,omitempty"`
Completion *jobstore.PlanCompletion `json:"completion,omitempty"`
Usage *PlanUsage `json:"usage,omitempty"`
Jobs []job.JobResult `json:"jobs,omitempty"`
Todos []Todo `json:"todos,omitempty"`
Decisions []Decision `json:"decisions,omitempty"`
}
Plan is the client-side view of a plan header. GetPlan inlines its jobs, todos and decisions.
type PlanHandoff ¶
type PlanLeaderRound ¶
type PlanLeaderRound struct {
Round int `json:"round"`
MaxRounds int `json:"max_rounds"`
LastJobID string `json:"last_job_id,omitempty"`
Active bool `json:"active"`
}
PlanLeaderRound is a plan's leader-round state (LEAD-02): the rounds already spent, the configured cap and the most recent leader job. Active says the GLOBAL master switch is on — a plan can be switched on while no round will actually fire.
type PlanList ¶
type PlanList struct {
Plans []Plan `json:"plans"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
PlanList is one page of plans plus the paging facts around it: Total is how many plans match the filter (not how many came back), Limit/Offset are the page the server actually served (its default when the caller named none, its cap when the caller asked for more).
type PlanListOpts ¶
type PlanListOpts struct {
Status string
Project string
// Q matches a plan id by prefix or a title by substring, case-insensitively.
Q string
Tags []string
Limit int
Offset int
}
PlanListOpts are the filter/paging knobs GET /v1/plans accepts (F-d). The zero value asks for the server's default page: every plan, newest first, 20 rows.
type PlanSessionUsage ¶
type PlanSessionUsage struct {
Main runner.Usage `json:"main"`
Sub runner.Usage `json:"sub"`
Total runner.Usage `json:"total"`
ByModel map[string]runner.Usage `json:"by_model,omitempty"`
Sessions int `json:"sessions"`
}
PlanSessionUsage is the bound supervising session's usage booked on a plan.
type PlanUsage ¶
type PlanUsage struct {
Jobs int `json:"jobs"`
TotalTokens int64 `json:"total_tokens"`
CostUSD float64 `json:"cost_usd"`
ByAgent map[string]UsageAgent `json:"by_agent"`
// CacheReadTokens / CacheWriteTokens are the prompt-cache totals of the plan's jobs.
CacheReadTokens int64 `json:"cache_read_tokens,omitempty"`
CacheWriteTokens int64 `json:"cache_write_tokens,omitempty"`
// Session is the supervising session's usage attributed to the plan (nil = none).
Session *PlanSessionUsage `json:"session,omitempty"`
// Overall is jobs + session.
Overall struct {
TotalTokens int64 `json:"total_tokens"`
CostUSD float64 `json:"cost_usd"`
} `json:"overall"`
}
PlanUsage is the plan's token/cost roll-up (PLAN-02 P2): every attached job counts in Jobs; only the ones that reported numbers move the sums. ByAgent is keyed by agent and reuses UsageAgent — the same tally the dashboard's usage card shows.
type ProjectMeta ¶
type ProjectMeta struct {
Key string `json:"key"`
AllowedAgents []string `json:"allowed_agents,omitempty"`
AllowedRunners []string `json:"allowed_runners,omitempty"`
DefaultAgent string `json:"default_agent,omitempty"`
// AllowInteractive / AllowExec mirror the server's admission gates that are
// independent of the allowlists (web console parity); WorkerOnly marks a project
// that exists ONLY on an online worker (no host config), which is why it has no
// host_path and carries empty allowlists.
AllowInteractive bool `json:"allow_interactive"`
AllowExec bool `json:"allow_exec"`
WorkerOnly bool `json:"worker_only,omitempty"`
// Injected marks the server's built-in `default` project (not declared in config).
Injected bool `json:"injected,omitempty"`
// HostPath / ContainerPath are the project's two path views (additive meta
// fields); a client node matches its cwd against both.
HostPath string `json:"host_path,omitempty"`
ContainerPath string `json:"container_path,omitempty"`
}
ProjectMeta is one project as the server exposes it via /v1/meta (key + allowlists + default agent). It carries no host_path (that is a server-side filesystem path; the meta endpoint omits it). Used by `project list --remote` (E38②) and shared with the mcp client mode / worker init (E28/E37), plus the client-mode `project show/validate` (C2).
type Ref ¶ added in v0.204.0
type Ref struct {
SourceKind string `json:"source_kind"`
SourceID string `json:"source_id"`
Kind string `json:"kind"`
ID string `json:"id"`
Field string `json:"field"`
CreatedAt int64 `json:"created_at"`
SourceTitle string `json:"source_title,omitempty"`
}
Ref is one source object that references a requested destination.
type RetriesResp ¶
RetriesResp is the `{job_id, retries: [...]}` envelope of the list endpoint.
type Retry ¶
type Retry struct {
ID string `json:"id"`
SourceJobID string `json:"source_job_id"`
Attempt int `json:"attempt"`
MaxAttempts int `json:"max_attempts,omitempty"`
Reason string `json:"reason"`
NextRunAt int64 `json:"next_run_at"`
LeaseUntil int64 `json:"lease_until,omitempty"`
State string `json:"state"`
NewJobID string `json:"new_job_id,omitempty"`
CreatedAt int64 `json:"created_at"`
}
Retry is the client-side view of one AUTO-03 durable retry row (design §二.3): the scheduled re-run of a FAILED job, which a hub-side sweeper submits when NextRunAt arrives (so it survives a server restart). Timestamps are unix SECONDS.
State is one of pending|claimed|done|cancelled: claimed means a sweeper holds the row right now (LeaseUntil is its lease), done means it was submitted as NewJobID. MaxAttempts is the attempt ceiling the row itself was scheduled under — 0 when the row carries no policy, and then the attempt has no `/M`.
type RuleView ¶
type RuleView struct {
rule.Rule
// Content is the stored file verbatim (frontmatter included).
Content string `json:"content,omitempty"`
}
RuleView is one rule as GET /v1/rules/{name} returns it: the index metadata plus the rule text, so `show` needs one request rather than two.
type RunnerAgentMeta ¶
type RunnerAgentMeta struct {
Key string `json:"key"`
Type string `json:"type,omitempty"`
Interactive bool `json:"interactive,omitempty"`
Available *bool `json:"available,omitempty"`
Version string `json:"version,omitempty"`
}
RunnerAgentMeta is the typed agent capability advertised by a runner in GET /v1/runners. Available is a pointer because older workers may omit the probe field entirely; nil means unknown rather than unavailable.
type RunnerCapabilities ¶
type RunnerCapabilities struct {
Projects []string `json:"projects,omitempty"`
AgentCaps []RunnerAgentMeta `json:"agent_caps,omitempty"`
Tools []RunnerTool `json:"tools,omitempty"`
}
RunnerCapabilities is the project and agent set a runner reports, plus the external tools declared for its machine.
type RunnerMeta ¶
type RunnerMeta struct {
Name string `json:"name"`
Type string `json:"type"`
Status string `json:"status"`
Capabilities *RunnerCapabilities `json:"capabilities,omitempty"`
// Worker is the connection detail of a worker row (nil on other rows).
Worker *RunnerWorkerBrief `json:"worker,omitempty"`
}
RunnerMeta is one row returned by GET /v1/runners.
type RunnerServer ¶
type RunnerServer struct {
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
Version string `json:"version,omitempty"`
// UTCOffsetSec is the server's UTC offset; nil from servers before 0.128.3.
UTCOffsetSec *int `json:"utc_offset_sec,omitempty"`
}
RunnerServer is the server's own platform and version from GET /v1/runners.
type RunnerTool ¶ added in v0.140.0
type RunnerTool struct {
Name string `json:"name"`
Desc string `json:"desc,omitempty"`
Bin string `json:"bin,omitempty"`
}
RunnerTool is one external tool declared for a runner's machine.
type RunnerWorkerBrief ¶
type RunnerWorkerBrief struct {
GoferVersion string `json:"gofer_version,omitempty"`
}
RunnerWorkerBrief is the part of a worker row's detail the CLI reads.
type RunnerWorkerDetail ¶
type RunnerWorkerDetail struct {
LastHeartbeat int64 `json:"last_heartbeat"`
InFlight int `json:"in_flight"`
Labels []string `json:"labels,omitempty"`
Projects []string `json:"projects,omitempty"`
Agents []string `json:"agents,omitempty"`
// Tools are the worker's declared external tools (nil = none declared).
Tools []RunnerTool `json:"tools,omitempty"`
ProtocolVersion int `json:"protocol_version,omitempty"`
GoferVersion string `json:"gofer_version,omitempty"`
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
Draining bool `json:"draining,omitempty"`
MessengerStatus string `json:"messenger_status,omitempty"`
// MessengerDetail / Dirs come from the worker heartbeat (protocol v16); nil = the
// worker never reported them.
MessengerDetail *struct {
Status string `json:"status"`
} `json:"messenger_detail,omitempty"`
Dirs *struct {
Workspace *struct {
Path string `json:"path"`
Exists bool `json:"exists"`
} `json:"workspace,omitempty"`
} `json:"dirs,omitempty"`
PolicyPending bool `json:"policy_pending,omitempty"`
PolicyRev int64 `json:"policy_rev,omitempty"`
AppliedRev int64 `json:"applied_rev,omitempty"`
PolicyRejected []struct {
Key string `json:"key"`
Reason string `json:"reason"`
} `json:"policy_rejected,omitempty"`
PolicyDegraded []struct {
Key string `json:"key"`
Gate string `json:"gate"`
} `json:"policy_degraded,omitempty"`
}
type RunnersOverview ¶
type RunnersOverview struct {
Runners []RunnerMeta `json:"runners"`
Server RunnerServer `json:"server"`
}
RunnersOverview is the whole GET /v1/runners response.
type SSEEvent ¶
type SSEEvent struct {
// Event is the SSE `event:` field (e.g. "status", "log", "end").
Event string
// Data is the (newline-joined) `data:` payload, typically a JSON object.
Data []byte
}
SSEEvent is one parsed Server-Sent Events frame: the event name and its (joined) data lines. It is the canonical Go-side SSE frame shape shared by the CLI (StreamJob) and the peer-http runner's stream mirroring (P2-a). The server emits these via streaming.writeSSE; events are status / log / log-rotated / interaction / end (see internal/streaming/streaming.go).
func ParseSSE ¶
ParseSSE consumes complete frames from buffer (split on the blank-line frame separator "\n\n") and returns the parsed frames plus the trailing incomplete remainder, which the caller carries into the next read. It mirrors the frontend parser (web/src/api/sse.ts): \r\n is normalised, `event:` / `data:` lines are recognised and a single leading space after `data:` is stripped; multiple data lines are joined with "\n". Frames without an `event:` line are skipped (e.g. the opening ": open" comment).
type Schedule ¶
type Schedule struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Cron string `json:"cron"`
Enabled int `json:"enabled"`
CatchUp int `json:"catch_up"`
NextRunAt int64 `json:"next_run_at"`
LastRunAt int64 `json:"last_run_at"`
LastJobID string `json:"last_job_id"`
ProjectKey string `json:"project_key"`
Request job.JobRequest `json:"request"`
// TriggerToken is the schedule's webhook secret (AUTO-02b); empty = the external
// trigger endpoint is not enabled for it.
TriggerToken string `json:"trigger_token,omitempty"`
// Params is the schedule's parameter declaration list (design 2026-10-22 §D1).
Params []job.ScheduleParam `json:"params,omitempty"`
// Run health (design 2026-11-12 §1): MaxRuns / RunCount / ConsecutiveFailures count
// timer-started runs only; PausedReason is "failures" or "max_runs" for a schedule
// gofer stopped itself.
Overlap string `json:"overlap,omitempty"`
MaxRuns int `json:"max_runs,omitempty"`
RunCount int `json:"run_count,omitempty"`
MaxFailures int `json:"max_failures,omitempty"`
ConsecutiveFailures int `json:"consecutive_failures,omitempty"`
PausedReason string `json:"paused_reason,omitempty"`
// Precheck is the command the server runs before each due tick (design 2026-11-12 §2).
Precheck *job.SchedulePrecheck `json:"precheck,omitempty"`
// Context is "on" or "off": whether each run gets its run number and the previous
// run's outcome.
Context string `json:"context,omitempty"`
// Target is "" (submit the request as a job) or "seat:<seat id>"; LastResult is how the
// last delivery to a seat ended.
Target string `json:"target,omitempty"`
LastResult string `json:"last_result,omitempty"`
}
Schedule is the client-side view of /v1/schedules. It mirrors the HTTP wire shape without importing internal/httpapi from the client package.
type ScheduleEvent ¶ added in v0.178.0
type ScheduleEvent struct {
Seq int64 `json:"seq"`
JobID string `json:"job_id"`
Type string `json:"type"`
Detail string `json:"detail,omitempty"`
At int64 `json:"at"`
}
ScheduleEvent is one row of a schedule's own event stream (GET /v1/schedules/{id}/events): schedule.run_failed with the refusal in Detail, newest first. Field tags match jobstore.JobEvent so one struct decodes the envelope.
type ScopedMemory ¶
type ScopedMemory struct {
Scope string `json:"scope"`
ScopeKey string `json:"scope_key,omitempty"`
Key string `json:"key"`
Content string `json:"content"`
Tags []string `json:"tags,omitempty"`
UpdatedAt string `json:"updated_at"`
UpdatedBy string `json:"updated_by,omitempty"`
Deleted bool `json:"deleted,omitempty"`
tracker.MemoryMeta
}
func (ScopedMemory) TrackerMemory ¶
func (m ScopedMemory) TrackerMemory() tracker.Memory
TrackerMemory is the scoped memory in the local memory shape (prime / ls).
type ScopedMemoryListOpts ¶
type Seat ¶ added in v0.217.0
type Seat struct {
ID string `json:"id"`
CallerID string `json:"caller_id,omitempty"`
ProjectKey string `json:"project_key"`
Name string `json:"name"`
RelCwd string `json:"rel_cwd,omitempty"`
Purpose string `json:"purpose,omitempty"`
Charter string `json:"charter,omitempty"`
CharterBy string `json:"charter_by"`
Kind string `json:"kind"`
Agent string `json:"agent,omitempty"`
CurrentRef string `json:"current_ref,omitempty"`
ArchivedAt int64 `json:"archived_at,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
State string `json:"state"`
Waiting string `json:"waiting,omitempty"`
Unread bool `json:"unread,omitempty"`
ActivityAt int64 `json:"activity_at,omitempty"`
ThreadID string `json:"thread_id,omitempty"`
// CharterSent / CharterError are on the bind answer only: the seat's charter was said into a
// live ACP job right away (CharterSent), or that message did not go out (CharterError, the
// bind itself still succeeded).
CharterSent bool `json:"charter_sent,omitempty"`
CharterError string `json:"charter_error,omitempty"`
}
Seat is one entry of the seat roster (GET /v1/seats): a long-lived working position, the session currently sitting in it and what is derived from that session.
type SeatCreate ¶ added in v0.217.0
type SeatCreate struct {
ProjectKey string `json:"project_key"`
Name string `json:"name"`
RelCwd string `json:"rel_cwd,omitempty"`
Purpose string `json:"purpose,omitempty"`
Charter string `json:"charter,omitempty"`
Kind string `json:"kind,omitempty"`
Agent string `json:"agent,omitempty"`
}
SeatCreate is the POST /v1/seats body.
type SeatListOpts ¶ added in v0.217.0
SeatListOpts filters ListSeats. All asks for everyone's seats (needs seat.manage.others; without it the list stays the caller's own).
type SeatOpenPlan ¶ added in v0.217.0
type SeatOpenPlan struct {
SeatID string `json:"seat_id"`
Kind string `json:"kind"`
Runner string `json:"runner,omitempty"`
Cwd string `json:"cwd,omitempty"`
Resumable bool `json:"resumable"`
Alive bool `json:"alive,omitempty"`
Reason string `json:"reason,omitempty"`
Sh string `json:"sh,omitempty"`
PowerShell string `json:"powershell,omitempty"`
NewSh string `json:"new_sh,omitempty"`
NewPowerShell string `json:"new_powershell,omitempty"`
ThreadID string `json:"thread_id,omitempty"`
NeedsRestart bool `json:"needs_restart,omitempty"`
Restarted bool `json:"restarted,omitempty"`
JobID string `json:"job_id,omitempty"`
}
SeatOpenPlan is how to get back into a seat (GET /v1/seats/{id}/open-plan).
type SeatPatch ¶ added in v0.217.0
type SeatPatch struct {
Name *string `json:"name,omitempty"`
RelCwd *string `json:"rel_cwd,omitempty"`
Purpose *string `json:"purpose,omitempty"`
Charter *string `json:"charter,omitempty"`
Agent *string `json:"agent,omitempty"`
Archived *bool `json:"archived,omitempty"`
}
SeatPatch is the PATCH /v1/seats/{id} body: nil leaves a field unchanged. Archived true archives the seat.
type SessionCandidate ¶
SessionCandidate is one agent-session id found in the environment.
func CurrentAgentSessionCandidates ¶
func CurrentAgentSessionCandidates(getenv func(string) string) []SessionCandidate
CurrentAgentSessionCandidates returns the distinct non-empty session ids of AgentSessionEnvKeys in priority order.
type SessionDeliverResult ¶
type SessionDeliverResult struct {
Path string `json:"path"`
JobID string `json:"job_id,omitempty"`
DecisionID string `json:"decision_id,omitempty"`
Delivering bool `json:"delivering,omitempty"`
}
SessionDeliverResult is POST /v1/sessions/{sid}/deliver's answer: where the reply went. Path "turn" means it answered the session's OPEN turn (decision_id is that turn); "tmux" means it was typed into the session's terminal by an internal job; "takeover" means a NEW interactive pty job continues the session (`--resume`) and received the text as its first input (job_id is that job, decision_id its audit row). See sessionrelay.PathTurn / PathTmux / PathTakeover.
Delivering means the internal job had already started but had not finished when gofer's wait window elapsed (gofer-qzv5): the text is on its way to the terminal or to the agent's own channel, and the session's outbox records how it ended — read it instead of treating this as a failure or sending again.
type SessionDetail ¶
type SessionDetail struct {
Session AgentSession `json:"session"`
Turns []Decision `json:"turns"`
HasMore bool `json:"has_more"`
NextBefore string `json:"next_before,omitempty"`
}
SessionDetail is GET /v1/sessions/{sid}: the session + recent turns (newest first).
type SessionFindOpts ¶ added in v0.166.0
SessionFindOpts is one find query (GET /v1/sessions?q=&path=): Q is whitespace-split terms, Path must hit a scope; at least one is required.
type SessionFocus ¶ added in v0.186.0
type SessionFocus struct {
SessionID string `json:"session_id"`
Agent string `json:"agent,omitempty"`
Title string `json:"title,omitempty"`
Topic string `json:"topic,omitempty"`
ProjectKey string `json:"project_key,omitempty"`
Cwd string `json:"cwd,omitempty"`
Caller string `json:"caller,omitempty"`
StartedAt int64 `json:"started_at,omitempty"`
Plans []SessionFocusPlan `json:"plans,omitempty"`
Jobs []SessionJobWatch `json:"jobs,omitempty"`
Mail []SessionFocusMail `json:"mail,omitempty"`
}
SessionFocus is GET /v1/sessions/{sid}/focus: what the session was doing before its context was compacted (or before the session resumed).
type SessionFocusMail ¶ added in v0.186.0
type SessionFocusMail struct {
ID int64 `json:"id"`
From string `json:"from,omitempty"`
Subject string `json:"subject,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"`
}
SessionFocusMail is one letter the session has been given but not answered.
type SessionFocusPlan ¶ added in v0.186.0
type SessionFocusPlan struct {
PlanID string `json:"plan_id"`
Title string `json:"title,omitempty"`
Status string `json:"status"`
Progress int `json:"progress"`
Total int `json:"total"`
Next string `json:"next,omitempty"`
Blocked string `json:"blocked,omitempty"`
}
SessionFocusPlan is one open plan the session supervises.
type SessionFound ¶ added in v0.166.0
type SessionFound struct {
AgentSession
Hits []SessionHit `json:"hits"`
MaybeOffline bool `json:"maybe_offline,omitempty"`
}
SessionFound is one find result: the session plus the hit reasons.
type SessionHeartbeat ¶
type SessionHeartbeat struct {
Event string `json:"event"`
State string `json:"state,omitempty"`
LastMessage string `json:"last_message,omitempty"`
Title string `json:"title,omitempty"`
// Injected: this UserPromptSubmit is the relay's own continuation (no auto-off).
Injected bool `json:"injected,omitempty"`
// IdleSec is the OS input idle time in seconds (-1 = unknown). Set it only on
// events that actually probed: nil means "this beat carries no reading" and
// leaves the server's stored value alone.
IdleSec *int64 `json:"idle_sec,omitempty"`
PeerName string `json:"peer_name,omitempty"`
PeerNameSource string `json:"peer_name_source,omitempty"`
PeerStatus string `json:"peer_status,omitempty"`
PeerMessaging *bool `json:"peer_messaging,omitempty"`
// PeerSocket is the same three-state field: nil = this beat carries no address
// news, a pointer to "" clears the stored address.
PeerSocket *string `json:"peer_socket,omitempty"`
ProgressText string `json:"progress_text,omitempty"`
ProgressAt int64 `json:"progress_at,omitempty"`
ClearProgress bool `json:"clear_progress,omitempty"`
// Cwd is the hook's current directory (the server records it as last_cwd, for display).
Cwd string `json:"cwd,omitempty"`
// StopParkSec (gofer-fv6a) announces that this Stop hook is PARKING for that many
// seconds, waiting on the session's watched jobs: while it holds, a job-end notice
// is left to the hook rather than handed to the messenger (a peer message cannot
// reach an agent blocked in its own Stop hook). 0 clears an announced park.
StopParkSec *int `json:"stop_park_sec,omitempty"`
// SubagentID / SubagentDelta report a SubagentStart (+1) / SubagentStop (-1).
SubagentID string `json:"subagent_id,omitempty"`
SubagentDelta int `json:"subagent_delta,omitempty"`
// UsageDelta is the token usage the hook read from the transcript since its last
// report (N2 §A); the server adds it to the session's total. Nil = none.
UsageDelta *runner.SessionUsage `json:"usage_delta,omitempty"`
}
SessionHeartbeat is the POST /v1/sessions/{sid}/heartbeat body.
type SessionHit ¶ added in v0.166.0
type SessionHit struct {
Kind string `json:"kind"`
Match string `json:"match,omitempty"`
Source string `json:"source,omitempty"`
}
SessionHit says why a session matched a find query (kind: scope | scope_weak | topic | peer_name | project; Source is the topic source for scope / topic hits).
type SessionJobWatch ¶
type SessionJobWatch struct {
JobID string `json:"job_id"`
Title string `json:"title,omitempty"`
Status string `json:"status"`
ExitCode int `json:"exit_code"`
StartedAt int64 `json:"started_at,omitempty"`
EndedAt int64 `json:"ended_at,omitempty"`
Duration int64 `json:"duration_sec,omitempty"`
// Error is the job's error line (why a held job was cancelled, gofer-9b1b).
Error string `json:"error,omitempty"`
}
SessionJobWatch is a job summary held for Stop-hook completion injection.
type SessionListOpts ¶
type SessionListOpts struct {
Project, State, Agent, Cwd string
IncludeEnded bool
// IncludeInternal also lists the sessions gofer's own jobs left behind (the work
// summarizer's); they are hidden by default.
IncludeInternal bool
Limit int
}
SessionListOpts filters ListSessions.
type SessionMessage ¶
type SessionMessage struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Text string `json:"text"`
Operator string `json:"operator,omitempty"`
Status string `json:"status"`
Channel string `json:"channel,omitempty"`
JobID string `json:"job_id,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
// Direction "reply" marks the session's own answer (gofer-6er0); Source / Peer /
// ReplyTo describe it.
Direction string `json:"direction,omitempty"`
Source string `json:"source,omitempty"`
Peer string `json:"peer,omitempty"`
ReplyTo string `json:"reply_to,omitempty"`
}
type SessionNudge ¶
type SessionNudge struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Kind string `json:"kind"` // every | stalled
IntervalSec int64 `json:"interval_sec"`
Text string `json:"text"`
UntilAt int64 `json:"until_at,omitempty"`
State string `json:"state"` // active | paused | ended
PauseReason string `json:"pause_reason,omitempty"`
EndedReason string `json:"ended_reason,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt int64 `json:"created_at"`
NextRunAt int64 `json:"next_run_at,omitempty"`
LastFiredAt int64 `json:"last_fired_at,omitempty"`
FireCount int64 `json:"fire_count"`
FailCount int64 `json:"fail_count"`
LastError string `json:"last_error,omitempty"`
}
SessionNudge mirrors httpapi's sessionNudgeView (N2 §E): a timed reminder on a terminal session. Times are unix seconds.
type SessionPermission ¶
type SessionPermission struct {
ToolName string `json:"tool_name"`
Summary string `json:"summary"`
Input string `json:"input,omitempty"`
Suggestions []PermissionSuggestionLabel `json:"suggestions,omitempty"`
Fingerprint string `json:"fp,omitempty"`
TimeoutSec int64 `json:"timeout_sec,omitempty"`
// Questions relays a Claude Code AskUserQuestion (gofer-02fu): the card is answered
// with "answers:<JSON>" instead of allow / deny.
Questions []SessionQuestion `json:"questions,omitempty"`
}
SessionPermission is a terminal permission prompt the hook opens on the web (POST /v1/sessions/{sid}/permissions).
type SessionQuestion ¶ added in v0.145.0
type SessionQuestion struct {
Question string `json:"question"`
Header string `json:"header,omitempty"`
Options []SessionQuestionOption `json:"options,omitempty"`
MultiSelect bool `json:"multiSelect,omitempty"`
}
SessionQuestion is one AskUserQuestion question, in Claude Code's own shape.
type SessionQuestionOption ¶ added in v0.145.0
type SessionQuestionOption struct {
Label string `json:"label"`
Description string `json:"description,omitempty"`
}
SessionQuestionOption is one offered answer.
type SessionRegister ¶
type SessionRegister struct {
SessionID string `json:"session_id"`
Agent string `json:"agent"`
ProjectKey string `json:"project_key,omitempty"`
Runner string `json:"runner,omitempty"`
Cwd string `json:"cwd,omitempty"`
Title string `json:"title,omitempty"`
Transcript string `json:"transcript,omitempty"`
TmuxPane string `json:"tmux_pane,omitempty"`
Event string `json:"event,omitempty"`
// Source is the SessionStart source the agent reported (startup|resume|clear|compact);
// the server keys the seat notice's wording on it. Empty when the agent reports none.
Source string `json:"source,omitempty"`
PeerName string `json:"peer_name,omitempty"`
PeerNameSource string `json:"peer_name_source,omitempty"`
PeerStatus string `json:"peer_status,omitempty"`
PeerMessaging bool `json:"peer_messaging,omitempty"`
// PeerSocket is the session's own Claude Code messaging endpoint; the server
// validates it and drops an unacceptable value (no address = the name path).
PeerSocket string `json:"peer_socket,omitempty"`
}
SessionRegister is the POST /v1/sessions body.
type SessionResumePlan ¶
type SessionResumePlan struct {
Can bool `json:"can"`
Reason string `json:"reason,omitempty"`
Message string `json:"message"`
Warning string `json:"warning,omitempty"`
State string `json:"state"`
Ended bool `json:"ended"`
Runner string `json:"runner,omitempty"`
Agent string `json:"agent,omitempty"`
ProjectKey string `json:"project_key,omitempty"`
Cwd string `json:"cwd,omitempty"`
Command []string `json:"command,omitempty"`
// CwdAbs / CwdSource / CwdReason: the directory a wake-up starts in (absolute on
// the runner), where that choice came from (transcript | registered |
// project_root) and why, in plain Chinese.
CwdAbs string `json:"cwd_abs,omitempty"`
CwdSource string `json:"cwd_source,omitempty"`
CwdReason string `json:"cwd_reason,omitempty"`
}
SessionResumePlan is GET /v1/sessions/{sid}/takeover-plan's answer: whether a new process could continue the session (Can) and why not, in plain Chinese.
type SessionScreen ¶ added in v0.201.0
type SessionScreen struct {
SessionID string `json:"session_id"`
Agent string `json:"agent,omitempty"`
State string `json:"state,omitempty"`
// Source is "pty" (a takeover pty job's transcript), "turns" (the session's
// recent relay turns) or "message" (no turns: its last message stands in).
Source string `json:"source"`
JobID string `json:"job_id,omitempty"`
Text string `json:"text"`
}
SessionScreen is the read-only screen of one session (GET /v1/sessions/{sid}/screen): its recent relay turns, or the pty transcript tail of the job that took it over, as plain text with no escape sequences.
type SessionSeat ¶ added in v0.217.0
type SessionSeat struct {
ID string `json:"id"`
Name string `json:"name"`
Purpose string `json:"purpose,omitempty"`
Charter string `json:"charter,omitempty"`
CharterPath string `json:"charter_path,omitempty"`
Root string `json:"root,omitempty"`
Continuation string `json:"continuation,omitempty"`
}
SessionSeat is the seat of a session as the session view carries it. CharterPath is the repository-relative file holding the charter (the seat wrote "@<path>"); Root is the project root in the spelling of the session's cwd.
type SessionTopicPatch ¶ added in v0.166.0
type SessionTopicPatch struct {
Topic *string `json:"topic,omitempty"`
Scope *[]string `json:"scope,omitempty"`
}
SessionTopicPatch is the PATCH /v1/sessions/{sid} body: nil leaves a field unchanged, an empty non-nil Scope clears it.
type SessionWaitResult ¶ added in v0.201.0
type SessionWaitResult struct {
Session AgentSession `json:"session"`
// State is the session's state at the moment of the answer.
State string `json:"state"`
// Until is the set of states the wait asked for.
Until []string `json:"until"`
// Reached is true when State is one of Until.
Reached bool `json:"reached"`
// WaitedSec is how long the server held the request.
WaitedSec int `json:"waited_sec"`
}
SessionWaitResult is one answer of GET /v1/sessions/{sid}/wait: the session as it stands plus whether its state is one of the wanted ones. Reached=false means the request's own budget ran out first.
type SessionWatches ¶ added in v0.171.0
type SessionWatches struct {
Watches []SessionJobWatch `json:"watches"`
SubagentCount int `json:"subagent_count"`
}
SessionWatches is GET /v1/sessions/{sid}/watches: the session's pending job watches plus the sub-agents running in it right now (0 = none).
type SettingChange ¶ added in v0.179.0
type SettingChange struct {
Key string `json:"key"`
// Action is "set", "reset" or "unchanged".
Action string `json:"action"`
Old any `json:"old"`
New any `json:"new"`
Error string `json:"error,omitempty"`
}
SettingChange is one key of an import: what the document asks for, what the store says, and the reason when the value was refused.
type SettingImport ¶ added in v0.179.0
type SettingImport struct {
DryRun bool `json:"dry_run"`
Applied bool `json:"applied"`
Changes []SettingChange `json:"changes"`
Errors int `json:"errors"`
}
SettingImport is the answer of POST /v1/settings/import: the per-key changes, whether they were written, and how many keys were refused.
type SettingItem ¶ added in v0.179.0
type SettingItem struct {
Key string `json:"key"`
Group string `json:"group,omitempty"`
Kind string `json:"kind,omitempty"`
Description string `json:"description,omitempty"`
Default any `json:"default"`
Value any `json:"value"`
Modified bool `json:"modified"`
Multiline bool `json:"multiline,omitempty"`
Min *int `json:"min,omitempty"`
Max *int `json:"max,omitempty"`
MaxLen int `json:"max_len,omitempty"`
UpdatedBy string `json:"updated_by,omitempty"`
UpdatedAt int64 `json:"updated_at,omitempty"`
}
SettingItem is one registered setting: its type and description, the registered default, the effective value (stored, else default) and whether it was modified. Value stays untyped because the key's registered kind decides what it holds (string / number / bool / []string).
type SettingReset ¶ added in v0.179.0
type SettingReset struct {
Key string `json:"key"`
Modified bool `json:"modified"`
Value any `json:"value"`
Reset bool `json:"reset"`
}
SettingReset is the answer of DELETE /v1/settings/{key}: the value now in effect and whether a stored value was actually dropped.
type SkillImportResult ¶
type SkillImportResult struct {
Skill skill.Skill `json:"skill"`
Replaced bool `json:"replaced,omitempty"`
}
SkillImportResult is the answer to POST /v1/skills/import: the imported skill and whether it replaced a library entry of the same name (import is re-runnable, so "replaced" is information, not an error).
type SkillUpdateResult ¶
type SkillUpdateResult struct {
Skill skill.Skill `json:"skill"`
Change skill.Change `json:"change"`
}
SkillUpdateResult is the answer to POST /v1/skills/{name}/update: the re-fetched metadata and the file-level diff the update produced.
type SkillView ¶
type SkillView struct {
skill.Skill
// Content is the skill's SKILL.md verbatim (frontmatter included). Skipped by
// the listing endpoint, which is why it is a separate type from Skill.
Content string `json:"content,omitempty"`
}
SkillView is one skill as GET /v1/skills/{name} returns it: the index metadata plus the SKILL.md text, so `show` needs one request rather than two.
type StatsBackfillRequest ¶
type StatsBackfillRequest struct {
Since int64 `json:"since,omitempty"`
AfterEnded int64 `json:"after_ended,omitempty"`
AfterID string `json:"after_id,omitempty"`
Limit int `json:"limit,omitempty"`
Force bool `json:"force,omitempty"`
}
StatsBackfillRequest is one POST /v1/stats/backfill batch.
type StatsBackfillResult ¶
type StatsBackfillResult struct {
Scanned int `json:"scanned"`
Written int `json:"written"`
Failed int `json:"failed"`
WithSignal int `json:"with_signal"`
WithGit int `json:"with_git"`
AfterEnded int64 `json:"after_ended"`
AfterID string `json:"after_id"`
Done bool `json:"done"`
}
StatsBackfillResult is one batch's outcome; Done=false means call again with the returned cursor (AfterEnded / AfterID).
type StatsUsage ¶
type StatsUsage struct {
Windows map[string]UsageWindow `json:"windows"`
Partial bool `json:"partial"`
}
StatsUsage is the usage block of GET /v1/stats (SUP-01 E): what each agent burned per window, keyed by the window's label ("24h", "7d"). A window missing from Windows was not computed (see Partial) — a caller must not read it as zero usage.
type StatusError ¶
type StatusError struct {
Status int
Msg string
// Code is the server's stable error code when the body carried one ("" otherwise).
Code string
// Params are the values of the placeholders of the err.<Code> text.
Params map[string]any
}
StatusError is the error doJSON returns for a non-2xx response. Its message is the same friendly text as before; Status lets callers branch on 404/409 without parsing strings (session relay hook: unknown session → re-register).
func (*StatusError) Error ¶
func (e *StatusError) Error() string
type StewardNotesResp ¶
type StewardNotesResp struct {
Notes steward.Notes `json:"notes"`
Info steward.NotesInfo `json:"info"`
}
StewardNotesResp is GET|PUT /v1/steward/notes.
type StewardSettings ¶
type StewardSettings struct {
Enabled bool `json:"enabled"`
Agent string `json:"agent"`
Project string `json:"project"`
ReviewTime string `json:"review_time"`
IdleEndMin int `json:"idle_end_min"`
ReviewMaxItems int `json:"review_max_items"`
EventWake bool `json:"event_wake"`
EventThrottleMin int `json:"event_throttle_min"`
ReviewTimeExplicit bool `json:"review_time_explicit"`
}
StewardSettings is the effective steward: block (GET /v1/steward → settings).
type StewardState ¶
type StewardState struct {
Status steward.Status `json:"status"`
Settings StewardSettings `json:"settings"`
// Warnings are server-side advisories (OBS-13: digest on but no work.digest webhook).
Warnings []string `json:"warnings,omitempty"`
}
StewardState is GET /v1/steward.
type SubmitResult ¶
type SubmitResult struct {
Job job.JobResult
Async bool
// ApproveURL is the console page a held job (status awaiting_approval, gofer-9b1b)
// is approved on, as the server reported it; empty when the server has no
// web_base_url (use ApprovalURL to fall back to the address this client talks to).
ApproveURL string
}
SubmitResult wraps the create-job response. Async is true when the server could not finish a synchronous submit within its wait cap and returned 202 + X-Gofer-Async (the job keeps running); the caller should poll. For a plain async submit (no sync requested) the server returns 200 and Async is false.
type SupervisorAutoBind ¶
type SupervisorAutoBind struct {
Session AgentSession
EnvKey string
Reason string
}
SupervisorAutoBind reports what plan auto-binding did. Session.SessionID is set only when the plan was created bound to it; otherwise Reason says why nothing was bound (empty Reason + no candidate = no agent session in env).
func (SupervisorAutoBind) Bound ¶
func (b SupervisorAutoBind) Bound() bool
Bound reports whether the plan was bound to the current agent session.
type TakenMail ¶ added in v0.173.0
type TakenMail struct {
ID int64 `json:"id"`
ThreadID string `json:"thread_id"`
From MailParty `json:"from"`
Topic string `json:"topic,omitempty"`
Urgent bool `json:"urgent,omitempty"`
Body string `json:"body"`
Truncated bool `json:"truncated,omitempty"`
CreatedAt int64 `json:"created_at"`
// BroadcastID / Recipients mark a copy of a broadcast (设计 2026-10-22「D2」).
BroadcastID int64 `json:"broadcast_id,omitempty"`
Recipients int `json:"recipients,omitempty"`
}
TakenMail is one letter a hook took, with what it renders into <gofer-mail>.
type Todo ¶
type Todo struct {
TodoID string `json:"todo_id"`
PlanID string `json:"plan_id"`
JobID string `json:"job_id,omitempty"`
Title string `json:"title"`
Done bool `json:"done"`
Status string `json:"status,omitempty"`
StartedAt int64 `json:"started_at,omitempty"`
DoneAt int64 `json:"done_at,omitempty"`
Note string `json:"note,omitempty"`
Sort int `json:"sort,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
// PLAN-02 P2 dispatch fields (assignee … dispatch_error).
Assignee string `json:"assignee,omitempty"`
Project string `json:"project,omitempty"`
Template string `json:"template,omitempty"`
Vars map[string]string `json:"vars,omitempty"`
Verify []string `json:"verify,omitempty"`
Review bool `json:"review,omitempty"`
Runner string `json:"runner,omitempty"`
Cwd string `json:"cwd,omitempty"`
TimeoutSec int `json:"timeout_sec,omitempty"`
DispatchError string `json:"dispatch_error,omitempty"`
// PLAN-03 chain fields: After lists the items this one waits for, Auto whether the
// chain may start it, Cmd the argv of an exec item.
After []string `json:"after,omitempty"`
Auto bool `json:"auto"`
Cmd []string `json:"cmd,omitempty"`
// Model is the model the item's job asks for (empty = the agent's own default).
Model string `json:"model,omitempty"`
// Budget is the spend ceiling the item's job runs under (N2 §B).
Budget *job.Budget `json:"budget,omitempty"`
// Acceptance is the item's acceptance criteria (gofer-3nxa.4).
Acceptance string `json:"acceptance,omitempty"`
// CheckPrompt / CheckPromptSource are the item's delivery-check requirement and its source.
CheckPrompt string `json:"check_prompt,omitempty"`
CheckPromptSource string `json:"check_prompt_source,omitempty"`
// Scope is the item's declared change scope (path globs, gofer-3nxa.3).
Scope []string `json:"scope,omitempty"`
// PrimeKeywords are the task keywords of the item's job (gofer-11tz): the tracker-prime
// material the dispatched job receives is selected and ranked by them.
PrimeKeywords []string `json:"prime_keywords,omitempty"`
// ContinueFrom is the todo whose agent session this item continues; ContinuedBy the
// successor that took this item's session; ContinueNote why the last dispatch did
// not continue.
ContinueFrom string `json:"continue_from,omitempty"`
ContinuedBy string `json:"continued_by,omitempty"`
ContinueNote string `json:"continue_note,omitempty"`
// Jobs are the runs attached to this todo (SUP-01 C), newest first — `plan show`
// lists them under the item. Empty for an item nobody has run.
Jobs []TodoJob `json:"jobs,omitempty"`
}
Todo is the client-side view of a plan todo item. JobID "" is a plain todo.
type TodoDispatch ¶
type TodoDispatch struct {
Todo Todo `json:"todo"`
Job *job.JobResult `json:"job,omitempty"`
Dispatched bool `json:"dispatched"`
Reason string `json:"reason,omitempty"`
}
TodoDispatch is the outcome of an explicit dispatch (PLAN-02 P2): POST /v1/todos/{id}/dispatch. Job is nil when nothing was dispatched and Reason says why (the item has no assignee is refused as an error instead; a live job is reported).
type TodoJob ¶
type TodoJob struct {
ID string `json:"id"`
Status string `json:"status"`
Agent string `json:"agent,omitempty"`
StartedAt int64 `json:"started_at,omitempty"`
EndedAt int64 `json:"ended_at,omitempty"`
DurationSec int64 `json:"duration_sec,omitempty"`
// DeliveryState / PRURL are the job's delivery outcome (state, PR link); empty
// when the job has no delivery record.
DeliveryState string `json:"delivery_state,omitempty"`
PRURL string `json:"pr_url,omitempty"`
}
TodoJob is one job attached to a todo: id/status/agent plus how long it took.
type TodoUpdate ¶
TodoUpdate is one PATCH /v1/todos/{id} body (PLAN-02 P2): the lifecycle fields plus the dispatch fields. A zero value keeps the current one — status "" (note-only or patch-only update), a nil note (keep), an empty append_note (nothing appended), and the patch's nil entries (see jobstore.TodoPatch).
type TrackerDeleteResult ¶ added in v0.139.0
type TrackerDeleteResult struct {
TrackerID string `json:"tracker_id"`
Deleted struct {
Repo bool `json:"repo"`
Issues int64 `json:"issues"`
Memories int64 `json:"memories"`
Suggestions int64 `json:"suggestions"`
} `json:"deleted"`
}
TrackerDeleteResult counts what the server removed for one mirror.
type TrackerRenameResult ¶
type TrackerRenameResult struct {
TrackerID string `json:"tracker_id"`
OldTrackerID string `json:"old_tracker_id"`
Renamed bool `json:"renamed"`
}
TrackerRenameResult is the server's answer to a tracker_id rename.
type TrackerRepo ¶ added in v0.139.0
type TrackerRepo struct {
TrackerID string `json:"tracker_id"`
ProjectKey string `json:"project_key"`
RelPath string `json:"rel_path"`
Prefix string `json:"prefix"`
LastSyncAt int64 `json:"last_sync_at"`
SyncSummary string `json:"sync_summary"`
SourceRunner string `json:"source_runner,omitempty"`
}
TrackerRepo is one repository mirrored on the server (GET /v1/tracker/repos).
type TrackerRepoSyncResult ¶
type TrackerRepoSyncResult struct {
JobID string `json:"job_id"`
TrackerID string `json:"tracker_id"`
ProjectKey string `json:"project_key"`
Runner string `json:"runner"`
Cwd string `json:"cwd"`
}
TrackerRepoSyncResult is the server's answer to a dispatched `repo sync` (TRK-05).
type TrackerSyncClient ¶ added in v0.152.0
type TrackerSyncClient struct {
TrackerID string `json:"tracker_id"`
ClientHost string `json:"client_host"`
Caller string `json:"caller"`
LastSyncAt int64 `json:"last_sync_at"`
Summary string `json:"summary"`
}
TrackerSyncClient is one machine's last sync of a tracker (GET /v1/tracker/repos/{tracker_id}/clients).
type TriggerInvokeResult ¶ added in v0.207.0
type TriggerInvokeResult struct {
Trigger string `json:"trigger"`
RequestID string `json:"request_id"`
JobID string `json:"job_id,omitempty"`
Duplicate bool `json:"duplicate"`
Status string `json:"status,omitempty"`
}
TriggerInvokeResult is the answer of POST /v1/triggers/{name}/invoke.
type TunnelConn ¶
type TunnelError ¶
TunnelError reports an HTTP tunnel refusal.
func (*TunnelError) Error ¶
func (e *TunnelError) Error() string
func (*TunnelError) TunnelStatus ¶ added in v0.141.0
func (e *TunnelError) TunnelStatus() int
TunnelStatus exposes the connect endpoint's HTTP status, which the SOCKS listener maps onto its reply codes (tunnel.ProxyFailure).
type TunnelForwarder ¶
type TunnelForwarder struct {
ID string `json:"id"`
CallerID string `json:"caller_id"`
Worker string `json:"worker"`
Specs []TunnelSpecView `json:"specs"`
Host string `json:"host"`
PID int `json:"pid"`
Hosted bool `json:"hosted"`
HostedName string `json:"hosted_name,omitempty"`
// Caps are what the process advertised ("stop": it can be stopped remotely).
Caps []string `json:"caps,omitempty"`
// StopRequested is true while a remote stop waits for the next heartbeat.
StopRequested bool `json:"stop_requested,omitempty"`
StopRequestedAt *time.Time `json:"stop_requested_at,omitempty"`
StartedAt time.Time `json:"started_at"`
LastSeenAt time.Time `json:"last_seen_at"`
Connections int `json:"connections"`
BytesUp int64 `json:"bytes_up"`
BytesDown int64 `json:"bytes_down"`
}
TunnelForwarder is one online `gofer tun forward` process, with the traffic the hub attributed to it (connections grouped by caller+worker+target).
func (TunnelForwarder) HasCap ¶
func (f TunnelForwarder) HasCap(capability string) bool
HasCap reports whether the forwarder advertised the capability.
type TunnelForwarderRegistration ¶
type TunnelForwarderRegistration struct {
Worker string `json:"worker"`
Specs []TunnelSpecView `json:"specs"`
Host string `json:"host"`
PID int `json:"pid"`
StartedAt time.Time `json:"started_at"`
// Caps advertises what this process understands; ForwarderCapStop means it exits
// when a heartbeat answers 410 (a remote stop).
Caps []string `json:"caps,omitempty"`
}
TunnelForwarderRegistration is what a starting forwarder announces: the rules it is listening on and where it runs. The id and the caller are the hub's to assign.
type TunnelInfo ¶
type TunnelPreset ¶
type TunnelPreset struct {
Name string `json:"name"`
Worker string `json:"worker"`
Specs []string `json:"specs"`
Note string `json:"note"`
Autostart bool `json:"autostart"`
UpdatedAt time.Time `json:"updated_at"`
UpdatedBy string `json:"updated_by"`
}
TunnelPreset is one saved forward preset on the server.
type TunnelSpecView ¶
type TunnelSpecView struct {
Network string `json:"network"`
Bind string `json:"bind"`
LocalPort int `json:"local_port"`
Target string `json:"target"`
}
TunnelSpecView is one forwarding rule as the hub reports it. The hub stores rules structured; the CLI renders them.
func (TunnelSpecView) Display ¶
func (v TunnelSpecView) Display() string
Display renders a rule the way `tun ls` shows it: `[udp/]lport -> target`, with a bind prefix only when it is not the default 127.0.0.1 (the common case needs no noise). ASCII `->` on purpose: the CLI is read in Windows consoles too.
type TurnStatus ¶
type TurnStatus struct {
Outcome string `json:"outcome"`
Relay bool `json:"relay"`
WaitReason string `json:"wait_reason,omitempty"`
// WaitReasonDetail says why a wait that ISN'T arming (SUP-01 D): the caller is
// supervising live jobs. Logged by the hook, never acted on.
WaitReasonDetail string `json:"wait_reason_detail,omitempty"`
Decision Decision `json:"decision"`
}
TurnStatus is GET /v1/sessions/{sid}/turns/{id}: outcome is one of open|answered|expired|relay_off; Decision.Answer holds the reply when answered. WaitReason is why the session still waits (mode_on / idle_probe / turn_age; empty = it stopped waiting), see AgentSession.WaitReason.
type UsageAgent ¶
type UsageAgent struct {
Jobs int `json:"jobs"`
TotalTokens int64 `json:"total_tokens"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
CostUSD float64 `json:"cost_usd"`
// CacheReadTokens / CacheWriteTokens are sent by the plan roll-up only.
CacheReadTokens int64 `json:"cache_read_tokens,omitempty"`
CacheWriteTokens int64 `json:"cache_write_tokens,omitempty"`
}
UsageAgent is one agent's tally in a window: Jobs counts every job it ran, the sums only the jobs that reported usage.
type UsageWindow ¶
type UsageWindow struct {
ByAgent map[string]UsageAgent `json:"by_agent"`
Total UsageAgent `json:"total"`
}
UsageWindow is one window of the aggregate: per-agent tallies plus their sum.
type Wakeup ¶
type Wakeup struct {
ID string `json:"id"`
JobID string `json:"job_id"`
Kind string `json:"kind"`
At int64 `json:"at,omitempty"`
EverySec int64 `json:"every_sec,omitempty"`
Cron string `json:"cron,omitempty"`
Timezone string `json:"timezone,omitempty"`
EventTypes []string `json:"event_types,omitempty"`
FilterJobID string `json:"filter_job_id,omitempty"`
FilterStatus []string `json:"filter_status,omitempty"`
Mode string `json:"mode"`
Instruction string `json:"instruction,omitempty"`
Enabled bool `json:"enabled"`
Revision int64 `json:"revision"`
NextRunAt int64 `json:"next_run_at,omitempty"`
LastFiredAt int64 `json:"last_fired_at,omitempty"`
FiredCount int64 `json:"fired_count"`
CoalescedCount int64 `json:"coalesced_count"`
ContinuationJobID string `json:"continuation_job_id,omitempty"`
// PendingDelivery marks a receipt that already triggered and waits for its resident
// target to come back to idle; ContinuationJobID is empty then, because the wakeup
// started no job yet.
PendingDelivery bool `json:"pending_delivery,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt int64 `json:"created_at"`
ExpiresAt int64 `json:"expires_at,omitempty"`
}
Wakeup is the client-side view of one JOB-09 wakeup (design §五.1): an event subscription or timer registered on a job that starts a continuation of it when it fires. Timestamps are unix SECONDS; Enabled is the switch the web toggles.
type WakeupsResp ¶
type WakeupsResp struct {
Wakeups []Wakeup `json:"wakeups"`
}
WakeupsResp is the `{wakeups: [...]}` envelope of the list endpoint.
type WatchHandlers ¶
WatchHandlers carries the presentation callbacks for WatchJob. The watch state-machine (SSE consumption + status/EOF tracking) lives here in client; the command layer supplies these callbacks to print and to derive a process exit code (the exit-code mapping is a command concern, kept in commands).
- OnStatus fires once per status CHANGE (the first time a new status is seen).
- OnLog fires for each non-empty log frame's raw text.
Both may be nil.
type WorkDispatchTarget ¶ added in v0.166.0
type WorkDispatchTarget struct {
AgentSession
TopicSource string `json:"topic_source,omitempty"`
Hits []WorkTargetHit `json:"hits"`
MaybeOffline bool `json:"maybe_offline,omitempty"`
}
WorkDispatchTarget is one recommended session for a work item: the session plus why it matched (hits; a topic hit with source inferred is a guess).
type WorkListOpts ¶
type WorkListOpts struct {
Statuses []string
Project string
Workspace string
Session string
Query string
Unsorted *bool
Closed bool
// Merged includes items that were merged into another (hidden by default).
Merged bool
Due bool
Limit int
}
WorkListOpts filters ListWorkItems (mirrors GET /v1/work-items).
type WorkReportRequestResult ¶
type WorkReportRequestResult struct {
SessionID string `json:"session_id"`
RequestID string `json:"request_id,omitempty"`
Kind string `json:"kind,omitempty"`
State string `json:"state,omitempty"`
Sent bool `json:"sent"`
Channel string `json:"channel,omitempty"`
Reason string `json:"reason,omitempty"`
}
WorkReportRequestResult is the per-session outcome of "ask it to report".
type WorkSplitResult ¶
type WorkSplitResult struct {
Source work.DetailView `json:"source"`
Item work.DetailView `json:"item"`
}
WorkSplitResult is the split response: the source and the new item.
type WorkTargetHit ¶ added in v0.166.0
type WorkTargetHit struct {
Kind string `json:"kind"`
Match string `json:"match,omitempty"`
Source string `json:"source,omitempty"`
}
WorkTargetHit is one reason a session was recommended.
type WorkToTodoResult ¶
type WorkToTodoResult struct {
TodoID string `json:"todo_id"`
PlanID string `json:"plan_id"`
PlanCreated bool `json:"plan_created"`
Item work.DetailView `json:"item"`
}
WorkToTodoResult is what POST /v1/work-items/{id}/to-todo returns.
type WorkerAssignable ¶
type WorkerAssignable struct {
WorkerID string `json:"worker_id"`
Projects []AssignableProject `json:"projects"`
ServerVersion string `json:"server_version,omitempty"`
ProtocolVersion int `json:"protocol_version"`
}
WorkerAssignable is the wizard's server-side briefing (CFG-05): the projects whose allowed_runners may route to this worker, plus the server and wire protocol versions it is onboarding against.
type WorkerCaps ¶
type WorkerCaps struct {
Labels []string `json:"labels"`
Projects []string `json:"projects"`
Agents []string `json:"agents"`
MaxConcurrent int `json:"max_concurrent"`
}
WorkerCaps is a worker's capability snapshot as reported by a successful reload.
type WorkerDetail ¶
type WorkerDetail struct {
WorkerID string `json:"worker_id"`
Connected bool `json:"connected"`
Worker *RunnerWorkerDetail `json:"worker,omitempty"`
// Upgrade is the latest remote-upgrade attempt (any state), nil when none.
Upgrade *WorkerUpgradeRecord `json:"upgrade,omitempty"`
UpgradeHistory []WorkerUpgradeRecord `json:"upgrade_history,omitempty"`
// LastReplaced is the latest takeover of this worker_id by a process with a
// different instance_id; nil when none was recorded.
LastReplaced *WorkerReplaced `json:"last_replaced,omitempty"`
}
type WorkerMeta ¶
type WorkerMeta struct {
ID string `json:"id"`
Labels []string `json:"labels,omitempty"`
Projects []string `json:"projects,omitempty"`
Agents []string `json:"agents,omitempty"`
AgentCaps []RunnerAgentMeta `json:"agent_caps,omitempty"`
Connected bool `json:"connected"`
}
WorkerMeta is one worker returned by GET /v1/meta. It is deliberately a client-side wire type so commands can inspect the server without importing the HTTP API package.
type WorkerRegistration ¶
type WorkerReload ¶
type WorkerReload struct {
WorkerID string `json:"worker_id"`
Applied bool `json:"applied"`
Caps *WorkerCaps `json:"caps,omitempty"`
}
WorkerReload is the reload endpoint's answer. Applied=true means the worker is now running the new config and Caps is its resulting capability snapshot.
type WorkerReplaced ¶ added in v0.214.0
type WorkerReplaced struct {
At int64 `json:"at"`
OldInstance string `json:"old_instance,omitempty"`
NewInstance string `json:"new_instance,omitempty"`
OldRemote string `json:"old_remote,omitempty"`
NewRemote string `json:"new_remote,omitempty"`
Suppressed int `json:"suppressed,omitempty"`
}
WorkerReplaced is one worker.replaced observation.
type WorkerUpgradeOptions ¶
type WorkerUpgradeOptions struct {
Source string `json:"source,omitempty"`
Version string `json:"version,omitempty"`
Force bool `json:"force,omitempty"`
DrainTimeoutSec int `json:"drain_timeout_sec,omitempty"`
ReadyTimeoutSec int `json:"ready_timeout_sec,omitempty"`
}
WorkerUpgradeOptions is the body of POST /v1/workers/{id}/upgrade. Source is "auto" (the server's own executable for a worker of the server's platform, the release source otherwise; the default), "server" (the server's own executable), "mirror" (the release source configured in server.update) or "staged" (the binary uploaded with StageWorkerUpgrade). Version names the release to download ("" = the server's version).
type WorkerUpgradeRecord ¶
type WorkerUpgradeRecord struct {
WorkerID string `json:"worker_id"`
UpgradeID string `json:"upgrade_id"`
State string `json:"state"`
FromVersion string `json:"from_version,omitempty"`
TargetVersion string `json:"target_version,omitempty"`
TargetSHA256 string `json:"target_sha256,omitempty"`
Force bool `json:"force,omitempty"`
Error string `json:"error,omitempty"`
StartedAt int64 `json:"started_at"`
FinishedAt int64 `json:"finished_at,omitempty"`
DurationMS int64 `json:"duration_ms,omitempty"`
}
WorkerUpgradeRecord is the latest remote-upgrade attempt of one worker. Times are unix milliseconds.
type Workflow ¶
type Workflow struct {
ID string `json:"id"`
Title string `json:"title,omitempty"`
Status string `json:"status"`
CurrentStep int `json:"current_step"`
TotalSteps int `json:"total_steps"`
CallerID string `json:"caller_id,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
// RerunOf is the workflow this one was trimmed from by `wf rerun` (design §一·7).
RerunOf string `json:"rerun_of,omitempty"`
// Template / TemplateSource: the template the run was submitted from and its origin
// (builtin / global / project); empty for a directly submitted spec.
Template string `json:"template,omitempty"`
TemplateSource string `json:"template_source,omitempty"`
Steps []WorkflowStep `json:"steps,omitempty"`
}
Workflow is the client-side view of a job-chain. It carries the workflow header fields plus (for GetWorkflow) the per-step chain. List/Submit/Cancel return the header only, so Steps is nil there; GetWorkflow inlines the chain. Field tags match httpapi's workflowSummary / workflowDetail JSON so one struct decodes both.
type WorkflowEvent ¶
type WorkflowEvent struct {
Seq int64 `json:"seq"`
WorkflowID string `json:"workflow_id"`
Type string `json:"type"`
Detail string `json:"detail,omitempty"`
At int64 `json:"at"`
}
WorkflowEvent mirrors jobstore.WorkflowEvent's JSON (P1 timeline): the monotonic seq cursor, the event type, an optional detail_json blob and the unix-second timestamp. Used by `workflow events` (T4.3).
type WorkflowStep ¶
type WorkflowStep struct {
StepIndex int `json:"step_index"`
Attempt int `json:"attempt,omitempty"`
FanIndex int `json:"fan_index,omitempty"`
// FanName is the fan's own declared name (linux-race / web …), empty when the step
// fanned out without named fans (gofer-j5xc).
FanName string `json:"fan_name,omitempty"`
Name string `json:"name,omitempty"`
JobID string `json:"job_id,omitempty"`
Status string `json:"status,omitempty"`
// Type=="workflow" + ChildWorkflowID mark a sub-workflow step (P3 UI fix): it runs
// no step-job, so JobID is empty and the link target is the child workflow.
Type string `json:"type,omitempty"`
ChildWorkflowID string `json:"child_workflow_id,omitempty"`
WorktreeBranch string `json:"worktree_branch,omitempty"`
Diff string `json:"diff,omitempty"`
DiffSummary string `json:"diff_summary,omitempty"`
// Result view (design §一·6): where the row ran, its exit code, how long it took
// and why it failed (the failure-looking lines of its log tail, at most 20).
Runner string `json:"runner,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
DurationSec int64 `json:"duration_sec,omitempty"`
FailureExcerpt string `json:"failure_excerpt,omitempty"`
// Cwd/Ref are where the row actually ran (a ref: step runs in a temporary
// checkout of Ref) and StartedAt/FinishedAt are its unix-second start/end.
Cwd string `json:"cwd,omitempty"`
Ref string `json:"ref,omitempty"`
StartedAt int64 `json:"started_at,omitempty"`
FinishedAt int64 `json:"finished_at,omitempty"`
}
mirroring httpapi's workflow.Step JSON (snake_case). job_id/status are empty for a step not yet started (the chain is strictly serial). Attempt is the 1-based retry attempt of this step-job (P1) and FanIndex the 1-based fan-out parallel index (P2); both are 0/omitted for a v1 single-job step, so the CLI only renders them when a step actually fanned out / retried (T4.3 `workflow show`).
type XferRecord ¶
type XferRecord struct {
ID string `json:"id"`
Op string `json:"op"`
Runner string `json:"runner"`
Project string `json:"project"`
// Target names the directory tree Path is relative to on the EXECUTING machine: empty =
// the project, "attachments" = that machine's own attachment directory (Project empty).
Target string `json:"target,omitempty"`
Path string `json:"path"`
// AbsPath is the absolute destination the executing machine reported for a put (empty
// when it cannot report one). `gofer tool xfer show` prints it.
AbsPath string `json:"abs_path,omitempty"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
State string `json:"state"`
Error string `json:"error,omitempty"`
CallerID string `json:"caller_id,omitempty"`
CreatedAt int64 `json:"created_at"`
FinishedAt int64 `json:"finished_at,omitempty"`
ExpiresAt int64 `json:"expires_at,omitempty"`
}
XferRecord is one transfer journal row (GET /v1/xfer/{id}). Its JSON tags are the wire keys the server's xferView uses: `project` names the project (not project_key) and every timestamp is unix SECONDS.
Source Files
¶
- admin_audit.go
- auth.go
- background_agent.go
- callers.go
- client.go
- health.go
- job_delete.go
- job_events.go
- job_preview.go
- job_redact.go
- job_secret_scan.go
- job_transcript.go
- mail.go
- mcp.go
- memory_candidates.go
- memory_synthesis.go
- plan_autobind.go
- plandriver_report.go
- refs.go
- reqlog.go
- rules.go
- runners.go
- scoped_memories.go
- seat.go
- session.go
- session_mail.go
- session_permission.go
- session_topic.go
- session_wait.go
- settings.go
- skills.go
- sse.go
- stage.go
- stats.go
- steward.go
- today.go
- tracker_sync.go
- trigger.go
- tunnel_presets.go
- watch.go
- work.go
- worker_assignable.go
- worker_enroll.go
- worker_registration.go
- worker_upgrade.go
- workers.go
- xfer.go