Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAvailable = errors.New("ticket not available")

ErrNotAvailable is returned when a ticket claim fails with 409 Conflict.

View Source
var ErrNotOwner = errors.New("ticket not owned by this shem")

ErrNotOwner is returned when a phase update is rejected because this shem no longer owns the ticket (e.g. after a requeue).

Functions

This section is empty.

Types

type AssignedTicket

type AssignedTicket struct {
	TicketID   string `json:"ticket_id"`
	Phase      string `json:"phase"`
	RepoRemote string `json:"repo_remote"`
}

AssignedTicket is a lightweight summary of a ticket assigned to this shem.

type ClaimResponse

type ClaimResponse struct {
	TicketID        string        `json:"ticket_id"`
	Branch          string        `json:"branch"`
	Title           string        `json:"title"`
	RepoRemote      string        `json:"repo_remote"`
	Description     string        `json:"description"`
	CheckpointPhase *string       `json:"checkpoint_phase"`
	CheckpointSHA   *string       `json:"checkpoint_sha"`
	LogEntries      []db.LogEntry `json:"log_entries"`
}

ClaimResponse is the response from claiming a ticket.

type Client

type Client struct {
	RetryInitial  time.Duration
	RetryFactor   float64
	RetryMax      time.Duration
	RetryAttempts int
	// contains filtered or unexported fields
}

Client is the HTTP client for orchestrator API calls.

func New

func New(baseURL, apiKey, name string) *Client

New creates a new Client with the given base URL, API key, and shem name.

func (*Client) AckInput

func (c *Client) AckInput(ticketID string, inputID uint) error

AckInput resolves a human input with an empty response.

func (*Client) ClaimRevision

func (c *Client) ClaimRevision(id string) (*ClaimResponse, error)

ClaimRevision resumes work on a ticket already assigned to this shem that is in the revising phase (triggered by a ticket_revise push). A 409 (already picked up, or requeued in the meantime) maps to ErrNotAvailable, same log-and-skip semantics as ClaimTicket.

func (*Client) ClaimTicket

func (c *Client) ClaimTicket(id string) (*ClaimResponse, error)

ClaimTicket claims a ticket for this shem.

func (*Client) Deregister

func (c *Client) Deregister() error

Deregister deregisters this shem from the orchestrator.

func (*Client) GetAssigned

func (c *Client) GetAssigned() ([]AssignedTicket, error)

GetAssigned returns all tickets currently assigned to this shem (any active phase).

func (*Client) GetAvailable

func (c *Client) GetAvailable(repo string) (*string, error)

GetAvailable retrieves the first available ticket for a repo.

func (*Client) GetPendingApproval

func (c *Client) GetPendingApproval(ticketID string) (*PendingInput, error)

GetPendingApproval retrieves the oldest pending approval for a ticket. Returns nil, nil if no pending approval exists.

func (*Client) GetPendingFeedback

func (c *Client) GetPendingFeedback(ticketID string) (*PendingInput, error)

GetPendingFeedback retrieves the oldest unresolved feedback for a ticket. Returns nil, nil if none exists.

func (*Client) GetPendingInput

func (c *Client) GetPendingInput(ticketID string) (*PendingInput, error)

GetPendingInput retrieves the oldest unresolved human input for a ticket. Returns nil, nil if none exists.

func (*Client) GetResumable

func (c *Client) GetResumable() ([]*ClaimResponse, error)

GetResumable returns tickets assigned to this shem that have a checkpoint and were mid-execution when the shem last died.

func (*Client) PostApprovalRequest

func (c *Client) PostApprovalRequest(ticketID string, prompt string) error

PostApprovalRequest posts an approval request for a ticket.

func (*Client) PostCheckpoint

func (c *Client) PostCheckpoint(ticketID string, phase, sha string) error

PostCheckpoint records a checkpoint for a ticket.

func (*Client) PostDocumentFile

func (c *Client) PostDocumentFile(ticketID string, entryType, fromRole, filePath string) (uint, error)

PostDocumentFile streams a file to the orchestrator as a document log entry. The file is sent as a raw body (no JSON wrapping); metadata travels in headers.

func (*Client) PostLog

func (c *Client) PostLog(ticketID string, p LogPayload) (uint, error)

PostLog logs a message to a ticket.

func (*Client) PostPhase

func (c *Client) PostPhase(ticketID string, phase string) error

PostPhase updates the phase of a ticket. Returns ErrNotOwner if the orchestrator rejects the update because this shem no longer owns the ticket (409 Conflict — e.g. after a requeue).

func (*Client) Register

func (c *Client) Register(name string, repos []string) (uint, error)

Register registers this shem with the orchestrator.

type LogPayload

type LogPayload struct {
	EntryType string `json:"entry_type"`
	FromRole  string `json:"from_role"`
	ToRole    string `json:"to_role"`
	Message   string `json:"message"`
	Model     string `json:"model"`
	Backend   string `json:"backend"`
}

LogPayload is the request body for logging.

type PendingInput

type PendingInput struct {
	ID        uint      `json:"id"`
	TicketID  string    `json:"ticket_id"`
	Kind      string    `json:"kind"`
	Prompt    string    `json:"prompt"`
	CreatedAt time.Time `json:"created_at"`
}

PendingInput represents a pending human input.

type WSClient

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

WSClient is a WebSocket client for the orchestrator push channel.

func (*WSClient) Connect

func (wc *WSClient) Connect(url, apiKey, name string) error

Connect establishes a WebSocket connection to the orchestrator.

func (*WSClient) Listen

func (wc *WSClient) Listen(onMsg func(ws.WSMessage)) error

Listen reads messages from the WebSocket and calls onMsg for each message. It runs until an error occurs (typically connection close).

func (*WSClient) SendPing

func (wc *WSClient) SendPing() error

SendPing sends a heartbeat ping to the orchestrator.

Jump to

Keyboard shortcuts

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