registry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartProxyRunWorker

func StartProxyRunWorker(ctx context.Context, svc *Service, cfg ProxyRunWorkerConfig)

StartProxyRunWorker marks pending / claimed proxy runs as timeout when a Registry Node never returns a terminal result.

Types

type CompleteProxyRunRequest

type CompleteProxyRunRequest struct {
	Status        string         `json:"status" validate:"required,oneof=success failed timeout"`
	Output        map[string]any `json:"output,omitempty"`
	OutputSummary string         `json:"output_summary,omitempty" validate:"omitempty,max=1000"`
	ErrorCode     string         `json:"error_code,omitempty" validate:"omitempty,max=80"`
	ErrorMessage  string         `json:"error_message,omitempty" validate:"omitempty,max=1000"`
	Retryable     bool           `json:"retryable,omitempty"`
	RetryAfterSec int32          `json:"retry_after_seconds,omitempty" validate:"omitempty,min=0,max=3600"`
}

type ConsumeRegistryFederationInviteRequest

type ConsumeRegistryFederationInviteRequest struct {
	FederationToken string `json:"federation_token" validate:"required,min=8,max=4096"`
}

type CreateNodeRequest

type CreateNodeRequest struct {
	NodeName string   `json:"node_name" validate:"required,min=2,max=120"`
	NodeType string   `json:"node_type,omitempty" validate:"omitempty,oneof=self_hosted bridge_proxy"`
	BaseURL  string   `json:"base_url,omitempty" validate:"omitempty,url,max=500"`
	Scopes   []string `json:"scopes,omitempty" validate:"omitempty,max=4,dive,oneof=heartbeat listing:sync proxy:pull proxy:result"`
}

CreateNodeRequest creates a registry-side identity for a self-hosted Registry / Bridge Node. The returned node_secret is shown once.

type CreateProxyRunRequest

type CreateProxyRunRequest struct {
	RegistryListingID string         `json:"registry_listing_id" validate:"required,uuid"`
	IdempotencyKey    string         `json:"idempotency_key,omitempty" validate:"omitempty,min=8,max=160"`
	Input             map[string]any `json:"input,omitempty"`
	InputSummary      string         `json:"input_summary,omitempty" validate:"omitempty,max=500"`
}

type CreateRegistryFederationInviteRequest

type CreateRegistryFederationInviteRequest struct {
	Name             string `json:"name" validate:"required,min=2,max=120"`
	APIBaseURL       string `json:"api_base_url" validate:"required,url,max=500"`
	BearerToken      string `json:"bearer_token,omitempty" validate:"omitempty,min=8,max=4096"`
	ExpiresInSeconds int32  `json:"expires_in_seconds,omitempty" validate:"omitempty,min=60,max=604800"`
}

type CreateRegistryListingRequest

type CreateRegistryListingRequest struct {
	RegistryListingID    string   `json:"registry_listing_id,omitempty" validate:"omitempty,uuid"`
	RegistryNodeID       string   `json:"registry_node_id" validate:"required,uuid"`
	AgentID              string   `json:"agent_id" validate:"required,uuid"`
	RoutingMode          string   `json:"routing_mode,omitempty" validate:"omitempty,oneof=direct_endpoint pull_proxy"`
	PayloadPolicy        string   `json:"payload_policy,omitempty" validate:"omitempty,oneof=metadata_only store_run_summary store_full_payload"`
	PayloadRedactionKeys []string `json:"payload_redaction_keys,omitempty" validate:"omitempty,max=20,dive,min=1,max=80"`
}

type CreateRegistryPeerRequest

type CreateRegistryPeerRequest struct {
	Name          string `json:"name" validate:"required,min=2,max=120"`
	APIBaseURL    string `json:"api_base_url" validate:"required,url,max=500"`
	BearerToken   string `json:"bearer_token" validate:"required,min=8,max=4096"`
	InitialStatus string `json:"initial_status,omitempty" validate:"omitempty,oneof=active paused"`
}

type CreateRemoteProxyRunRequest

type CreateRemoteProxyRunRequest struct {
	RegistryPeerID          string         `json:"registry_peer_id,omitempty" validate:"omitempty,uuid"`
	RemoteAPIBaseURL        string         `json:"remote_api_base_url,omitempty" validate:"omitempty,url,max=500"`
	RemoteBearerToken       string         `json:"remote_bearer_token,omitempty" validate:"omitempty,min=8,max=4096"`
	RemoteRegistryListingID string         `json:"remote_registry_listing_id" validate:"required,uuid"`
	IdempotencyKey          string         `json:"idempotency_key,omitempty" validate:"omitempty,min=8,max=160"`
	Input                   map[string]any `json:"input,omitempty"`
	InputSummary            string         `json:"input_summary,omitempty" validate:"omitempty,max=500"`
}

type ExchangeRegistryFederationInviteRequest

type ExchangeRegistryFederationInviteRequest struct {
	ExchangeURL     string `json:"exchange_url" validate:"required,url,max=600"`
	FederationToken string `json:"federation_token" validate:"required,min=8,max=4096"`
	Name            string `json:"name,omitempty" validate:"omitempty,min=2,max=120"`
	InitialStatus   string `json:"initial_status,omitempty" validate:"omitempty,oneof=active paused"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(svc registryService) *Handler

func (*Handler) ClaimProxyRun

func (h *Handler) ClaimProxyRun(c echo.Context) error

func (*Handler) CompleteProxyRun

func (h *Handler) CompleteProxyRun(c echo.Context) error

func (*Handler) ConsumeRegistryFederationInvite

func (h *Handler) ConsumeRegistryFederationInvite(c echo.Context) error

func (*Handler) CreateNode

func (h *Handler) CreateNode(c echo.Context) error

func (*Handler) CreateProxyRun

func (h *Handler) CreateProxyRun(c echo.Context) error

func (*Handler) CreateRegistryFederationInvite

func (h *Handler) CreateRegistryFederationInvite(c echo.Context) error

func (*Handler) CreateRegistryListing

func (h *Handler) CreateRegistryListing(c echo.Context) error

func (*Handler) CreateRegistryPeer

func (h *Handler) CreateRegistryPeer(c echo.Context) error

func (*Handler) CreateRemoteProxyRun

func (h *Handler) CreateRemoteProxyRun(c echo.Context) error

func (*Handler) DeleteRegistryPeer

func (h *Handler) DeleteRegistryPeer(c echo.Context) error

func (*Handler) DownloadProxyRunArtifact

func (h *Handler) DownloadProxyRunArtifact(c echo.Context) error

func (*Handler) ExchangeRegistryFederationInvite

func (h *Handler) ExchangeRegistryFederationInvite(c echo.Context) error

func (*Handler) GetProxyRun

func (h *Handler) GetProxyRun(c echo.Context) error

func (*Handler) Heartbeat

func (h *Handler) Heartbeat(c echo.Context) error

func (*Handler) ListNodes

func (h *Handler) ListNodes(c echo.Context) error

func (*Handler) ListProxyRunArtifacts

func (h *Handler) ListProxyRunArtifacts(c echo.Context) error

func (*Handler) ListRegistryListings

func (h *Handler) ListRegistryListings(c echo.Context) error

func (*Handler) ListRegistryPeers

func (h *Handler) ListRegistryPeers(c echo.Context) error

func (*Handler) RegisterProtected

func (h *Handler) RegisterProtected(api *echo.Group, jwtMiddleware echo.MiddlewareFunc)

RegisterProtected mounts the first Registry / Bridge control-plane endpoints.

POST   /registry/nodes              create a node identity and return node_secret once
GET    /registry/nodes              list current user's nodes
POST   /registry/nodes/:id/revoke
POST   /registry/nodes/:id/rotate-secret
POST   /registry/nodes/heartbeat    node secret heartbeat
POST   /registry/nodes/metadata-sync node secret metadata sync
POST   /registry/peers              save a trusted remote Registry endpoint
GET    /registry/peers              list trusted remote Registry endpoints
DELETE /registry/peers/:id          remove a trusted remote Registry endpoint
POST   /registry/peers/federation-invitations create a one-time peer exchange token
POST   /registry/peers/federation-invitations/exchange consume a one-time peer exchange token
POST   /registry/peers/federation-exchanges exchange a remote invitation into a local peer
POST   /registry/listings           explicitly expose an Agent through a node
GET    /registry/listings           list current user's explicit listing links
PATCH  /registry/listings/:id/status
POST   /registry/listings/:id/sync
POST   /proxy/runs                  create a pending run for a Registry Listing
POST   /proxy/remote-runs           route to another OpenLinker Registry API
GET    /proxy/runs/:id              inspect a requester-owned Proxy Run
GET    /proxy/runs/:id/artifacts    inspect requester-owned Proxy Run artifacts
GET    /proxy/runs/:id/artifacts/:artifactID/download proxy-download artifact file_uri
GET    /proxy/runs/claim            node secret claim next pending run
POST   /proxy/runs/:id/result       node secret complete a claimed run

func (*Handler) RevokeNode

func (h *Handler) RevokeNode(c echo.Context) error

func (*Handler) RotateNodeSecret

func (h *Handler) RotateNodeSecret(c echo.Context) error

func (*Handler) SyncNodeMetadata

func (h *Handler) SyncNodeMetadata(c echo.Context) error

func (*Handler) SyncRegistryListingMetadata

func (h *Handler) SyncRegistryListingMetadata(c echo.Context) error

func (*Handler) UpdateRegistryListingStatus

func (h *Handler) UpdateRegistryListingStatus(c echo.Context) error

type HeartbeatResponse

type HeartbeatResponse struct {
	NodeID             string `json:"node_id"`
	HeartbeatStatus    string `json:"heartbeat_status"`
	LastHeartbeatAt    string `json:"last_heartbeat_at"`
	LinkedListingCount int32  `json:"linked_listing_count"`
	PendingRunCount    int32  `json:"pending_run_count"`
}

type NodeMetadataSyncResponse

type NodeMetadataSyncResponse struct {
	RegistryNodeID     string `json:"registry_node_id"`
	SyncedListingCount int32  `json:"synced_listing_count"`
	SyncedAt           string `json:"synced_at"`
}

type ProxyRunArtifactDownload

type ProxyRunArtifactDownload struct {
	ArtifactID  string
	FileName    string
	ContentType string
	SizeBytes   int64
	SHA256      string
	Body        []byte
}

type ProxyRunArtifactListResponse

type ProxyRunArtifactListResponse struct {
	ProxyRunID string                     `json:"proxy_run_id"`
	Items      []ProxyRunArtifactResponse `json:"items"`
}

type ProxyRunArtifactResponse

type ProxyRunArtifactResponse struct {
	ID               string         `json:"id"`
	ProxyRunID       string         `json:"proxy_run_id"`
	RegistryRunID    string         `json:"registry_run_id"`
	SourceArtifactID string         `json:"source_artifact_id"`
	ArtifactType     string         `json:"artifact_type"`
	Title            string         `json:"title"`
	Content          map[string]any `json:"content,omitempty"`
	MimeType         string         `json:"mime_type,omitempty"`
	FileURI          string         `json:"file_uri,omitempty"`
	FileName         string         `json:"file_name,omitempty"`
	FileSHA256       string         `json:"file_sha256,omitempty"`
	FileSizeBytes    *int64         `json:"file_size_bytes,omitempty"`
	CreatedAt        string         `json:"created_at"`
}

type ProxyRunResponse

type ProxyRunResponse struct {
	ID                    string         `json:"id"`
	RegistryRunID         string         `json:"registry_run_id"`
	RegistryListingLinkID string         `json:"registry_listing_link_id"`
	RegistryListingID     string         `json:"registry_listing_id"`
	RegistryNodeID        string         `json:"registry_node_id"`
	LocalAgentID          string         `json:"local_agent_id"`
	RequestingUserID      string         `json:"requesting_user_id"`
	IdempotencyKey        string         `json:"idempotency_key"`
	Status                string         `json:"status"`
	PayloadPolicy         string         `json:"payload_policy"`
	Input                 map[string]any `json:"input,omitempty"`
	InputSummary          string         `json:"input_summary,omitempty"`
	Output                map[string]any `json:"output,omitempty"`
	OutputSummary         string         `json:"output_summary,omitempty"`
	ErrorCode             string         `json:"error_code,omitempty"`
	ErrorMessage          string         `json:"error_message,omitempty"`
	AttemptCount          int32          `json:"attempt_count"`
	MaxAttempts           int32          `json:"max_attempts"`
	NextRetryAt           string         `json:"next_retry_at,omitempty"`
	ClaimedAt             string         `json:"claimed_at,omitempty"`
	FinishedAt            string         `json:"finished_at,omitempty"`
	CreatedAt             string         `json:"created_at"`
	UpdatedAt             string         `json:"updated_at"`
}

type ProxyRunWorkerConfig

type ProxyRunWorkerConfig struct {
	Interval time.Duration
	Timeout  time.Duration
}

type RegistryFederationExchangeMaterial

type RegistryFederationExchangeMaterial struct {
	Name           string `json:"name"`
	APIBaseURL     string `json:"api_base_url"`
	BearerToken    string `json:"bearer_token"`
	CredentialHint string `json:"credential_hint"`
	ExpiresAt      string `json:"expires_at"`
}

type RegistryFederationExchangeResponse

type RegistryFederationExchangeResponse struct {
	Peer                 RegistryPeerResponse `json:"peer"`
	ExchangeURL          string               `json:"exchange_url"`
	RemoteCredentialHint string               `json:"remote_credential_hint"`
}

type RegistryFederationInviteResponse

type RegistryFederationInviteResponse struct {
	ID              string `json:"id"`
	Name            string `json:"name"`
	APIBaseURL      string `json:"api_base_url"`
	CredentialHint  string `json:"credential_hint"`
	Status          string `json:"status"`
	TokenPrefix     string `json:"token_prefix,omitempty"`
	FederationToken string `json:"federation_token,omitempty"`
	ExchangeURL     string `json:"exchange_url"`
	ExpiresAt       string `json:"expires_at"`
	ConsumedAt      string `json:"consumed_at,omitempty"`
	CreatedAt       string `json:"created_at"`
	UpdatedAt       string `json:"updated_at"`
}

type RegistryListingLinkResponse

type RegistryListingLinkResponse struct {
	ID                   string   `json:"id"`
	RegistryListingID    string   `json:"registry_listing_id"`
	RegistryNodeID       string   `json:"registry_node_id"`
	NodeName             string   `json:"node_name"`
	AgentID              string   `json:"agent_id"`
	AgentSlug            string   `json:"agent_slug"`
	AgentName            string   `json:"agent_name"`
	AgentDescription     string   `json:"agent_description,omitempty"`
	AgentTags            []string `json:"agent_tags,omitempty"`
	AvailabilityStatus   string   `json:"availability_status"`
	MetadataSyncedAt     string   `json:"metadata_synced_at,omitempty"`
	MetadataSyncError    string   `json:"metadata_sync_error,omitempty"`
	RoutingMode          string   `json:"routing_mode"`
	PayloadPolicy        string   `json:"payload_policy"`
	PayloadRedactionKeys []string `json:"payload_redaction_keys,omitempty"`
	SyncStatus           string   `json:"sync_status"`
	LastSyncAt           string   `json:"last_sync_at"`
	CreatedAt            string   `json:"created_at"`
	UpdatedAt            string   `json:"updated_at"`
}

type RegistryListingListResponse

type RegistryListingListResponse struct {
	Items []RegistryListingLinkResponse `json:"items"`
}

type RegistryNodeListResponse

type RegistryNodeListResponse struct {
	Items []RegistryNodeResponse `json:"items"`
}

type RegistryNodeResponse

type RegistryNodeResponse struct {
	ID              string   `json:"id"`
	NodeName        string   `json:"node_name"`
	NodeType        string   `json:"node_type"`
	BaseURL         string   `json:"base_url,omitempty"`
	SecretPrefix    string   `json:"secret_prefix"`
	NodeSecret      string   `json:"node_secret,omitempty"`
	Scopes          []string `json:"scopes"`
	HeartbeatStatus string   `json:"heartbeat_status"`
	LastHeartbeatAt string   `json:"last_heartbeat_at,omitempty"`
	RevokedAt       string   `json:"revoked_at,omitempty"`
	CreatedAt       string   `json:"created_at"`
	UpdatedAt       string   `json:"updated_at"`
}

type RegistryPeerListResponse

type RegistryPeerListResponse struct {
	Items []RegistryPeerResponse `json:"items"`
}

type RegistryPeerResponse

type RegistryPeerResponse struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	APIBaseURL     string `json:"api_base_url"`
	CredentialHint string `json:"credential_hint"`
	Status         string `json:"status"`
	LastUsedAt     string `json:"last_used_at,omitempty"`
	CreatedAt      string `json:"created_at"`
	UpdatedAt      string `json:"updated_at"`
}

type RemoteProxyRunResponse

type RemoteProxyRunResponse struct {
	RemoteAPIBaseURL string           `json:"remote_api_base_url"`
	RegistryPeerID   string           `json:"registry_peer_id,omitempty"`
	RouteMode        string           `json:"route_mode"`
	RemoteRun        ProxyRunResponse `json:"remote_run"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(pool *pgxpool.Pool, cfg ...*config.Config) *Service

func (*Service) ClaimProxyRun

func (s *Service) ClaimProxyRun(ctx context.Context, plaintextSecret string) (*ProxyRunResponse, error)

func (*Service) CompleteProxyRun

func (s *Service) CompleteProxyRun(ctx context.Context, plaintextSecret string, runID uuid.UUID, req *CompleteProxyRunRequest) (*ProxyRunResponse, error)

func (*Service) CreateNode

func (s *Service) CreateNode(ctx context.Context, ownerID uuid.UUID, req *CreateNodeRequest) (*RegistryNodeResponse, error)

func (*Service) CreateProxyRun

func (s *Service) CreateProxyRun(ctx context.Context, requestingUserID uuid.UUID, req *CreateProxyRunRequest) (*ProxyRunResponse, error)

func (*Service) CreateRegistryFederationInvite

func (s *Service) CreateRegistryFederationInvite(ctx context.Context, ownerID uuid.UUID, req *CreateRegistryFederationInviteRequest) (*RegistryFederationInviteResponse, error)

func (*Service) CreateRegistryListing

func (s *Service) CreateRegistryListing(ctx context.Context, ownerID uuid.UUID, req *CreateRegistryListingRequest) (*RegistryListingLinkResponse, error)

func (*Service) CreateRegistryPeer

func (s *Service) CreateRegistryPeer(ctx context.Context, ownerID uuid.UUID, req *CreateRegistryPeerRequest) (*RegistryPeerResponse, error)

func (*Service) CreateRemoteProxyRun

func (s *Service) CreateRemoteProxyRun(ctx context.Context, requestingUserID uuid.UUID, req *CreateRemoteProxyRunRequest) (*RemoteProxyRunResponse, error)

func (*Service) DeleteRegistryPeer

func (s *Service) DeleteRegistryPeer(ctx context.Context, ownerID, peerID uuid.UUID) error

func (*Service) DownloadProxyRunArtifact

func (s *Service) DownloadProxyRunArtifact(ctx context.Context, requestingUserID, runID, artifactID uuid.UUID) (*ProxyRunArtifactDownload, error)

func (*Service) ExchangeRegistryFederationInvite

func (s *Service) ExchangeRegistryFederationInvite(ctx context.Context, ownerID uuid.UUID, req *ExchangeRegistryFederationInviteRequest) (*RegistryFederationExchangeResponse, error)

func (*Service) ExpireStaleProxyRuns

func (s *Service) ExpireStaleProxyRuns(ctx context.Context, staleAfter time.Duration) (int32, error)

func (*Service) GetProxyRun

func (s *Service) GetProxyRun(ctx context.Context, requestingUserID, runID uuid.UUID) (*ProxyRunResponse, error)

func (*Service) Heartbeat

func (s *Service) Heartbeat(ctx context.Context, plaintextSecret string) (*HeartbeatResponse, error)

func (*Service) ListNodes

func (s *Service) ListNodes(ctx context.Context, ownerID uuid.UUID) ([]RegistryNodeResponse, error)

func (*Service) ListProxyRunArtifacts

func (s *Service) ListProxyRunArtifacts(ctx context.Context, requestingUserID, runID uuid.UUID) ([]ProxyRunArtifactResponse, error)

func (*Service) ListRegistryListings

func (s *Service) ListRegistryListings(ctx context.Context, ownerID uuid.UUID) ([]RegistryListingLinkResponse, error)

func (*Service) ListRegistryPeers

func (s *Service) ListRegistryPeers(ctx context.Context, ownerID uuid.UUID) ([]RegistryPeerResponse, error)

func (*Service) RevokeNode

func (s *Service) RevokeNode(ctx context.Context, ownerID, nodeID uuid.UUID) (*RegistryNodeResponse, error)

func (*Service) RotateNodeSecret

func (s *Service) RotateNodeSecret(ctx context.Context, ownerID, nodeID uuid.UUID) (*RegistryNodeResponse, error)

func (*Service) SetHTTPClientsForTest

func (s *Service) SetHTTPClientsForTest(remote, artifact *http.Client)

func (*Service) SyncNodeMetadata

func (s *Service) SyncNodeMetadata(ctx context.Context, plaintextSecret string) (*NodeMetadataSyncResponse, error)

func (*Service) SyncRegistryListingMetadata

func (s *Service) SyncRegistryListingMetadata(ctx context.Context, ownerID, registryListingID uuid.UUID) (*RegistryListingLinkResponse, error)

func (*Service) UpdateRegistryListingStatus

func (s *Service) UpdateRegistryListingStatus(ctx context.Context, ownerID, registryListingID uuid.UUID, req *UpdateRegistryListingStatusRequest) (*RegistryListingLinkResponse, error)

type UpdateRegistryListingStatusRequest

type UpdateRegistryListingStatusRequest struct {
	SyncStatus string `json:"sync_status" validate:"required,oneof=linked paused"`
}

Jump to

Keyboard shortcuts

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