Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) ContainerCreate(ctx context.Context, cfg *ContainerConfig, name string) (string, error)
- func (c *Client) ContainerList(ctx context.Context, labelKey, labelValue string) ([]string, error)
- func (c *Client) ContainerLogs(ctx context.Context, containerID string) (io.Reader, error)
- func (c *Client) ContainerLogsFollow(ctx context.Context, containerID string) (io.ReadCloser, error)
- func (c *Client) ContainerRemove(ctx context.Context, containerID string) error
- func (c *Client) ContainerStart(ctx context.Context, containerID string) error
- func (c *Client) ContainerWait(ctx context.Context, containerID string) (<-chan WaitResponse, <-chan error)
- func (c *Client) CopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader) error
- func (c *Client) ImageBuild(ctx context.Context, contextDir, tag string) error
- func (c *Client) ImageList(ctx context.Context, imageName string) ([]string, error)
- func (c *Client) ImagePull(ctx context.Context, imageName string) error
- type ContainerConfig
- type DockerClient
- type DockerRunner
- type Runner
- type WaitResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements DockerClient by delegating to the Docker SDK.
func (*Client) ContainerCreate ¶
func (c *Client) ContainerCreate(ctx context.Context, cfg *ContainerConfig, name string) (string, error)
ContainerCreate creates a new Docker container from the given config.
func (*Client) ContainerList ¶
ContainerList returns the IDs of containers matching the given label.
func (*Client) ContainerLogs ¶
ContainerLogs retrieves the container's stdout/stderr logs after it exits. It demultiplexes the Docker stream so the caller receives clean output bytes.
func (*Client) ContainerLogsFollow ¶ added in v0.1.28
func (c *Client) ContainerLogsFollow(ctx context.Context, containerID string) (io.ReadCloser, error)
ContainerLogsFollow follows the container's stdout/stderr logs in real-time. The returned ReadCloser streams log output as it is produced. The caller must close the reader when done.
func (*Client) ContainerRemove ¶
ContainerRemove forcefully removes the specified container.
func (*Client) ContainerStart ¶
ContainerStart starts the specified container.
func (*Client) ContainerWait ¶
func (c *Client) ContainerWait(ctx context.Context, containerID string) (<-chan WaitResponse, <-chan error)
ContainerWait waits for the container to reach a "not-running" state and converts the Docker SDK response into our WaitResponse type.
func (*Client) CopyToContainer ¶ added in v0.1.56
func (c *Client) CopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader) error
CopyToContainer copies a tar archive into the container at the given path.
func (*Client) ImageBuild ¶
ImageBuild builds a Docker image from the given context directory.
type ContainerConfig ¶
type ContainerConfig struct {
Image string
MemoryMB int64
CPUs float64
Env []string
Cmd []string
Binds []string
WorkingDir string
GroupAdd []string
}
ContainerConfig holds settings for creating a container.
type DockerClient ¶
type DockerClient interface {
ContainerCreate(ctx context.Context, cfg *ContainerConfig, name string) (string, error)
ContainerStart(ctx context.Context, containerID string) error
ContainerLogs(ctx context.Context, containerID string) (io.Reader, error)
ContainerLogsFollow(ctx context.Context, containerID string) (io.ReadCloser, error)
ContainerWait(ctx context.Context, containerID string) (<-chan WaitResponse, <-chan error)
ContainerRemove(ctx context.Context, containerID string) error
ImageList(ctx context.Context, image string) ([]string, error)
ImagePull(ctx context.Context, image string) error
ImageBuild(ctx context.Context, contextDir, tag string) error
ContainerList(ctx context.Context, labelKey, labelValue string) ([]string, error)
CopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader) error
}
DockerClient abstracts the Docker SDK methods used by DockerRunner.
type DockerRunner ¶
type DockerRunner struct {
// contains filtered or unexported fields
}
DockerRunner implements Runner using Docker containers.
func NewDockerRunner ¶
func NewDockerRunner(client DockerClient, cfg *config.Config) *DockerRunner
NewDockerRunner creates a new DockerRunner with the given Docker client and config.
func (*DockerRunner) Cleanup ¶
func (r *DockerRunner) Cleanup(ctx context.Context) error
Cleanup removes any lingering containers with the loop-agent label.
func (*DockerRunner) Run ¶
func (r *DockerRunner) Run(ctx context.Context, req *agent.AgentRequest) (*agent.AgentResponse, error)
Run executes an agent request in a Docker container. If a session ID is set and the run fails, it retries with --resume using only the original prompt (no full message history rebuild).
type Runner ¶
type Runner interface {
Run(ctx context.Context, req *agent.AgentRequest) (*agent.AgentResponse, error)
Cleanup(ctx context.Context) error
}
Runner executes agent requests inside containers.
type WaitResponse ¶
WaitResponse represents the result of waiting for a container to finish.