control

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package control is the control socket of aicoded dev: JSON over HTTP/1.1 on a Unix socket in the workspace's private state folder, through which aicoded mcp and a second aicoded dev reach the running one.

Index

Constants

View Source
const Protocol = "1"

Protocol is the version of the control protocol. Every request and answer carries it in the Aicoded-Control header.

Variables

This section is empty.

Functions

func AlreadyRunning

func AlreadyRunning(st devapi.Status) error

AlreadyRunning is the E-DEV-012 error for the aicoded dev whose status is st.

func Listen

func Listen(ctx context.Context, path string) (net.Listener, error)

Listen serves the control socket at path. It fails with E-DEV-012 when an aicoded dev answers there, or something listens there without answering within 2 s, and with E-DEV-013 when an aicoded dev of another version answers. It removes a socket that nothing listens on, refuses any other file at path with E-DEV-016 and a path too long for a socket with E-DEV-017, and gives the socket mode 0600.

func Serve

func Serve(ctx context.Context, l net.Listener, b devapi.Backend) error

Serve answers the requests that reach l from b until ctx is done, then waits up to 5 s for the requests in flight.

func SocketPath

func SocketPath(state string) string

SocketPath returns the path of the control socket in the state folder state.

Types

type Client

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

Client reaches an aicoded dev through its control socket.

func Dial

func Dial(path string) *Client

Dial returns a client of the control socket at path. It connects for each request.

func (*Client) Logs

func (c *Client) Logs(ctx context.Context, q devapi.LogQuery) ([]devapi.LogEntry, error)

func (*Client) Mail

func (c *Client) Mail(ctx context.Context, app string) ([]devapi.MailSummary, error)

func (*Client) MailGet

func (c *Client) MailGet(ctx context.Context, app, id string) (devapi.Mail, error)

func (*Client) MailReceive

func (c *Client) MailReceive(ctx context.Context, app string, m devapi.InboundMail) (string, error)

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping asks for the status and fails with E-DEV-013 when the aicoded dev there speaks another protocol.

func (*Client) Restart

func (c *Client) Restart(ctx context.Context, app string) (devapi.App, error)

func (*Client) Status

func (c *Client) Status(ctx context.Context) (devapi.Status, error)

func (*Client) Trace

func (c *Client) Trace(ctx context.Context, id string) (devapi.Trace, error)

func (*Client) Traces

func (*Client) WhatBroke

func (c *Client) WhatBroke(ctx context.Context, app string) (devapi.Broken, error)

Jump to

Keyboard shortcuts

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