handlers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateExecution

func CreateExecution(r *runner.Runner) gin.HandlerFunc

CreateExecution handles POST /v1/executions. It parses the request body, invokes the runner synchronously, and returns the full RunResult JSON. The "skill" field is required; "version" defaults to "latest" if omitted.

func DeleteSkill

func DeleteSkill(reg *registry.Registry, s *store.Store) gin.HandlerFunc

DeleteSkill handles DELETE /v1/skills/:name/:version. It removes the skill from both the registry and the metadata store, then returns 204 No Content.

func GetExecution

func GetExecution(s *store.Store) gin.HandlerFunc

GetExecution handles GET /v1/executions/:id. It retrieves an execution record from the store and enforces tenant isolation: the caller's tenant must match the execution's tenant.

func GetExecutionLogs

func GetExecutionLogs(s *store.Store) gin.HandlerFunc

GetExecutionLogs handles GET /v1/executions/:id/logs. It returns just the logs field as plain text.

func GetSkill

func GetSkill(reg *registry.Registry, s *store.Store) gin.HandlerFunc

GetSkill handles GET /v1/skills/:name/:version. It downloads the skill zip from the registry, parses SKILL.md, and returns the full metadata including the SKILL.md body content (instructions). When version is "latest", it resolves to the most recently uploaded version via the database before downloading from the registry.

func Health

func Health(s *store.Store) gin.HandlerFunc

Health returns a liveness handler that always responds 200 OK if the process is running. Load balancers and orchestrators use this to determine whether to route traffic to the instance.

func ListSkills

func ListSkills(s *store.Store, reg *registry.Registry) gin.HandlerFunc

ListSkills handles GET /v1/skills. It returns all skill metadata for the authenticated tenant, including descriptions so agents can decide which skill to use.

func Ready

func Ready(s *store.Store) gin.HandlerFunc

Ready returns a readiness handler that checks all downstream dependencies (Postgres, etc.) and reports whether the instance can serve requests. Orchestrators use this to decide when to add the instance to the load balancer pool.

func UploadSkill

func UploadSkill(reg *registry.Registry, s *store.Store, cfg *config.Config) gin.HandlerFunc

UploadSkill handles POST /v1/skills.

It accepts skill zip data via two content types:

  • application/zip: raw zip body
  • multipart/form-data: zip in a "file" form field

The zip is validated (must contain SKILL.md with valid frontmatter), then uploaded to the registry. Skill metadata is also persisted in PostgreSQL so that list operations can return descriptions without downloading every zip archive. Returns 201 with skill metadata on success.

Types

type FilesHandler added in v0.2.0

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

FilesHandler groups the handler methods for the /v1/files endpoints.

func NewFilesHandler added in v0.2.0

func NewFilesHandler(st *store.Store, col *artifacts.Collector) *FilesHandler

NewFilesHandler creates a new FilesHandler with the given store and artifact collector dependencies.

func (*FilesHandler) Delete added in v0.2.0

func (h *FilesHandler) Delete(c *gin.Context)

Delete handles DELETE /v1/files/:id. It removes the file record from the database and the object from S3.

func (*FilesHandler) Download added in v0.2.0

func (h *FilesHandler) Download(c *gin.Context)

Download handles GET /v1/files/:id/download. It streams the file content from S3/MinIO directly to the client.

func (*FilesHandler) Get added in v0.2.0

func (h *FilesHandler) Get(c *gin.Context)

Get handles GET /v1/files/:id. It retrieves a single file record and enforces tenant isolation.

func (*FilesHandler) List added in v0.2.0

func (h *FilesHandler) List(c *gin.Context)

List handles GET /v1/files. It returns files matching the query parameters for the authenticated tenant, with pagination via limit and offset.

func (*FilesHandler) Update added in v0.2.0

func (h *FilesHandler) Update(c *gin.Context)

Update handles PUT /v1/files/:id. It accepts a multipart form upload with a "file" field, uploads the new content to S3, and creates a new version record linked to the original via parent_id.

func (*FilesHandler) Versions added in v0.2.0

func (h *FilesHandler) Versions(c *gin.Context)

Versions handles GET /v1/files/:id/versions. It returns all versions of the file, ordered by version descending.

Jump to

Keyboard shortcuts

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