api

package
v0.0.0-...-9defd5a Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: AGPL-3.0 Imports: 34 Imported by: 0

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
	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
}

Server implements gen.ServerInterface.

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) 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) ConfigureProjectPlugin

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

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) 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) 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) 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)

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) 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) 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) 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) RemoveProjectPack

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

func (*Server) RequestRunnerLogin

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

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) 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) 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