api

package
v0.0.0-...-8d4c08b Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 40 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api implements the HTTP API declared in docs/openapi.yaml.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActorFromContext

func ActorFromContext(ctx context.Context) process.Actor

ActorFromContext maps the authenticated principal to the process actor recorded on transitions. Anonymous requests act as system (and are rejected by handlers that mutate).

Types

type Server

type Server struct {
	Pool    *pgxpool.Pool
	Process *process.Service
	Runners *runners.Manager
	Plugins *plugins.Host // nil: plugin endpoints answer 503
	Quality *quality.Service
	// Automations is the project's catalogue of automations; nil: those endpoints answer 503.
	Automations *automations.Service
	Hub         *events.Hub
	Tokens      auth.Tokens
	Authz       auth.Authorizer
	OIDC        *auth.OIDC // nil when not configured
	DevAuth     bool       // accept X-Gator-User; local development only
	Features    []string
	Log         *slog.Logger
	// RateLimit applies per token (or IP when anonymous). Zero disables.
	RateLimitPerSecond float64
	RateLimitBurst     int
	// TrustedProxies may name the client in X-Forwarded-For; everyone else is who they
	// connect from.
	TrustedProxies limits.Proxies
	// PublicURL is where people reach this server, for the invitation links they pass on.
	// Empty: the address the inviter used.
	PublicURL string
	// Mailer delivers invitations; nil leaves that to the inviter, who gets the link.
	Mailer invites.Mailer
}

Server implements gen.ServerInterface.

func (*Server) AcceptInvitation

func (s *Server) AcceptInvitation(w http.ResponseWriter, r *http.Request)

AcceptInvitation is the signed-in person opening their invitation link.

func (*Server) AddCampaignTargets

func (s *Server) AddCampaignTargets(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

AddCampaignTargets gives a campaign the places it has to reach.

func (*Server) AddProductEntry

func (s *Server) AddProductEntry(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

AddProductEntry writes what a person says about the product; it needs no approval.

func (*Server) AddProjectKnowledge

func (s *Server) AddProjectKnowledge(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) AddWorkspaceKnowledge

func (s *Server) AddWorkspaceKnowledge(w http.ResponseWriter, r *http.Request)

func (*Server) AdmitTask

func (s *Server) AdmitTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

AdmitTask lets work raised outside the workspace through. Until a person does this, no agent starts on it by itself: the words in it were written by somebody this workspace does not vouch for, and an agent runs with the operator's credentials.

func (*Server) AdvanceTask

func (s *Server) AdvanceTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) AgentBlocked

func (s *Server) AgentBlocked(w http.ResponseWriter, r *http.Request)

AgentBlocked stops the task with the agent's reason. An agent that cannot go on should say so: the alternative is an hour of guessing, paid for, ending in a report nobody can use.

func (*Server) AgentCatalogue

func (s *Server) AgentCatalogue(w http.ResponseWriter, r *http.Request)

AgentCatalogue answers what the project is made of.

func (*Server) AgentKnowledge

func (s *Server) AgentKnowledge(w http.ResponseWriter, r *http.Request, params gen.AgentKnowledgeParams)

AgentKnowledge searches this project's documents for words the job's package did not carry.

func (*Server) AgentProposeProduct

func (s *Server) AgentProposeProduct(w http.ResponseWriter, r *http.Request)

AgentProposeProduct proposes what the work taught the product. Always proposed: a person decides what the product knows about itself, and an agent reading outside words must not be able to write into the documents every later prompt carries.

func (*Server) AgentPutArtifact

func (s *Server) AgentPutArtifact(w http.ResponseWriter, r *http.Request)

AgentPutArtifact records a document for the job's phase before the job ends, so work survives a job that later fails.

func (*Server) AgentQuestion

func (s *Server) AgentQuestion(w http.ResponseWriter, r *http.Request)

AgentQuestion asks a person and stops there. The question blocks the gate, so it reaches the inbox the same way every other decision does — and, like every other block, a phase timeout eventually calls it out rather than letting it wait for ever.

func (*Server) AgentTask

func (s *Server) AgentTask(w http.ResponseWriter, r *http.Request)

AgentTask answers what this job is about.

func (*Server) AllowAgents

func (s *Server) AllowAgents(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

AllowAgents is a person allowing agents to work on a task without asking for permission. Until somebody does, no job starts on it: an agent runs as the runner's user, with that machine's files, network and credentials, and nothing stops it to ask first.

func (*Server) ApproveComponent

func (s *Server) ApproveComponent(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, key string)

ApproveComponent accepts a component the server worked out from where jobs change code. Until somebody does, it is a suggestion on a screen and reaches no prompt. Rejecting one is deleting it, which is the same gesture as removing any other component.

func (*Server) ApproveTask

func (s *Server) ApproveTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) ArchiveProject

func (s *Server) ArchiveProject(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

ArchiveProject hides a project without losing any of it. Its tasks, receipts and metrics stay readable by id; its plugins stop at the next sync, because an archived project should not be answering webhooks or spending anyone's budget.

func (*Server) Capabilities

func (s *Server) Capabilities(w http.ResponseWriter, _ *http.Request)

func (*Server) CloseTask

func (s *Server) CloseTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

CloseTask finishes a task wherever it stands. Whatever an agent is still doing on it is stopped: closing says the work is no longer wanted, and an agent carrying on would spend money on it and then try to hand in work nobody can advance. Refusing to close until a person had found and stopped each job would only make the same thing take longer.

func (*Server) ConfigureProjectPlugin

func (s *Server) ConfigureProjectPlugin(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, pluginName gen.PluginName)

func (*Server) ConnectProjectPlugin

func (s *Server) ConnectProjectPlugin(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, pluginName gen.PluginName)

func (*Server) CreateInvitation

func (s *Server) CreateInvitation(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) CreateProject

func (s *Server) CreateProject(w http.ResponseWriter, r *http.Request)

func (*Server) CreateTask

func (s *Server) CreateTask(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) CreateTaskJob

func (s *Server) CreateTaskJob(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) CreateToken

func (s *Server) CreateToken(w http.ResponseWriter, r *http.Request)

func (*Server) DeleteComponent

func (s *Server) DeleteComponent(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, key string)

func (*Server) DeleteKnowledgeEntry

func (s *Server) DeleteKnowledgeEntry(w http.ResponseWriter, r *http.Request, entryId openapi_types.UUID)

func (*Server) DeleteProject

func (s *Server) DeleteProject(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

DeleteProject removes an empty one for good. A project that ever held a task is archived instead: its phase transitions and receipts are the record of what happened, and no click should be able to erase that.

func (*Server) DeleteProjectPreset

func (s *Server) DeleteProjectPreset(w http.ResponseWriter, r *http.Request, presetId openapi_types.UUID)

func (*Server) DeleteProjectRepo

func (s *Server) DeleteProjectRepo(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, name string)

DeleteProjectRepo forgets a repository. Taking the primary one away while others remain would leave runners to guess which to check out, so another must be made primary first.

func (*Server) FetchKnowledgePacks

func (s *Server) FetchKnowledgePacks(w http.ResponseWriter, r *http.Request)

FetchKnowledgePacks clones a registry and stores what it promises, refusing any pack whose files do not hash to the checksum in its index.

func (*Server) ForgetDevice

func (s *Server) ForgetDevice(w http.ResponseWriter, r *http.Request, deviceToken string)

ForgetDevice stops notifications to one of the caller's devices.

func (*Server) ForgetRunner

func (s *Server) ForgetRunner(w http.ResponseWriter, r *http.Request, runnerId gen.RunnerId)

ForgetRunner ends a runner for good: its token stops authenticating and it leaves the list. The row stays. Every job it ran points at it, and jobs.runner_id is ON DELETE SET NULL, so deleting the row would quietly erase which machine did the work — a worse loss than a long list. A connected runner is refused, because it would simply reappear on its next heartbeat.

func (*Server) GetCampaign

func (s *Server) GetCampaign(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

GetCampaign answers how far a fleet change has got.

func (*Server) GetDashboard

func (s *Server) GetDashboard(w http.ResponseWriter, r *http.Request, params gen.GetDashboardParams)

GetDashboard answers the plugin numbers on the app's home screen in one call: per tracker, the issues it brought in that are still open; per monitoring plugin, its open incidents. Every plugin switched on in a readable project has an entry, zero included, so a client can tell "no errors" from "nothing watches for them".

func (*Server) GetJob

func (s *Server) GetJob(w http.ResponseWriter, r *http.Request, jobId gen.JobId)

func (*Server) GetProject

func (s *Server) GetProject(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) GetProjectBudget

func (s *Server) GetProjectBudget(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

GetProjectBudget answers with the numbers the budget gate uses, so a person setting a limit sees the same figure that will block the work rather than a different one from a report.

func (*Server) GetProjectConfig

func (s *Server) GetProjectConfig(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

GetProjectConfig returns process_config as stored.

func (*Server) GetProjectMetrics

func (s *Server) GetProjectMetrics(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, params gen.GetProjectMetricsParams)

func (*Server) GetTask

func (s *Server) GetTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) GetTaskMetrics

func (s *Server) GetTaskMetrics(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) GetTaskPluginUI

func (s *Server) GetTaskPluginUI(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) GetWorkspaceProcess

func (s *Server) GetWorkspaceProcess(w http.ResponseWriter, r *http.Request)

GetWorkspaceProcess returns the process this workspace has decided for every project in it. A project's own process_config still wins; this is what applies without one.

func (*Server) HandoffTask

func (s *Server) HandoffTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) Healthz

func (s *Server) Healthz(w http.ResponseWriter, _ *http.Request)

func (*Server) ImportProjectPlugin

func (s *Server) ImportProjectPlugin(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, pluginName gen.PluginName)

func (*Server) InstallPlugin

func (s *Server) InstallPlugin(w http.ResponseWriter, r *http.Request, pluginName gen.PluginName)

func (*Server) ListAgentCalls

func (s *Server) ListAgentCalls(w http.ResponseWriter, r *http.Request, jobId gen.JobId, params gen.ListAgentCallsParams)

ListAgentCalls answers what the agent said back while the job ran. It reads next to the job's output, because "the agent asked a question" belongs in the same story as its text.

func (*Server) ListComponents

func (s *Server) ListComponents(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

ListComponents returns the catalogue with each component's neighbours and decisions, so the screen and the prompt agree on what a component is.

func (*Server) ListInbox

func (s *Server) ListInbox(w http.ResponseWriter, r *http.Request, params gen.ListInboxParams)

ListInbox answers what waits for a person. Without all=true it is the task inbox it always was. With it, everything a person has to decide is in the one answer, so a client reads decisions from one place: agent proposals for the catalogue and the product context, runners whose backend lost its login, plugins Gator switched off, and stalled jobs.

func (*Server) ListIncidents

func (s *Server) ListIncidents(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

ListIncidents answers what production said went wrong, open ones first.

func (*Server) ListInvitations

func (s *Server) ListInvitations(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) ListJobContext

func (s *Server) ListJobContext(w http.ResponseWriter, r *http.Request, jobId gen.JobId)

ListJobContext answers what this job was handed, as it was handed over.

func (*Server) ListJobEvents

func (s *Server) ListJobEvents(w http.ResponseWriter, r *http.Request, jobId gen.JobId, params gen.ListJobEventsParams)

func (*Server) ListKnowledgePacks

func (s *Server) ListKnowledgePacks(w http.ResponseWriter, r *http.Request)

func (*Server) ListPluginCalls

func (s *Server) ListPluginCalls(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, pluginName gen.PluginName, params gen.ListPluginCallsParams)

func (*Server) ListPluginCatalogue

func (s *Server) ListPluginCatalogue(w http.ResponseWriter, r *http.Request)

ListPluginCatalogue lists what the server ships. Anyone signed in may read it: a person starting a project needs to see what they could switch on.

func (*Server) ListPlugins

func (s *Server) ListPlugins(w http.ResponseWriter, r *http.Request)

func (*Server) ListProductContext

func (s *Server) ListProductContext(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) ListProjectAutomations

func (s *Server) ListProjectAutomations(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

ListProjectAutomations is the catalogue with the project's state. Anyone who can read the project sees it, so people know what runs on their behalf.

func (*Server) ListProjectCandidates

func (s *Server) ListProjectCandidates(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, params gen.ListProjectCandidatesParams)

ListProjectCandidates lets a project admin find someone already in the workspace without seeing the whole workspace: a search of at least two characters, ten answers, and only the name and email needed to pick one.

func (*Server) ListProjectKnowledge

func (s *Server) ListProjectKnowledge(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) ListProjectMembers

func (s *Server) ListProjectMembers(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

ListProjectMembers says who works on a project and in which role.

func (*Server) ListProjectPacks

func (s *Server) ListProjectPacks(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) ListProjectPlugins

func (s *Server) ListProjectPlugins(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) ListProjectPresets

func (s *Server) ListProjectPresets(w http.ResponseWriter, r *http.Request)

func (*Server) ListProjectRepos

func (s *Server) ListProjectRepos(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) ListProjectTemplates

func (s *Server) ListProjectTemplates(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) ListProjects

func (s *Server) ListProjects(w http.ResponseWriter, r *http.Request)

func (*Server) ListQuality

func (s *Server) ListQuality(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

ListQuality answers the scorecard: a score per component, the score before it, and the rules behind both. The previous score is what makes the number mean anything.

func (*Server) ListReleases

func (s *Server) ListReleases(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

ListReleases answers what reached each environment and whether it is still being watched.

func (*Server) ListRunners

func (s *Server) ListRunners(w http.ResponseWriter, r *http.Request)

func (*Server) ListTaskArtifacts

func (s *Server) ListTaskArtifacts(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) ListTaskJobs

func (s *Server) ListTaskJobs(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) ListTaskTransitions

func (s *Server) ListTaskTransitions(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) ListTasks

func (s *Server) ListTasks(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) ListTokens

func (s *Server) ListTokens(w http.ResponseWriter, r *http.Request)

func (*Server) ListUsers

func (s *Server) ListUsers(w http.ResponseWriter, r *http.Request)

ListUsers is the workspace's people, for the workspace screen.

func (*Server) ListWorkspaceKnowledge

func (s *Server) ListWorkspaceKnowledge(w http.ResponseWriter, r *http.Request)

func (*Server) Me

func (s *Server) Me(w http.ResponseWriter, r *http.Request)

func (*Server) PreviewKnowledge

func (s *Server) PreviewKnowledge(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, params gen.PreviewKnowledgeParams)

PreviewKnowledge shows the technical part of a prompt as a job would receive it.

func (*Server) PreviewTaskContext

func (s *Server) PreviewTaskContext(w http.ResponseWriter, r *http.Request, taskId gen.TaskId, params gen.PreviewTaskContextParams)

PreviewTaskContext assembles the package a job started now would carry. It reads what the project knows today, so it is a forecast, not a record — a job that ran yesterday is read through ListJobContext, which is what actually went.

func (*Server) PutComponent

func (s *Server) PutComponent(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

PutComponent adds a component or updates it by key. Dependencies and decisions are replaced wholesale: the body says what the component is now, not what to add to it.

func (*Server) PutProjectRepo

func (s *Server) PutProjectRepo(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) Readyz

func (s *Server) Readyz(w http.ResponseWriter, r *http.Request)

func (*Server) RecordTaskUsage

func (s *Server) RecordTaskUsage(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) RegisterDevice

func (s *Server) RegisterDevice(w http.ResponseWriter, r *http.Request)

RegisterDevice records the caller's device for push notifications.

func (*Server) RemoveMember

func (s *Server) RemoveMember(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, userId openapi_types.UUID)

RemoveMember takes a person out of a project. An admin may remove anyone; anyone may leave.

func (*Server) RemoveProjectPack

func (s *Server) RemoveProjectPack(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, packName string)

func (*Server) RenewInvitation

func (s *Server) RenewInvitation(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, invitationId gen.InvitationId)

RenewInvitation gives an open invitation a new token and a new expiry. Only the hash of the old token is known, so this is also how an admin gets a link to copy again.

func (*Server) ReopenTask

func (s *Server) ReopenTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

ReopenTask brings closed work back where it was.

func (*Server) RequestRunnerLogin

func (s *Server) RequestRunnerLogin(w http.ResponseWriter, r *http.Request, runnerId gen.RunnerId)

func (*Server) RevokeInvitation

func (s *Server) RevokeInvitation(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, invitationId gen.InvitationId)

func (*Server) RevokeToken

func (s *Server) RevokeToken(w http.ResponseWriter, r *http.Request, tokenId openapi_types.UUID)

func (*Server) RollbackTask

func (s *Server) RollbackTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) Router

func (s *Server) Router() http.Handler

Router mounts the API under /api/v1 plus the WebSocket endpoint.

func (*Server) SaveProjectPreset

func (s *Server) SaveProjectPreset(w http.ResponseWriter, r *http.Request)

SaveProjectPreset snapshots a project: its process, the packs it switched on, the product context a person approved, and its primary repository. A snapshot, not a link — a project changed tomorrow does not quietly change what the next project starts from.

func (*Server) ScoreNow

func (s *Server) ScoreNow(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

ScoreNow runs the sweep instead of waiting for the daily one — for the person who has just fixed something and wants to see it counted.

func (*Server) SetMember

func (s *Server) SetMember(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) SetProductEntryStatus

func (s *Server) SetProductEntryStatus(w http.ResponseWriter, r *http.Request, entryId openapi_types.UUID)

SetProductEntryStatus approves a proposal or archives an entry.

func (*Server) SetProjectAutomation

func (s *Server) SetProjectAutomation(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId, automationKey gen.AutomationKey)

SetProjectAutomation switches one on or off. Only a person who is a project admin may: switching one on gives consent on behalf of every task it will create, which no agent or plugin can give.

func (*Server) SetProjectConfig

func (s *Server) SetProjectConfig(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

SetProjectConfig replaces the process configuration, refusing one that would not hold: a template with no phases, an unknown gate, a phase that no template owns.

func (*Server) SetProjectPack

func (s *Server) SetProjectPack(w http.ResponseWriter, r *http.Request, projectId gen.ProjectId)

func (*Server) SetTaskCheck

func (s *Server) SetTaskCheck(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

func (*Server) SetTaskComponent

func (s *Server) SetTaskComponent(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

SetTaskComponent says which part of the product a task is about. The job's prompt then carries that part and its neighbours instead of the whole catalogue.

func (*Server) SetWorkspaceProcess

func (s *Server) SetWorkspaceProcess(w http.ResponseWriter, r *http.Request)

SetWorkspaceProcess replaces it, refusing a template that would not hold. One bad template here would otherwise break every project that does not override that kind of task.

func (*Server) SkipCampaignTarget

func (s *Server) SkipCampaignTarget(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

SkipCampaignTarget drops one target, with a reason.

func (*Server) SteerJob

func (s *Server) SteerJob(w http.ResponseWriter, r *http.Request, jobId gen.JobId)

func (*Server) StopJob

func (s *Server) StopJob(w http.ResponseWriter, r *http.Request, jobId gen.JobId)

func (*Server) UpdateTask

func (s *Server) UpdateTask(w http.ResponseWriter, r *http.Request, taskId gen.TaskId)

UpdateTask edits an open task. A member may; a viewer reads.

func (*Server) Version

func (s *Server) Version(w http.ResponseWriter, _ *http.Request)

Directories

Path Synopsis
Package gen provides primitives to interact with the openapi HTTP API.
Package gen provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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