Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

fix(docker): upgrade Go and dependencies for improved compatibility and performance

Dmitry Ngccb309a6280b
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 558d4c44..f6bc8210 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -42,7 +42,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v6
with:
- go-version: "1.24"
+ go-version: "1.26.5"
cache: true
cache-dependency-path: backend/go.sum
@@ -115,7 +115,7 @@ jobs:
- name: Backend - Lint
uses: golangci/golangci-lint-action@v9
with:
- version: latest
+ version: v2.12.2
working-directory: backend
args: --timeout=5m --issues-exit-code=0
continue-on-error: true
diff --git a/Dockerfile b/Dockerfile
index 0d3acfba..8a1894f7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -52,7 +52,7 @@ RUN pnpm run build -- \
# ========================================
# Stage 2: Backend Services Compilation
# ========================================
-FROM golang:1.24-bookworm AS api-builder
+FROM golang:1.26-bookworm AS api-builder
# Version injection arguments
ARG PACKAGE_VER=develop
diff --git a/backend/cmd/installer/checker/checker.go b/backend/cmd/installer/checker/checker.go
index a680533f..6d1da441 100644
--- a/backend/cmd/installer/checker/checker.go
+++ b/backend/cmd/installer/checker/checker.go
@@ -11,7 +11,7 @@ import (
"pentagi/cmd/installer/state"
"pentagi/pkg/version"
- "github.com/docker/docker/client"
+ "github.com/moby/moby/client"
)
var (
diff --git a/backend/cmd/installer/checker/helpers.go b/backend/cmd/installer/checker/helpers.go
index b00cd11d..9802d0e4 100644
--- a/backend/cmd/installer/checker/helpers.go
+++ b/backend/cmd/installer/checker/helpers.go
@@ -22,10 +22,7 @@ import (
"pentagi/cmd/installer/state"
- "github.com/docker/docker/api/types/container"
- "github.com/docker/docker/api/types/image"
- "github.com/docker/docker/api/types/volume"
- "github.com/docker/docker/client"
+ "github.com/moby/moby/client"
)
type DockerVersion struct {
@@ -138,9 +135,7 @@ func getProxyURL(appState state.State) string {
}
func createDockerClient(host, certPath string, tlsVerify bool) (*client.Client, error) {
- opts := []client.Opt{
- client.WithAPIVersionNegotiation(),
- }
+ var opts []client.Opt
if host != "" {
opts = append(opts, client.WithHost(host))
@@ -154,7 +149,7 @@ func createDockerClient(host, certPath string, tlsVerify bool) (*client.Client,
))
}
- return client.NewClientWithOpts(opts...)
+ return client.New(opts...)
}
// createDockerClientFromEnv creates a docker client and returns the error type
@@ -165,13 +160,13 @@ func createDockerClientFromEnv(ctx context.Context) (*client.Client, DockerError
return nil, DockerErrorNotInstalled
}
- cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
+ cli, err := client.New(client.FromEnv)
if err != nil {
return nil, DockerErrorAPIError
}
// try to ping the daemon
- _, err = cli.Ping(ctx)
+ _, err = cli.Ping(ctx, client.PingOptions{NegotiateAPIVersion: true})
if err != nil {
cli.Close() // close client on error
// check if it's a connection error (daemon not running)
@@ -206,7 +201,7 @@ const (
)
func checkDockerVersion(ctx context.Context, cli *client.Client) DockerVersion {
- version, err := cli.ServerVersion(ctx)
+ version, err := cli.ServerVersion(ctx, client.ServerVersionOptions{})
if err != nil {
return DockerVersion{Version: "", Valid: false}
}
@@ -290,12 +285,12 @@ func checkVersionCompatibility(version, minVersion string) bool {
}
func checkContainerExists(ctx context.Context, cli *client.Client, name string) (exists, running bool) {
- containers, err := cli.ContainerList(ctx, container.ListOptions{All: true})
+ containers, err := cli.ContainerList(ctx, client.ContainerListOptions{All: true})
if err != nil {
return false, false
}
- for _, cont := range containers {
+ for _, cont := range containers.Items {
for _, containerName := range cont.Names {
if strings.TrimPrefix(containerName, "/") == name {
return true, cont.State == "running"
@@ -313,14 +308,14 @@ func checkVolumesExist(ctx context.Context, cli *client.Client, volumeNames []st
return false
}
- volumes, err := cli.VolumeList(ctx, volume.ListOptions{})
+ volumes, err := cli.VolumeList(ctx, client.VolumeListOptions{})
if err != nil {
return false
}
// collect all volume names from Docker
- existingVolumes := make([]string, 0, len(volumes.Volumes))
- for _, vol := range volumes.Volumes {
+ existingVolumes := make([]string, 0, len(volumes.Items))
+ for _, vol := range volumes.Items {
existingVolumes = append(existingVolumes, vol.Name)
}
@@ -783,12 +778,12 @@ func getNetworkFailures(ctx context.Context, proxyURL string, dockerClient, work
}
func getContainerImageInfo(ctx context.Context, cli *client.Client, containerName string) *ImageInfo {
- containers, err := cli.ContainerList(ctx, container.ListOptions{All: true})
+ containers, err := cli.ContainerList(ctx, client.ContainerListOptions{All: true})
if err != nil {
return nil
}
- for _, cont := range containers {
+ for _, cont := range containers.Items {
for _, name := range cont.Names {
if strings.TrimPrefix(name, "/") == containerName {
return parseImageRef(cont.Image, cont.ImageID)
@@ -809,7 +804,7 @@ func getImageInfo(ctx context.Context, cli *client.Client, imageName string) *Im
return nil
}
- images, err := cli.ImageList(ctx, image.ListOptions{})
+ images, err := cli.ImageList(ctx, client.ImageListOptions{})
if err != nil {
return nil
}
@@ -820,7 +815,7 @@ func getImageInfo(ctx context.Context, cli *client.Client, imageName string) *Im
}
fullImageName := imageInfo.Name + ":" + imageInfo.Tag
- for _, img := range images {
+ for _, img := range images.Items {
for _, tag := range img.RepoTags {
if tag == imageName || tag == fullImageName {
imageInfo.Hash = img.ID
@@ -1011,7 +1006,7 @@ func checkDockerPullConnectivity(ctx context.Context, dockerClient, workerClient
func checkSingleDockerPull(ctx context.Context, cli *client.Client, imageName string) bool {
// try to pull the image
- reader, err := cli.ImagePull(ctx, imageName, image.PullOptions{})
+ reader, err := cli.ImagePull(ctx, imageName, client.ImagePullOptions{})
if err != nil {
return false
}
diff --git a/backend/cmd/installer/processor/docker.go b/backend/cmd/installer/processor/docker.go
index 895f0981..58fca75f 100644
--- a/backend/cmd/installer/processor/docker.go
+++ b/backend/cmd/installer/processor/docker.go
@@ -12,11 +12,8 @@ import (
"pentagi/pkg/tools"
cerrdefs "github.com/containerd/errdefs"
- "github.com/docker/docker/api/types/container"
- "github.com/docker/docker/api/types/image"
- "github.com/docker/docker/api/types/network"
- "github.com/docker/docker/api/types/volume"
- "github.com/docker/docker/client"
+ "github.com/moby/moby/api/types/container"
+ "github.com/moby/moby/client"
)
type dockerOperationsImpl struct {
@@ -59,7 +56,7 @@ func (d *dockerOperationsImpl) removeWorkerContainers(ctx context.Context, state
d.processor.appendLog(MsgRemovingWorkerContainers, ProductStackWorker, state)
- allContainers, err := cli.ContainerList(ctx, container.ListOptions{All: true})
+ allContainers, err := cli.ContainerList(ctx, client.ContainerListOptions{All: true})
if err != nil {
return fmt.Errorf("failed to list worker containers: %w", err)
}
@@ -74,7 +71,7 @@ func (d *dockerOperationsImpl) removeWorkerContainers(ctx context.Context, state
// ever handled the sweep can only ever reach this instance's own containers.
workerPrefix := d.tenantPrefix() + "pentagi-"
var containers []container.Summary
- for _, c := range allContainers {
+ for _, c := range allContainers.Items {
for _, name := range c.Names {
if strings.HasPrefix(name, workerPrefix) {
containers = append(containers, c)
@@ -92,13 +89,13 @@ func (d *dockerOperationsImpl) removeWorkerContainers(ctx context.Context, state
for _, cont := range containers {
if cont.State == "running" {
d.processor.appendLog(fmt.Sprintf(MsgStoppingContainer, cont.ID[:12]), ProductStackWorker, state)
- if err := cli.ContainerStop(ctx, cont.ID, container.StopOptions{}); err != nil {
+ if _, err := cli.ContainerStop(ctx, cont.ID, client.ContainerStopOptions{}); err != nil {
return fmt.Errorf("failed to stop worker container %s: %w", cont.ID, err)
}
}
d.processor.appendLog(fmt.Sprintf(MsgRemovingContainer, cont.ID[:12]), ProductStackWorker, state)
- if err := cli.ContainerRemove(ctx, cont.ID, container.RemoveOptions{
+ if _, err := cli.ContainerRemove(ctx, cont.ID, client.ContainerRemoveOptions{
Force: true,
}); err != nil {
return fmt.Errorf("failed to remove worker container %s: %w", cont.ID, err)
@@ -112,21 +109,21 @@ func (d *dockerOperationsImpl) removeWorkerContainers(ctx context.Context, state
}
func (d *dockerOperationsImpl) removeWorkerImages(ctx context.Context, state *operationState) error {
- return d.removeImages(ctx, state, image.RemoveOptions{
+ return d.removeImages(ctx, state, client.ImageRemoveOptions{
Force: false,
PruneChildren: false,
})
}
func (d *dockerOperationsImpl) purgeWorkerImages(ctx context.Context, state *operationState) error {
- return d.removeImages(ctx, state, image.RemoveOptions{
+ return d.removeImages(ctx, state, client.ImageRemoveOptions{
Force: true,
PruneChildren: true,
})
}
func (d *dockerOperationsImpl) removeImages(
- ctx context.Context, state *operationState, options image.RemoveOptions,
+ ctx context.Context, state *operationState, options client.ImageRemoveOptions,
) error {
if err := d.removeWorkerContainers(ctx, state); err != nil {
return err
@@ -158,19 +155,16 @@ func (d *dockerOperationsImpl) removeImages(
// createMainDockerClient creates docker client for the main stack (non-worker) using current process env
func (d *dockerOperationsImpl) createMainDockerClient() (*client.Client, error) {
- return client.NewClientWithOpts(
- client.FromEnv,
- client.WithAPIVersionNegotiation(),
- )
+ return client.New(client.FromEnv)
}
// checkMainDockerNetwork returns true if a docker network with given name exists
func (d *dockerOperationsImpl) checkMainDockerNetwork(ctx context.Context, cli *client.Client, name string) (bool, error) {
- nets, err := cli.NetworkList(ctx, network.ListOptions{})
+ nets, err := cli.NetworkList(ctx, client.NetworkListOptions{})
if err != nil {
return false, fmt.Errorf("failed to list docker networks: %w", err)
}
- for _, n := range nets {
+ for _, n := range nets.Items {
if n.Name == name {
return true, nil
}
@@ -186,8 +180,9 @@ func (d *dockerOperationsImpl) createMainDockerNetwork(ctx context.Context, cli
}
if exists {
// inspect to validate labels
- nw, err := cli.NetworkInspect(ctx, name, network.InspectOptions{})
+ inspectResult, err := cli.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
if err == nil {
+ nw := inspectResult.Network
wantProject := ""
if envPath := d.processor.state.GetEnvPath(); envPath != "" {
wantProject = filepath.Base(filepath.Dir(envPath))
@@ -204,7 +199,7 @@ func (d *dockerOperationsImpl) createMainDockerNetwork(ctx context.Context, cli
return nil
}
d.processor.appendLog(fmt.Sprintf(MsgRecreatingDockerNetwork, name), ProductStackInstaller, state)
- if err := cli.NetworkRemove(ctx, nw.ID); err != nil {
+ if _, err := cli.NetworkRemove(ctx, nw.ID, client.NetworkRemoveOptions{}); err != nil {
d.processor.appendLog(fmt.Sprintf(MsgDockerNetworkRemoveFailed, name, err), ProductStackInstaller, state)
return fmt.Errorf("failed to remove network %s: %w", name, err)
}
@@ -225,7 +220,7 @@ func (d *dockerOperationsImpl) createMainDockerNetwork(ctx context.Context, cli
labels["com.docker.compose.project"] = projectName
}
// driver: bridge (compose default for local networks)
- _, err = cli.NetworkCreate(ctx, name, network.CreateOptions{
+ _, err = cli.NetworkCreate(ctx, name, client.NetworkCreateOptions{
Driver: "bridge",
Labels: labels,
})
@@ -279,17 +274,21 @@ func (d *dockerOperationsImpl) removeMainDockerNetwork(ctx context.Context, stat
defer cli.Close()
// try inspect; if not found just return
- nw, err := cli.NetworkInspect(ctx, name, network.InspectOptions{})
+ inspectResult, err := cli.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
if err != nil {
return nil
}
// attempt to disconnect all containers first (best effort)
+ nw := inspectResult.Network
for id := range nw.Containers {
- _ = cli.NetworkDisconnect(ctx, nw.ID, id, true)
+ _, _ = cli.NetworkDisconnect(ctx, nw.ID, client.NetworkDisconnectOptions{
+ Container: id,
+ Force: true,
+ })
}
- if err := cli.NetworkRemove(ctx, nw.ID); err != nil {
+ if _, err := cli.NetworkRemove(ctx, nw.ID, client.NetworkRemoveOptions{}); err != nil {
return err
}
d.processor.appendLog(fmt.Sprintf(MsgDockerNetworkRemoved, name), ProductStackInstaller, state)
@@ -308,7 +307,7 @@ func (d *dockerOperationsImpl) removeMainImages(ctx context.Context, state *oper
}
defer cli.Close()
- opts := image.RemoveOptions{Force: state.force, PruneChildren: state.force}
+ opts := client.ImageRemoveOptions{Force: state.force, PruneChildren: state.force}
for _, img := range images {
if img == "" {
continue
@@ -331,7 +330,7 @@ func (d *dockerOperationsImpl) removeWorkerVolumes(ctx context.Context, state *o
}
defer cli.Close()
- vols, err := cli.VolumeList(ctx, volume.ListOptions{})
+ vols, err := cli.VolumeList(ctx, client.VolumeListOptions{})
if err != nil {
return err
}
@@ -341,18 +340,16 @@ func (d *dockerOperationsImpl) removeWorkerVolumes(ctx context.Context, state *o
// its own resources. With TENANT_ID unset this is the original predicate.
workerPrefix := d.tenantPrefix() + tools.PrimaryTerminalNamePrefix
workerSuffix := docker.WorkerVolumeNameSuffix
- for _, v := range vols.Volumes {
+ for _, v := range vols.Items {
if strings.HasPrefix(v.Name, workerPrefix) && strings.HasSuffix(v.Name, workerSuffix) {
- _ = cli.VolumeRemove(ctx, v.Name, true)
+ _, _ = cli.VolumeRemove(ctx, v.Name, client.VolumeRemoveOptions{Force: true})
}
}
return nil
}
func (d *dockerOperationsImpl) createWorkerDockerClient() (*client.Client, error) {
- opts := []client.Opt{
- client.WithAPIVersionNegotiation(),
- }
+ var opts []client.Opt
envVar, exists := d.processor.state.GetVar(client.EnvOverrideHost)
if exists && (envVar.Value != "" || envVar.IsChanged) {
@@ -381,15 +378,15 @@ func (d *dockerOperationsImpl) createWorkerDockerClient() (*client.Client, error
envVar, exists = d.processor.state.GetVar("PENTAGI_" + client.EnvOverrideCertPath)
if exists && (envVar.Value != "" || envVar.IsChanged) {
cfg := getTLSConfig(envVar.Value)
- opts = append(opts, client.WithTLSClientConfig(cfg.certPath, cfg.keyPath, cfg.caPath))
+ opts = append(opts, client.WithTLSClientConfig(cfg.caPath, cfg.certPath, cfg.keyPath))
} else if envVar.Default != "" {
cfg := getTLSConfig(envVar.Default)
- opts = append(opts, client.WithTLSClientConfig(cfg.certPath, cfg.keyPath, cfg.caPath))
+ opts = append(opts, client.WithTLSClientConfig(cfg.caPath, cfg.certPath, cfg.keyPath))
} else {
opts = append(opts, client.WithTLSClientConfigFromEnv())
}
- return client.NewClientWithOpts(opts...)
+ return client.New(opts...)
}
func (d *dockerOperationsImpl) getWorkerDockerEnv() []string {
diff --git a/backend/go.mod b/backend/go.mod
index d0e27329..8768cae4 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -1,14 +1,14 @@
module pentagi
-go 1.24.1
+go 1.26.5
require (
github.com/99designs/gqlgen v0.17.57
- github.com/aws/aws-sdk-go-v2 v1.41.2
+ github.com/aws/aws-sdk-go-v2 v1.41.5
github.com/aws/aws-sdk-go-v2/config v1.32.10
github.com/aws/aws-sdk-go-v2/credentials v1.19.10
- github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0
- github.com/aws/smithy-go v1.24.1
+ github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.4
+ github.com/aws/smithy-go v1.24.2
github.com/caarlos0/env/v10 v10.0.0
github.com/charmbracelet/bubbles v0.21.0
github.com/charmbracelet/bubbletea v1.3.10
@@ -18,10 +18,8 @@ require (
github.com/charmbracelet/x/ansi v0.10.1
github.com/containerd/errdefs v1.0.0
github.com/coreos/go-oidc/v3 v3.11.0
- github.com/creack/pty v1.1.21
+ github.com/creack/pty v1.1.24
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e
- github.com/docker/docker v28.3.3+incompatible
- github.com/docker/go-connections v0.5.0
github.com/docker/go-units v0.5.0
github.com/fatih/color v1.17.0
github.com/gin-contrib/cors v1.7.2
@@ -35,12 +33,14 @@ require (
github.com/gorilla/websocket v1.5.3
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/invopop/jsonschema v0.12.0
- github.com/jackc/pgx/v5 v5.8.0
+ github.com/jackc/pgx/v5 v5.9.2
github.com/jinzhu/gorm v1.9.16
github.com/joho/godotenv v1.5.1
github.com/lib/pq v1.10.9
github.com/mattn/go-runewidth v0.0.16
- github.com/ollama/ollama v0.23.0
+ github.com/moby/moby/api v1.55.0
+ github.com/moby/moby/client v0.5.1
+ github.com/ollama/ollama v0.32.5
github.com/pgvector/pgvector-go v0.1.1
github.com/pressly/goose/v3 v3.19.2
github.com/rivo/uniseg v0.4.7
@@ -54,27 +54,27 @@ require (
github.com/vektah/gqlparser/v2 v2.5.19
github.com/vxcontrol/cloud v0.9.0
github.com/vxcontrol/graphiti-go-client v0.9.0
- github.com/vxcontrol/langchaingo v0.1.14-update.6
+ github.com/vxcontrol/langchaingo v0.1.15-0.20260804113937-da7016e399b0
github.com/wasilibs/go-re2 v1.10.0
github.com/xeipuuv/gojsonschema v1.2.0
- go.opentelemetry.io/otel v1.39.0
+ go.opentelemetry.io/otel v1.43.0
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0
go.opentelemetry.io/otel/log v0.14.0
- go.opentelemetry.io/otel/metric v1.39.0
- go.opentelemetry.io/otel/sdk v1.39.0
+ go.opentelemetry.io/otel/metric v1.43.0
+ go.opentelemetry.io/otel/sdk v1.43.0
go.opentelemetry.io/otel/sdk/log v0.14.0
- go.opentelemetry.io/otel/sdk/metric v1.39.0
- go.opentelemetry.io/otel/trace v1.39.0
- go.opentelemetry.io/proto/otlp v1.9.0
- golang.org/x/crypto v0.46.0
- golang.org/x/net v0.48.0
- golang.org/x/oauth2 v0.34.0
- golang.org/x/sync v0.19.0
- golang.org/x/sys v0.40.0
+ go.opentelemetry.io/otel/sdk/metric v1.43.0
+ go.opentelemetry.io/otel/trace v1.43.0
+ go.opentelemetry.io/proto/otlp v1.10.0
+ golang.org/x/crypto v0.53.0
+ golang.org/x/net v0.56.0
+ golang.org/x/oauth2 v0.36.0
+ golang.org/x/sync v0.21.0
+ golang.org/x/sys v0.46.0
google.golang.org/api v0.238.0
- google.golang.org/grpc v1.79.3
+ google.golang.org/grpc v1.82.1
gopkg.in/yaml.v3 v3.0.1
)
@@ -95,13 +95,13 @@ require (
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
github.com/andybalholm/cascadia v1.3.3 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
- github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 // indirect
+ github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 // indirect
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 // indirect
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 // indirect
@@ -126,7 +126,8 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
- github.com/dlclark/regexp2 v1.11.4 // indirect
+ github.com/dlclark/regexp2 v1.11.5 // indirect
+ github.com/docker/go-connections v0.7.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
@@ -143,7 +144,6 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
- github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/s2a-go v0.1.9 // indirect
@@ -153,7 +153,7 @@ require (
github.com/gorilla/css v1.0.1 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/sessions v1.2.2 // indirect
- github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
@@ -174,7 +174,6 @@ require (
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
- github.com/moby/sys/atomicwriter v0.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
@@ -184,7 +183,6 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
- github.com/pkg/errors v0.9.1 // indirect
github.com/pkoukk/tiktoken-go v0.1.8 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
@@ -209,7 +207,7 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
- github.com/yuin/goldmark v1.7.8 // indirect
+ github.com/yuin/goldmark v1.8.5 // indirect
github.com/yuin/goldmark-emoji v1.0.5 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
gitlab.com/golang-commonmark/html v0.0.0-20191124015941-a22733972181 // indirect
@@ -220,20 +218,18 @@ require (
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
- go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.8.0 // indirect
- golang.org/x/mod v0.30.0 // indirect
- golang.org/x/term v0.38.0 // indirect
- golang.org/x/text v0.32.0 // indirect
+ golang.org/x/mod v0.37.0 // indirect
+ golang.org/x/term v0.44.0 // indirect
+ golang.org/x/text v0.39.0 // indirect
golang.org/x/time v0.12.0 // indirect
- golang.org/x/tools v0.39.0 // indirect
+ golang.org/x/tools v0.47.0 // indirect
google.golang.org/genai v1.42.0 // indirect
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect
- google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
- google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
- google.golang.org/protobuf v1.36.10 // indirect
- gotest.tools/v3 v3.5.1 // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect
+ google.golang.org/protobuf v1.36.11 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
diff --git a/backend/go.sum b/backend/go.sum
index 516d0b7c..0a0da9c8 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -69,28 +69,28 @@ github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
-github.com/aws/aws-sdk-go-v2 v1.41.2 h1:LuT2rzqNQsauaGkPK/7813XxcZ3o3yePY0Iy891T2ls=
-github.com/aws/aws-sdk-go-v2 v1.41.2/go.mod h1:IvvlAZQXvTXznUPfRVfryiG1fbzE2NGK6m9u39YQ+S4=
-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 h1:zWFmPmgw4sveAYi1mRqG+E/g0461cJ5M4bJ8/nc6d3Q=
-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5/go.mod h1:nVUlMLVV8ycXSb7mSkcNu9e3v/1TJq2RTlrPwhYWr5c=
+github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY=
+github.com/aws/aws-sdk-go-v2 v1.41.5/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 h1:eBMB84YGghSocM7PsjmmPffTa+1FBUeNvGvFou6V/4o=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI=
github.com/aws/aws-sdk-go-v2/config v1.32.10 h1:9DMthfO6XWZYLfzZglAgW5Fyou2nRI5CuV44sTedKBI=
github.com/aws/aws-sdk-go-v2/config v1.32.10/go.mod h1:2rUIOnA2JaiqYmSKYmRJlcMWy6qTj1vuRFscppSBMcw=
github.com/aws/aws-sdk-go-v2/credentials v1.19.10 h1:EEhmEUFCE1Yhl7vDhNOI5OCL/iKMdkkYFTRpZXNw7m8=
github.com/aws/aws-sdk-go-v2/credentials v1.19.10/go.mod h1:RnnlFCAlxQCkN2Q379B67USkBMu1PipEEiibzYN5UTE=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 h1:Ii4s+Sq3yDfaMLpjrJsqD6SmG/Wq/P5L/hw2qa78UAY=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18/go.mod h1:6x81qnY++ovptLE6nWQeWrpXxbnlIex+4H4eYYGcqfc=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 h1:F43zk1vemYIqPAwhjTjYIz0irU2EY7sOb/F5eJ3HuyM=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18/go.mod h1:w1jdlZXrGKaJcNoL+Nnrj+k5wlpGXqnNrKoP22HvAug=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 h1:xCeWVjj0ki0l3nruoyP2slHsGArMxeiiaoPN5QZH6YQ=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18/go.mod h1:r/eLGuGCBw6l36ZRWiw6PaZwPXb6YOj+i/7MizNl5/k=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 h1:Rgg6wvjjtX8bNHcvi9OnXWwcE0a2vGpbwmtICOsvcf4=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21/go.mod h1:A/kJFst/nm//cyqonihbdpQZwiUhhzpqTsdbhDdRF9c=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 h1:PEgGVtPoB6NTpPrBgqSE5hE/o47Ij9qk/SEZFbUOe9A=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21/go.mod h1:p+hz+PRAYlY3zcpJhPwXlLC4C+kqn70WIHwnzAfs6ps=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
-github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0 h1:TDKR8ACRw7G+GFaQlhoy6biu+8q6ZtSddQCy9avMdMI=
-github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0/go.mod h1:XlhOh5Ax/lesqN4aZCUgj9vVJed5VoXYHHFYGAlJEwU=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 h1:CeY9LUdur+Dxoeldqoun6y4WtJ3RQtzk0JMP2gfUay0=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5/go.mod h1:AZLZf2fMaahW5s/wMRciu1sYbdsikT/UHwbUjOdEVTc=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 h1:LTRCYFlnnKFlKsyIQxKhJuDuA3ZkrDQMRYm6rXiHlLY=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18/go.mod h1:XhwkgGG6bHSd00nO/mexWTcTjgd6PjuvWQMqSn2UaEk=
+github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.4 h1:W6tKfa/s37faUnwJ71pGqsBO7/wfUX1L7tVprupQGo4=
+github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.4/go.mod h1:BZ+9thH0QOTDUwE8KAv/ZwUzsNC7CSMJXj/wtnZMs5k=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 h1:5EniKhLZe4xzL7a+fU3C2tfUN4nWIqlLesfrjkuPFTY=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7/go.mod h1:x0nZssQ3qZSnIcePWLvcoFisRXJzcTVvYpAAdYX8+GI=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 h1:c31//R3xgIJMSC8S6hEVq+38DcvUlgFY0FM6mSI5oto=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21/go.mod h1:r6+pf23ouCB718FUxaqzZdbpYFyDtehyZcmP5KL9FkA=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 h1:MzORe+J94I+hYu2a6XmV5yC9huoTv8NRcCrUNedDypQ=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6/go.mod h1:hXzcHLARD7GeWnifd8j9RWqtfIgxj4/cAtIVIK7hg8g=
github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 h1:7oGD8KPfBOJGXiCoRKrrrQkbvCp8N++u36hrLMPey6o=
@@ -99,8 +99,8 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 h1:edCcNp9eGIUDUCrzoCu1jWA
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15/go.mod h1:lyRQKED9xWfgkYC/wmmYfv7iVIM68Z5OQ88ZdcV1QbU=
github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 h1:NITQpgo9A5NrDZ57uOWj+abvXSb83BbyggcUBVksN7c=
github.com/aws/aws-sdk-go-v2/service/sts v1.41.7/go.mod h1:sks5UWBhEuWYDPdwlnRFn1w7xWdH29Jcpe+/PJQefEs=
-github.com/aws/smithy-go v1.24.1 h1:VbyeNfmYkWoxMVpGUAbQumkODcYmfMRfZ8yQiH30SK0=
-github.com/aws/smithy-go v1.24.1/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
+github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng=
+github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8=
@@ -153,8 +153,8 @@ github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
-github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 h1:6xNmx7iTtyBRev0+D/Tv1FZd4SCg8axKApyNyRsAt/w=
-github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5/go.mod h1:KdCmV+x/BuvyMxRnYBlmVaq4OLiKW6iRQfvC62cvdkI=
+github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik=
+github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4=
github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8=
github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI=
@@ -171,8 +171,8 @@ github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GK
github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
-github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
-github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
+github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
+github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
@@ -185,14 +185,14 @@ github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e h1:vUmf0yez
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e/go.mod h1:YTIHhz/QFSYnu/EhlF2SpU2Uk+32abacUYA5ZPljz1A=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
-github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
-github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
+github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
+github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg=
github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
-github.com/docker/docker v28.3.3+incompatible h1:Dypm25kh4rmk49v1eiVbsAtpAsYURjYkaKubwuBdxEI=
-github.com/docker/docker v28.3.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
-github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
-github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
+github.com/docker/docker v28.2.2+incompatible h1:CjwRSksz8Yo4+RmQ339Dp/D2tGO5JxwYeqtMOEe0LDw=
+github.com/docker/docker v28.2.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
+github.com/docker/go-connections v0.7.0 h1:6SsRfJddP22WMrCkj19x9WKjEDTB+ahsdiGYf0mN39c=
+github.com/docker/go-connections v0.7.0/go.mod h1:no1qkHdjq7kLMGUXYAduOhYPSJxxvgWBh7ogVvptn3Q=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
@@ -204,10 +204,10 @@ github.com/elastic/go-sysinfo v1.11.2/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJ
github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0=
github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss=
github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA=
-github.com/envoyproxy/go-control-plane/envoy v1.36.0 h1:yg/JjO5E7ubRyKX3m07GF3reDNEnfOboJ0QySbH736g=
-github.com/envoyproxy/go-control-plane/envoy v1.36.0/go.mod h1:ty89S1YCCVruQAm9OtKeEkQLTb+Lkz0k8v9W0Oxsv98=
-github.com/envoyproxy/protoc-gen-validate v1.3.0 h1:TvGH1wof4H33rezVKWSpqKz5NXWg5VPuZ0uONDT6eb4=
-github.com/envoyproxy/protoc-gen-validate v1.3.0/go.mod h1:HvYl7zwPa5mffgyeTUHA9zHIH36nmrm7oCbo4YKoSWA=
+github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ=
+github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A=
+github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds=
+github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
@@ -342,8 +342,8 @@ github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8L
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLWMC+vZCkfs+FHv1Vg=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
@@ -358,8 +358,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
-github.com/jackc/pgx/v5 v5.8.0 h1:TYPDoleBBme0xGSAX3/+NujXXtpZn9HBONkQC7IEZSo=
-github.com/jackc/pgx/v5 v5.8.0/go.mod h1:QVeDInX2m9VyzvNeiCJVjCkNFqzsNb43204HshNSZKw=
+github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw=
+github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
@@ -382,8 +382,6 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
-github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
-github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw=
github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
@@ -450,10 +448,12 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ=
github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo=
+github.com/moby/moby/api v1.55.0 h1:2/sexvQyqIWS8pRSCFddBfpW2qE7vR7FCL+vN8pxwMc=
+github.com/moby/moby/api v1.55.0/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs=
+github.com/moby/moby/client v0.5.1 h1:tYNaJno4c0HXz12y5BiqEDy0rVTYkWzI26lGvnTMiJw=
+github.com/moby/moby/client v0.5.1/go.mod h1:odLstlZ6uSnfvAgVxMpvgmb8SUdd+siH2T0GBuxVAlM=
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
-github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw=
-github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs=
github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU=
github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko=
github.com/moby/sys/user v0.4.0 h1:jhcMKit7SA80hivmFJcbB1vqmw//wU61Zdui2eQXuMs=
@@ -483,8 +483,8 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/nikolalohinski/gonja v1.5.3 h1:GsA+EEaZDZPGJ8JtpeGN78jidhOlxeJROpqMT9fTj9c=
github.com/nikolalohinski/gonja v1.5.3/go.mod h1:RmjwxNiXAEqcq1HeK5SSMmqFJvKOfTfXhkJv6YBtPa4=
-github.com/ollama/ollama v0.23.0 h1:13V15B9Pkwl+WAaaU90NW6vik54dYgPhVrdjtw+dqck=
-github.com/ollama/ollama v0.23.0/go.mod h1:274niu48upWz/M7vL53i1WFe+TJRRw5oo4GiacbIYrA=
+github.com/ollama/ollama v0.32.5 h1:5jeKnTJmDTR+xgB8qh68szdXM9zwnMBMtGl890frdzo=
+github.com/ollama/ollama v0.32.5/go.mod h1:b1ydCt2oVg0VAg22WWDgCbwW0AyOaRKAFzlS91NI4OY=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
@@ -632,8 +632,8 @@ github.com/vxcontrol/cloud v0.9.0 h1:p7xYTgUctbY8w6YfhugNzvfi3/0EQoZGumMe67keAng
github.com/vxcontrol/cloud v0.9.0/go.mod h1:AeiQFqiMgJJAXy6FYXtDS2a3P/PMB56iiBNY2vGrZhQ=
github.com/vxcontrol/graphiti-go-client v0.9.0 h1:3GxpFmQoHmz/d7/9tyEqD8+S99v2cuqG1UEmrbAFrLU=
github.com/vxcontrol/graphiti-go-client v0.9.0/go.mod h1:6UHL5uqAKp4KAdziva4qgcAxFtBzU05Hm/BAo4NkAuo=
-github.com/vxcontrol/langchaingo v0.1.14-update.6 h1:Ln/Q+SW7hpklrY42CGuJTzI3Y9Xun7LeWZhHo3Vamjk=
-github.com/vxcontrol/langchaingo v0.1.14-update.6/go.mod h1:Lpk9Nc9N7B3/CuMy2Ay9c68Xh/AQhPABG1NH3cFI+sE=
+github.com/vxcontrol/langchaingo v0.1.15-0.20260804113937-da7016e399b0 h1:ZQnT4AUmTiz1mweuQdW+CR/51hQN7z0S248BEgDRXhs=
+github.com/vxcontrol/langchaingo v0.1.15-0.20260804113937-da7016e399b0/go.mod h1:z3q8al4gf+NAlEEiCXxtBzr0JSU/aEWhi3S8oi4gaGs=
github.com/wasilibs/go-re2 v1.10.0 h1:vQZEBYZOCA9jdBMmrO4+CvqyCj0x4OomXTJ4a5/urQ0=
github.com/wasilibs/go-re2 v1.10.0/go.mod h1:k+5XqO2bCJS+QpGOnqugyfwC04nw0jaglmjrrkG8U6o=
github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4=
@@ -657,12 +657,10 @@ github.com/ydb-platform/ydb-go-genproto v0.0.0-20240126124512-dbb0e1720dbf h1:ck
github.com/ydb-platform/ydb-go-genproto v0.0.0-20240126124512-dbb0e1720dbf/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I=
github.com/ydb-platform/ydb-go-sdk/v3 v3.55.1 h1:Ebo6J5AMXgJ3A438ECYotA0aK7ETqjQx9WoZvVxzKBE=
github.com/ydb-platform/ydb-go-sdk/v3 v3.55.1/go.mod h1:udNPW8eupyH/EZocecFmaSNJacKKYjzQa7cVgX5U2nc=
-github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
-github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
-github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
+github.com/yuin/goldmark v1.8.5 h1:r6N5afV5qj/5S4UTch8agZHJ8UxNCMwX7WjkkJam2NA=
+github.com/yuin/goldmark v1.8.5/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC4cIk=
github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
@@ -685,34 +683,32 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.6
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q=
-go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
-go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
+go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
+go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 h1:OMqPldHt79PqWKOMYIAQs3CxAi7RLgPxwfFSwr4ZxtM=
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0/go.mod h1:1biG4qiqTxKiUCtoWDPpL3fB3KxVwCiGw81j3nKMuHE=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0 h1:cEf8jF6WbuGQWUVcqgyWtTR0kOOAWY1DYZ+UhvdmQPw=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0/go.mod h1:k1lzV5n5U3HkGvTCJHraTAGJ7MqsgL1wrGwTj1Isfiw=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 h1:f0cb2XPmrqn4XMy9PNliTgRKJgS5WcL/u0/WRYGz4t0=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0/go.mod h1:vnakAaFckOMiMtOIhFI2MNH4FYrZzXCYxmb1LlhoGz8=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 h1:88Y4s2C8oTui1LGM6bTWkw0ICGcOLCAI5l6zsD1j20k=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0/go.mod h1:Vl1/iaggsuRlrHf/hfPJPvVag77kKyvrLeD10kpMl+A=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 h1:in9O8ESIOlwJAEGTkkf34DesGRAc/Pn8qJ7k3r/42LM=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0/go.mod h1:Rp0EXBm5tfnv0WL+ARyO/PHBEaEAT8UUHQ6AGJcSq6c=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 h1:wpMfgF8E1rkrT1Z6meFh1NDtownE9Ii3n3X2GJYjsaU=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0/go.mod h1:wAy0T/dUbs468uOlkT31xjvqQgEVXv58BRFWEgn5v/0=
go.opentelemetry.io/otel/log v0.14.0 h1:2rzJ+pOAZ8qmZ3DDHg73NEKzSZkhkGIua9gXtxNGgrM=
go.opentelemetry.io/otel/log v0.14.0/go.mod h1:5jRG92fEAgx0SU/vFPxmJvhIuDU9E1SUnEQrMlJpOno=
-go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
-go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
-go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18=
-go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE=
+go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
+go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
+go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
+go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=
go.opentelemetry.io/otel/sdk/log v0.14.0 h1:JU/U3O7N6fsAXj0+CXz21Czg532dW2V4gG1HE/e8Zrg=
go.opentelemetry.io/otel/sdk/log v0.14.0/go.mod h1:imQvII+0ZylXfKU7/wtOND8Hn4OpT3YUoIgqJVksUkM=
go.opentelemetry.io/otel/sdk/log/logtest v0.14.0 h1:Ijbtz+JKXl8T2MngiwqBlPaHqc4YCaP/i13Qrow6gAM=
go.opentelemetry.io/otel/sdk/log/logtest v0.14.0/go.mod h1:dCU8aEL6q+L9cYTqcVOk8rM9Tp8WdnHOPLiBgp0SGOA=
-go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8=
-go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew=
-go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
-go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
-go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A=
-go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4=
+go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
+go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
+go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
+go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
+go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
+go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg=
go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
@@ -724,27 +720,23 @@ golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
-golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
-golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
+golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto=
+golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio=
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4=
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk=
-golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
-golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=
-golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc=
+golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ=
+golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -754,9 +746,7 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
-golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
@@ -765,22 +755,20 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
-golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
-golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
-golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
-golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
+golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o=
+golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec=
+golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
+golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
-golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
-golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
+golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM=
+golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -789,7 +777,6 @@ golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -806,8 +793,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
-golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
+golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
+golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -817,8 +804,8 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
-golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q=
-golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
+golang.org/x/term v0.44.0 h1:0rLvDRCtNj0gZkyIXhCyOb2OAzEhLVqc4B+hrsBhrmc=
+golang.org/x/term v0.44.0/go.mod h1:7ze4MdzUzLXpSAoFP1H0bOI9aXDqveSvatT5vKcFh2Y=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -829,8 +816,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
-golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
-golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
+golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus=
+golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
@@ -838,34 +825,30 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
-golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
-golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
-golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
+golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q=
+golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
-gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
+gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
+gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/api v0.238.0 h1:+EldkglWIg/pWjkq97sd+XxH7PxakNYoe/rkSTbnvOs=
google.golang.org/api v0.238.0/go.mod h1:cOVEm2TpdAGHL2z+UwyS+kmlGr3bVWQQ6sYEqkKje50=
google.golang.org/genai v1.42.0 h1:XFHfo0DDCzdzQALZoFs6nowAHO2cE95XyVvFLNaFLRY=
google.golang.org/genai v1.42.0/go.mod h1:A3kkl0nyBjyFlNjgxIwKq70julKbIxpSxqKO5gw/gmk=
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 h1:1tXaIXCracvtsRxSBsYDiSBN0cuJvM7QYW+MrpIRY78=
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:49MsLSx0oWMOZqcpB3uL8ZOkAh1+TndpJ8ONoCBWiZk=
-google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls=
-google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
-google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE=
-google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
-google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
-google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
+google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 h1:yQugLulqltosq0B/f8l4w9VryjV+N/5gcW0jQ3N8Qec=
+google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478/go.mod h1:C6ADNqOxbgdUUeRTU+LCHDPB9ttAMCTff6auwCVa4uc=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 h1:RmoJA1ujG+/lRGNfUnOMfhCy5EipVMyvUE+KNbPbTlw=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
+google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE=
+google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=
+google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
+google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -881,8 +864,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
-gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
+gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
+gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
mellium.im/sasl v0.3.1 h1:wE0LW6g7U83vhvxjC1IY8DnXM+EU095yeo8XClvCdfo=
@@ -904,6 +887,8 @@ modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g=
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
+pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk=
+pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
diff --git a/backend/pkg/controller/flow.go b/backend/pkg/controller/flow.go
index 3ac25518..7936901a 100644
--- a/backend/pkg/controller/flow.go
+++ b/backend/pkg/controller/flow.go
@@ -26,7 +26,7 @@ import (
"pentagi/pkg/resources"
"pentagi/pkg/tools"
- dockercontainer "github.com/docker/docker/api/types/container"
+ "github.com/moby/moby/client"
"github.com/sirupsen/logrus"
)
@@ -744,7 +744,7 @@ func (fw *flowWorker) pushResourcesToContainer(ctx context.Context, addedPaths [
}()
copyErr := fw.docker.CopyToContainer(ctx, containerName, docker.WorkFolderPathInContainer, pr,
- dockercontainer.CopyToContainerOptions{AllowOverwriteDirWithFile: true})
+ client.CopyToContainerOptions{AllowOverwriteDirWithFile: true})
pr.Close()
writeErr := <-errCh
diff --git a/backend/pkg/docker/client.go b/backend/pkg/docker/client.go
index 159a98a7..d78bdd54 100644
--- a/backend/pkg/docker/client.go
+++ b/backend/pkg/docker/client.go
@@ -7,26 +7,24 @@ import (
"fmt"
"hash/crc32"
"io"
+ "net/netip"
"os"
"path"
"path/filepath"
"slices"
"strings"
"sync"
+ "time"
"pentagi/pkg/config"
"pentagi/pkg/database"
cerrdefs "github.com/containerd/errdefs"
- "github.com/docker/docker/api/types"
- "github.com/docker/docker/api/types/container"
- "github.com/docker/docker/api/types/filters"
- "github.com/docker/docker/api/types/image"
- "github.com/docker/docker/api/types/mount"
- "github.com/docker/docker/api/types/network"
- "github.com/docker/docker/api/types/volume"
- "github.com/docker/docker/client"
- "github.com/docker/go-connections/nat"
+ "github.com/moby/moby/api/pkg/stdcopy"
+ "github.com/moby/moby/api/types/container"
+ "github.com/moby/moby/api/types/mount"
+ "github.com/moby/moby/api/types/network"
+ "github.com/moby/moby/client"
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
)
@@ -53,6 +51,23 @@ const (
// compromised sandbox can't stream unbounded output into memory; sized as the
// entry cap × a generous per-path length (PATH_MAX).
maxListStdoutBytes = maxListEntries * 4096
+ // containerStartupGrace is how long a freshly started container has to stay
+ // alive before it is accepted as started. Starting is asynchronous: the
+ // daemon acknowledges the request as soon as the process is spawned, so an
+ // entrypoint that dies milliseconds later still looks like a successful
+ // start. Everything downstream assumes a live sandbox, so it is verified
+ // here instead.
+ containerStartupGrace = 1500 * time.Millisecond
+ // maxStartupLogBytes bounds the output tail attached to a startup failure so
+ // a container that floods its log before dying can't inflate the error.
+ maxStartupLogBytes = 4096
+ // startupLogTailLines is how many trailing log lines are quoted in a startup
+ // failure; enough for a stack trace or a usage message.
+ startupLogTailLines = "20"
+ // containerDiscardTimeout bounds the cleanup of a container that failed to
+ // start, so an unresponsive daemon delays the error instead of withholding
+ // it indefinitely.
+ containerDiscardTimeout = 30 * time.Second
)
type dockerClient struct {
@@ -78,12 +93,12 @@ type DockerClient interface {
StopContainer(ctx context.Context, containerID string, dbID int64) error
RemoveContainer(ctx context.Context, containerID string, dbID int64) error
IsContainerRunning(ctx context.Context, containerID string) (bool, error)
- ContainerExecCreate(ctx context.Context, container string, config container.ExecOptions) (container.ExecCreateResponse, error)
- ContainerExecAttach(ctx context.Context, execID string, config container.ExecAttachOptions) (types.HijackedResponse, error)
- ContainerExecInspect(ctx context.Context, execID string) (container.ExecInspect, error)
+ ContainerExecCreate(ctx context.Context, container string, config client.ExecCreateOptions) (client.ExecCreateResult, error)
+ ContainerExecAttach(ctx context.Context, execID string, config client.ExecAttachOptions) (client.HijackedResponse, error)
+ ContainerExecInspect(ctx context.Context, execID string) (client.ExecInspectResult, error)
ContainerStatPath(ctx context.Context, containerID string, path string) (container.PathStat, error)
ListContainerDir(ctx context.Context, containerID string, dirPath string) (ContainerDirListing, error)
- CopyToContainer(ctx context.Context, containerID string, dstPath string, content io.Reader, options container.CopyToContainerOptions) error
+ CopyToContainer(ctx context.Context, containerID string, dstPath string, content io.Reader, options client.CopyToContainerOptions) error
CopyFromContainer(ctx context.Context, containerID string, srcPath string) (io.ReadCloser, container.PathStat, error)
Cleanup(ctx context.Context) error
GetDefaultImage() string
@@ -104,16 +119,16 @@ func GetPrimaryContainerPorts(portsBase int, flowID int64) []int {
}
func NewDockerClient(ctx context.Context, db database.Querier, cfg *config.Config) (DockerClient, error) {
- cli, err := client.NewClientWithOpts(client.FromEnv)
+ cli, err := client.New(client.FromEnv)
if err != nil {
return nil, fmt.Errorf("failed to initialize docker client: %w", err)
}
- cli.NegotiateAPIVersion(ctx)
- info, err := cli.Info(ctx)
+ infoResult, err := cli.Info(ctx, client.InfoOptions{})
if err != nil {
return nil, fmt.Errorf("failed to get docker info: %w", err)
}
+ info := infoResult.Info
// Resolve which host socket (if any) gets bind-mounted into worker containers.
// Autodetection is skipped when DOCKER_INSIDE_HOST designates a daemon
@@ -306,15 +321,16 @@ func (dc *dockerClient) RunContainer(
}
if hostDir == "" {
- volumeName, err := dc.client.VolumeCreate(ctx, volume.CreateOptions{
+ volumeName, err := dc.client.VolumeCreate(ctx, client.VolumeCreateOptions{
Name: fmt.Sprintf("%s%s", containerName, WorkerVolumeNameSuffix),
Driver: "local",
Labels: dc.labels,
})
if err != nil {
+ defer updateContainerInfo(database.ContainerStatusFailed, "")
return database.Container{}, fmt.Errorf("failed to create volume: %w", err)
}
- hostDir = volumeName.Name
+ hostDir = volumeName.Volume.Name
}
hostConfig.Binds = append(hostConfig.Binds, fmt.Sprintf("%s:%s", hostDir, WorkFolderPathInContainer))
@@ -368,20 +384,32 @@ func (dc *dockerClient) RunContainer(
} else {
// Bridge network mode: configure port bindings and custom network
if hostConfig.PortBindings == nil {
- hostConfig.PortBindings = nat.PortMap{}
+ hostConfig.PortBindings = network.PortMap{}
}
if config.ExposedPorts == nil {
- config.ExposedPorts = nat.PortSet{}
+ config.ExposedPorts = network.PortSet{}
+ }
+ var hostIP netip.Addr
+ if dc.publicIP != "" {
+ var err error
+ hostIP, err = netip.ParseAddr(dc.publicIP)
+ if err != nil {
+ defer updateContainerInfo(database.ContainerStatusFailed, "")
+ return database.Container{}, fmt.Errorf("invalid Docker public IP %q: %w", dc.publicIP, err)
+ }
}
for _, port := range GetPrimaryContainerPorts(dc.portsBase, flowID) {
- natPort := nat.Port(fmt.Sprintf("%d/tcp", port))
- hostConfig.PortBindings[natPort] = []nat.PortBinding{
+ containerPort, ok := network.PortFrom(uint16(port), network.TCP)
+ if !ok {
+ return database.Container{}, fmt.Errorf("invalid container port %d", port)
+ }
+ hostConfig.PortBindings[containerPort] = []network.PortBinding{
{
- HostIP: dc.publicIP,
+ HostIP: hostIP,
HostPort: fmt.Sprintf("%d", port),
},
}
- config.ExposedPorts[natPort] = struct{}{}
+ config.ExposedPorts[containerPort] = struct{}{}
}
if dc.network != "" {
@@ -393,7 +421,28 @@ func (dc *dockerClient) RunContainer(
}
}
- resp, err := dc.client.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, containerName)
+ // Config is referenced by pointer, so a later image fallback is picked up by
+ // the retries below without rebuilding the options.
+ createOptions := client.ContainerCreateOptions{
+ Config: config,
+ HostConfig: hostConfig,
+ NetworkingConfig: networkingConfig,
+ Name: containerName,
+ }
+
+ resp, err := dc.client.ContainerCreate(ctx, createOptions)
+ if err != nil && cerrdefs.IsConflict(err) {
+ // The name is still held by an earlier container, typically one left
+ // behind when PentAGI died mid-start. Nothing can be created under that
+ // name until it is gone, and the image is not at fault, so clear it and
+ // retry before blaming the image below.
+ logger.WithError(err).Warn("container name is already taken, removing the container holding it")
+ if staleErr := dc.removeContainerByName(ctx, containerName); staleErr != nil {
+ logger.WithError(staleErr).Warn("failed to remove the container holding the name")
+ } else {
+ resp, err = dc.client.ContainerCreate(ctx, createOptions)
+ }
+ }
if err != nil {
if config.Image == dc.defImage {
logger.WithError(err).Warn("failed to create container with default image")
@@ -408,24 +457,13 @@ func (dc *dockerClient) RunContainer(
}
// try to cleanup previous container
- containers, err := dc.client.ContainerList(ctx, container.ListOptions{})
- if err != nil {
+ if err := dc.removeContainerByName(ctx, containerName); err != nil {
defer updateContainerInfo(database.ContainerStatusFailed, "")
- return database.Container{}, fmt.Errorf("failed to list containers: %w", err)
- }
- options := container.RemoveOptions{
- RemoveVolumes: true,
- Force: true,
- }
- for _, container := range containers {
- // containerName is unique for PentAGI environment, so we can use it to find the container
- if len(container.Names) > 0 && container.Names[0] == containerName {
- _ = dc.client.ContainerRemove(ctx, container.ID, options)
- }
+ return database.Container{}, err
}
// try to create container again with default image
- resp, err = dc.client.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, containerName)
+ resp, err = dc.client.ContainerCreate(ctx, createOptions)
if err != nil {
defer updateContainerInfo(database.ContainerStatusFailed, "")
return database.Container{}, fmt.Errorf("failed to create container '%s': %w", config.Image, err)
@@ -436,23 +474,259 @@ func (dc *dockerClient) RunContainer(
logger = logger.WithField("local_id", containerID)
logger.Info("container created")
- err = dc.client.ContainerStart(ctx, containerID, container.StartOptions{})
+ // Arm the exit watch before starting. The restart policy replaces a container
+ // that dies with a fresh attempt within milliseconds, and from then on the
+ // daemon reports the state of that new attempt — the status code that
+ // actually killed the sandbox is no longer reachable. Watching from before
+ // the start is what makes it observable at all.
+ waitCtx, cancelWait := context.WithCancel(ctx)
+ defer cancelWait()
+ exitWatch := dc.client.ContainerWait(waitCtx, containerID, client.ContainerWaitOptions{
+ Condition: container.WaitConditionNextExit,
+ })
+
+ _, err = dc.client.ContainerStart(ctx, containerID, client.ContainerStartOptions{})
if err != nil {
defer updateContainerInfo(database.ContainerStatusFailed, containerID)
+ dc.discardContainer(ctx, containerID, logger)
return database.Container{}, fmt.Errorf("failed to start container: %w", err)
}
+ // The start call above only proves the daemon accepted the request. Callers
+ // hand this container straight to the agents, so a sandbox that is already
+ // dead has to be reported here rather than degrade into unrelated exec
+ // failures against a container that never ran.
+ if err := dc.ensureContainerStarted(ctx, containerName, containerID, exitWatch); err != nil {
+ defer updateContainerInfo(database.ContainerStatusFailed, containerID)
+ logger.WithError(err).Error("container did not stay running after start")
+ dc.discardContainer(ctx, containerID, logger)
+ return database.Container{}, err
+ }
+
logger.Info("container started")
updateContainerInfo(database.ContainerStatusRunning, containerID)
return dbContainer, nil
}
+// ContainerStartupError reports a container that the daemon started but that did
+// not stay up. It carries the daemon's own diagnostics together with a tail of
+// the container output, so the reason is visible where the failure surfaces
+// instead of only on the host the sandbox ran on.
+type ContainerStartupError struct {
+ ContainerName string
+ ContainerID string
+ Status string
+ ExitCode int
+ RestartCount int
+ OOMKilled bool
+ DaemonError string
+ LogTail string
+}
+
+func (e *ContainerStartupError) Error() string {
+ message := fmt.Sprintf("container '%s' did not stay running after start (state '%s', exit code %d)",
+ e.ContainerName, e.Status, e.ExitCode)
+ if e.RestartCount > 0 {
+ message += fmt.Sprintf(", restarted %d time(s)", e.RestartCount)
+ }
+ if e.OOMKilled {
+ message += ", terminated by the OOM killer"
+ }
+ if e.DaemonError != "" {
+ message += fmt.Sprintf(", daemon reported: %s", e.DaemonError)
+ }
+ if e.LogTail != "" {
+ message += fmt.Sprintf(", last output: %s", e.LogTail)
+ }
+ return message
+}
+
+// ensureContainerStarted confirms the container is really running. It reports
+// the exit as soon as it happens, and otherwise waits out containerStartupGrace:
+// an entrypoint that dies milliseconds after start would still be acknowledged
+// as a successful start, so surviving the window is the only evidence that the
+// sandbox is usable.
+func (dc *dockerClient) ensureContainerStarted(
+ ctx context.Context,
+ containerName, containerID string,
+ exitWatch client.ContainerWaitResult,
+) error {
+ select {
+ case <-ctx.Done():
+ return fmt.Errorf("interrupted while starting container '%s': %w", containerName, ctx.Err())
+
+ case exit := <-exitWatch.Result:
+ startupErr := dc.newStartupError(ctx, containerName, containerID, int(exit.StatusCode))
+ if exit.Error != nil {
+ startupErr.DaemonError = exit.Error.Message
+ }
+ return startupErr
+
+ case err := <-exitWatch.Error:
+ // The watch itself broke, which says nothing about the container. Ask
+ // the daemon directly rather than assuming either outcome.
+ return dc.verifyContainerRunning(ctx, containerName, containerID, err)
+
+ case <-time.After(containerStartupGrace):
+ // Still alive. Drain the watch so the reader goroutine behind it can
+ // finish once the request is cancelled on the way out.
+ go func() {
+ select {
+ case <-exitWatch.Result:
+ case <-exitWatch.Error:
+ }
+ }()
+ return nil
+ }
+}
+
+// verifyContainerRunning is the fallback for when the exit watch cannot be used:
+// the container state is read directly, so a broken watch degrades into a slower
+// check instead of into a sandbox that is wrongly assumed to be alive.
+func (dc *dockerClient) verifyContainerRunning(
+ ctx context.Context, containerName, containerID string, watchErr error,
+) error {
+ inspectResult, err := dc.client.ContainerInspect(ctx, containerID, client.ContainerInspectOptions{})
+ if err != nil {
+ return fmt.Errorf("failed to check container '%s' after start (exit watch failed: %v): %w",
+ containerName, watchErr, err)
+ }
+
+ inspection := inspectResult.Container
+ state := inspection.State
+ if state == nil {
+ // the daemon always reports state for a container it just started, so
+ // its absence means the container is not in a usable state
+ return fmt.Errorf("no state reported for container '%s' after start", containerName)
+ }
+
+ // A recorded restart is a failure of its own: under the on-failure policy a
+ // crash-looping sandbox keeps coming back up without ever being usable.
+ if state.Running && !state.Restarting && inspection.RestartCount == 0 {
+ return nil
+ }
+
+ startupErr := dc.newStartupError(ctx, containerName, containerID, state.ExitCode)
+ startupErr.DaemonError = state.Error
+ return startupErr
+}
+
+// newStartupError assembles the report for a container that did not stay up,
+// enriching the authoritative exit code with whatever the daemon still knows and
+// with the container's own last words.
+func (dc *dockerClient) newStartupError(
+ ctx context.Context, containerName, containerID string, exitCode int,
+) *ContainerStartupError {
+ startupErr := &ContainerStartupError{
+ ContainerName: containerName,
+ ContainerID: containerID,
+ ExitCode: exitCode,
+ Status: "exited",
+ }
+
+ inspectResult, err := dc.client.ContainerInspect(ctx, containerID, client.ContainerInspectOptions{})
+ if err != nil {
+ return startupErr
+ }
+
+ inspection := inspectResult.Container
+ if state := inspection.State; state != nil {
+ startupErr.Status = string(state.Status)
+ startupErr.OOMKilled = state.OOMKilled
+ }
+ startupErr.RestartCount = inspection.RestartCount
+ startupErr.LogTail = dc.containerLogTail(ctx, containerID, inspection.Config)
+
+ return startupErr
+}
+
+// containerLogTail returns the tail of a container's combined output. It is
+// best effort by design: this only ever enriches a failure that has already been
+// decided, so a log that cannot be read must not replace the real error.
+func (dc *dockerClient) containerLogTail(ctx context.Context, containerID string, config *container.Config) string {
+ logs, err := dc.client.ContainerLogs(ctx, containerID, client.ContainerLogsOptions{
+ ShowStdout: true,
+ ShowStderr: true,
+ Tail: startupLogTailLines,
+ })
+ if err != nil {
+ return ""
+ }
+ defer logs.Close()
+
+ var output bytes.Buffer
+ reader := io.LimitReader(logs, maxStartupLogBytes)
+ if config != nil && config.Tty {
+ // a TTY stream is the raw container output, without stream framing
+ _, _ = io.Copy(&output, reader)
+ } else {
+ // stdout and stderr are interleaved as framed chunks; merge both, since
+ // the reason a container died is usually on stderr
+ _, _ = stdcopy.StdCopy(&output, &output, reader)
+ }
+
+ return strings.TrimSpace(output.String())
+}
+
+// removeContainerByName drops whichever container currently holds the name, so a
+// leftover from an earlier run cannot block every future create with a name
+// conflict. The daemon reports names with a leading slash and omits non-running
+// containers unless all of them are requested, and a stale container is usually
+// exited rather than running.
+func (dc *dockerClient) removeContainerByName(ctx context.Context, containerName string) error {
+ containerList, err := dc.client.ContainerList(ctx, client.ContainerListOptions{
+ All: true,
+ // the name filter matches substrings, so the exact comparison below
+ // still decides; the filter only keeps the listing small
+ Filters: make(client.Filters).Add("name", containerName),
+ })
+ if err != nil {
+ return fmt.Errorf("failed to list containers: %w", err)
+ }
+
+ options := client.ContainerRemoveOptions{
+ RemoveVolumes: true,
+ Force: true,
+ }
+ for _, existing := range containerList.Items {
+ if !slices.ContainsFunc(existing.Names, func(name string) bool {
+ return strings.TrimPrefix(name, "/") == containerName
+ }) {
+ continue
+ }
+
+ if _, err := dc.client.ContainerRemove(ctx, existing.ID, options); err != nil && !cerrdefs.IsNotFound(err) {
+ return fmt.Errorf("failed to remove container '%s' holding name '%s': %w", existing.ID, containerName, err)
+ }
+ }
+
+ return nil
+}
+
+// discardContainer removes a container that never became usable, so the failure
+// leaves nothing behind: no dead container accumulating on the host and no name
+// blocking the retry. Removal is detached from the caller's context because a
+// cancelled flow is exactly when the leftover would otherwise survive, and any
+// failure is logged rather than returned so it cannot mask the startup error.
+func (dc *dockerClient) discardContainer(ctx context.Context, containerID string, logger *logrus.Entry) {
+ ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), containerDiscardTimeout)
+ defer cancel()
+
+ _, err := dc.client.ContainerRemove(ctx, containerID, client.ContainerRemoveOptions{
+ RemoveVolumes: true,
+ Force: true,
+ })
+ if err != nil && !cerrdefs.IsNotFound(err) {
+ logger.WithError(err).Error("failed to remove the container that did not start")
+ }
+}
+
func (dc *dockerClient) StopContainer(ctx context.Context, containerID string, dbID int64) error {
logger := dc.logger.WithContext(ctx).WithField("local_id", containerID)
logger.Info("initiating container shutdown sequence")
- stopErr := dc.client.ContainerStop(ctx, containerID, container.StopOptions{})
+ _, stopErr := dc.client.ContainerStop(ctx, containerID, client.ContainerStopOptions{})
if stopErr != nil {
if cerrdefs.IsNotFound(stopErr) {
logger.Warn("target container already removed or never existed")
@@ -482,11 +756,11 @@ func (dc *dockerClient) RemoveContainer(ctx context.Context, containerID string,
return fmt.Errorf("failed to stop container: %w", err)
}
- options := container.RemoveOptions{
+ options := client.ContainerRemoveOptions{
RemoveVolumes: true,
Force: true,
}
- if err := dc.client.ContainerRemove(ctx, containerID, options); err != nil {
+ if _, err := dc.client.ContainerRemove(ctx, containerID, options); err != nil {
if !cerrdefs.IsNotFound(err) {
return fmt.Errorf("failed to remove container: %w", err)
}
@@ -600,7 +874,7 @@ func (dc *dockerClient) Cleanup(ctx context.Context) error {
}
func (dc *dockerClient) IsContainerRunning(ctx context.Context, containerID string) (bool, error) {
- inspection, err := dc.client.ContainerInspect(ctx, containerID)
+ inspectResult, err := dc.client.ContainerInspect(ctx, containerID, client.ContainerInspectOptions{})
if err != nil {
if !cerrdefs.IsNotFound(err) {
return false, fmt.Errorf("container inspection failed: %w", err)
@@ -609,6 +883,7 @@ func (dc *dockerClient) IsContainerRunning(ctx context.Context, containerID stri
return false, nil
}
+ inspection := inspectResult.Container
if inspection.State == nil {
// the daemon always populates State for a successfully inspected
// container; treat the unexpected absence as "not running" rather
@@ -632,24 +907,25 @@ func (dc *dockerClient) GetDefaultImage() string {
func (dc *dockerClient) ContainerExecCreate(
ctx context.Context,
container string,
- config container.ExecOptions,
-) (container.ExecCreateResponse, error) {
- return dc.client.ContainerExecCreate(ctx, container, config)
+ config client.ExecCreateOptions,
+) (client.ExecCreateResult, error) {
+ return dc.client.ExecCreate(ctx, container, config)
}
func (dc *dockerClient) ContainerExecAttach(
ctx context.Context,
execID string,
- config container.ExecAttachOptions,
-) (types.HijackedResponse, error) {
- return dc.client.ContainerExecAttach(ctx, execID, config)
+ config client.ExecAttachOptions,
+) (client.HijackedResponse, error) {
+ result, err := dc.client.ExecAttach(ctx, execID, config)
+ return result.HijackedResponse, err
}
func (dc *dockerClient) ContainerExecInspect(
ctx context.Context,
execID string,
-) (container.ExecInspect, error) {
- return dc.client.ContainerExecInspect(ctx, execID)
+) (client.ExecInspectResult, error) {
+ return dc.client.ExecInspect(ctx, execID, client.ExecInspectOptions{})
}
func (dc *dockerClient) ContainerStatPath(
@@ -657,7 +933,8 @@ func (dc *dockerClient) ContainerStatPath(
containerID string,
path string,
) (container.PathStat, error) {
- return dc.client.ContainerStatPath(ctx, containerID, path)
+ result, err := dc.client.ContainerStatPath(ctx, containerID, client.ContainerStatPathOptions{Path: path})
+ return result.Stat, err
}
// ContainerEntryError is a directory entry that could not be stat'd during a
@@ -707,7 +984,7 @@ func (dc *dockerClient) ListContainerDir(
// No TTY: a TTY's onlcr would rewrite every \n in the stream to \r\n —
// including a \n that is part of a filename — corrupting the name. Without a
// TTY the exec stream is multiplexed and demuxed below.
- createResp, err := dc.ContainerExecCreate(ctx, containerID, container.ExecOptions{
+ createResp, err := dc.ContainerExecCreate(ctx, containerID, client.ExecCreateOptions{
Cmd: []string{"find", dirPath, "-maxdepth", "1", "-mindepth", "1", "!", "-name", ".*", "-print0"},
AttachStdout: true,
AttachStderr: true,
@@ -716,7 +993,7 @@ func (dc *dockerClient) ListContainerDir(
return ContainerDirListing{}, fmt.Errorf("failed to create list exec for '%s': %w", dirPath, err)
}
- resp, err := dc.ContainerExecAttach(ctx, createResp.ID, container.ExecAttachOptions{})
+ resp, err := dc.ContainerExecAttach(ctx, createResp.ID, client.ExecAttachOptions{})
if err != nil {
return ContainerDirListing{}, fmt.Errorf("failed to attach list exec for '%s': %w", dirPath, err)
}
@@ -875,9 +1152,12 @@ func (dc *dockerClient) CopyToContainer(
containerID string,
dstPath string,
content io.Reader,
- options container.CopyToContainerOptions,
+ options client.CopyToContainerOptions,
) error {
- return dc.client.CopyToContainer(ctx, containerID, dstPath, content, options)
+ options.DestinationPath = dstPath
+ options.Content = content
+ _, err := dc.client.CopyToContainer(ctx, containerID, options)
+ return err
}
func (dc *dockerClient) CopyFromContainer(
@@ -885,26 +1165,26 @@ func (dc *dockerClient) CopyFromContainer(
containerID string,
srcPath string,
) (io.ReadCloser, container.PathStat, error) {
- return dc.client.CopyFromContainer(ctx, containerID, srcPath)
+ result, err := dc.client.CopyFromContainer(ctx, containerID, client.CopyFromContainerOptions{SourcePath: srcPath})
+ return result.Content, result.Stat, err
}
func (dc *dockerClient) pullImage(ctx context.Context, imageName string) error {
- filters := filters.NewArgs()
- filters.Add("reference", imageName)
- images, err := dc.client.ImageList(ctx, image.ListOptions{
- Filters: filters,
+ filterArgs := make(client.Filters).Add("reference", imageName)
+ images, err := dc.client.ImageList(ctx, client.ImageListOptions{
+ Filters: filterArgs,
})
if err != nil {
return fmt.Errorf("failed to list images: %w", err)
}
- if imageExistsLocally := len(images) > 0; imageExistsLocally {
+ if imageExistsLocally := len(images.Items) > 0; imageExistsLocally {
return nil
}
dc.logger.WithContext(ctx).WithField("image", imageName).Info("initiating image download from registry...")
- pullStream, err := dc.client.ImagePull(ctx, imageName, image.PullOptions{})
+ pullStream, err := dc.client.ImagePull(ctx, imageName, client.ImagePullOptions{})
if err != nil {
return fmt.Errorf("failed to pull image: %w", err)
}
@@ -931,22 +1211,22 @@ func getHostDockerSocket(ctx context.Context, cli *client.Client) string {
return daemonHost
}
- filterArgs := filters.NewArgs()
- filterArgs.Add("status", "running")
+ filterArgs := make(client.Filters).Add("status", "running")
- containers, err := cli.ContainerList(ctx, container.ListOptions{
+ containerList, err := cli.ContainerList(ctx, client.ContainerListOptions{
Filters: filterArgs,
})
if err != nil {
return daemonHost
}
- for _, container := range containers {
- inspect, err := cli.ContainerInspect(ctx, container.ID)
+ for _, container := range containerList.Items {
+ result, err := cli.ContainerInspect(ctx, container.ID, client.ContainerInspectOptions{})
if err != nil {
continue
}
+ inspect := result.Container
if inspect.Config.Hostname != hostname {
continue
}
@@ -973,10 +1253,9 @@ func getHostDataDir(ctx context.Context, cli *client.Client, dataDir, workDir st
return ""
}
- filterArgs := filters.NewArgs()
- filterArgs.Add("status", "running")
+ filterArgs := make(client.Filters).Add("status", "running")
- containers, err := cli.ContainerList(ctx, container.ListOptions{
+ containerList, err := cli.ContainerList(ctx, client.ContainerListOptions{
Filters: filterArgs,
})
if err != nil {
@@ -984,12 +1263,13 @@ func getHostDataDir(ctx context.Context, cli *client.Client, dataDir, workDir st
}
mounts := []container.MountPoint{}
- for _, container := range containers {
- inspect, err := cli.ContainerInspect(ctx, container.ID)
+ for _, container := range containerList.Items {
+ result, err := cli.ContainerInspect(ctx, container.ID, client.ContainerInspectOptions{})
if err != nil {
continue
}
+ inspect := result.Container
if inspect.Config.Hostname != hostname {
continue
}
@@ -1036,11 +1316,11 @@ func ensureDockerNetwork(ctx context.Context, cli *client.Client, name string) e
return nil
}
- if _, err := cli.NetworkInspect(ctx, name, network.InspectOptions{}); err == nil {
+ if _, err := cli.NetworkInspect(ctx, name, client.NetworkInspectOptions{}); err == nil {
return nil
}
- _, err := cli.NetworkCreate(ctx, name, network.CreateOptions{
+ _, err := cli.NetworkCreate(ctx, name, client.NetworkCreateOptions{
Driver: "bridge",
})
if err != nil {
diff --git a/backend/pkg/docker/client_test.go b/backend/pkg/docker/client_test.go
index 4ad94da6..5f1740f5 100644
--- a/backend/pkg/docker/client_test.go
+++ b/backend/pkg/docker/client_test.go
@@ -6,16 +6,24 @@ import (
"encoding/binary"
"errors"
"fmt"
+ "hash/crc32"
"io"
"math/rand"
+ "net"
+ "os"
+ "path/filepath"
+ "pentagi/pkg/database"
+ "strconv"
"strings"
"sync/atomic"
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
- "github.com/docker/docker/api/types/container"
- "github.com/docker/docker/client"
+ "github.com/moby/moby/api/types/container"
+ "github.com/moby/moby/api/types/mount"
+ "github.com/moby/moby/api/types/network"
+ "github.com/moby/moby/client"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
)
@@ -273,14 +281,13 @@ const probeImage = "alpine:3.23.5"
func newDaemonClient(t *testing.T) *dockerClient {
t.Helper()
- cli, err := client.NewClientWithOpts(client.FromEnv)
+ cli, err := client.New(client.FromEnv)
if err != nil {
t.Skipf("docker daemon unavailable: %v", err)
}
ctx := t.Context()
- cli.NegotiateAPIVersion(ctx)
- if _, err := cli.Ping(ctx); err != nil {
+ if _, err := cli.Ping(ctx, client.PingOptions{NegotiateAPIVersion: true}); err != nil {
t.Skipf("docker daemon unavailable: %v", err)
}
@@ -294,10 +301,12 @@ func TestIsContainerRunningRemovedContainer(t *testing.T) {
dc := newDaemonClient(t)
ctx := t.Context()
- created, err := dc.client.ContainerCreate(ctx, &container.Config{
- Image: probeImage,
- Entrypoint: []string{"tail", "-f", "/dev/null"},
- }, nil, nil, nil, "")
+ created, err := dc.client.ContainerCreate(ctx, client.ContainerCreateOptions{
+ Config: &container.Config{
+ Image: probeImage,
+ Entrypoint: []string{"tail", "-f", "/dev/null"},
+ },
+ })
if cerrdefs.IsNotFound(err) {
t.Skipf("%s is not present locally", probeImage)
}
@@ -307,18 +316,20 @@ func TestIsContainerRunningRemovedContainer(t *testing.T) {
ctx := context.WithoutCancel(ctx)
// the happy path already removes the container below; only report a
// cleanup failure if it is still there for some other reason.
- if err := dc.client.ContainerRemove(ctx, created.ID, container.RemoveOptions{Force: true}); err != nil && !cerrdefs.IsNotFound(err) {
+ if _, err := dc.client.ContainerRemove(ctx, created.ID, client.ContainerRemoveOptions{Force: true}); err != nil && !cerrdefs.IsNotFound(err) {
t.Errorf("cleanup: failed to remove container %q: %v", created.ID, err)
}
})
- require.NoError(t, dc.client.ContainerStart(ctx, created.ID, container.StartOptions{}))
+ _, err = dc.client.ContainerStart(ctx, created.ID, client.ContainerStartOptions{})
+ require.NoError(t, err)
running, err := dc.IsContainerRunning(ctx, created.ID)
require.NoError(t, err)
require.True(t, running)
- require.NoError(t, dc.client.ContainerRemove(ctx, created.ID, container.RemoveOptions{Force: true}))
+ _, err = dc.client.ContainerRemove(ctx, created.ID, client.ContainerRemoveOptions{Force: true})
+ require.NoError(t, err)
running, err = dc.IsContainerRunning(ctx, created.ID)
require.NoError(t, err)
@@ -333,3 +344,583 @@ func TestIsContainerRunningUnknownContainer(t *testing.T) {
require.NoError(t, err)
require.False(t, running)
}
+
+// The tests below drive RunContainer against the local daemon and assert on the
+// daemon's own view of the result, so the container spec is proven as the engine
+// actually applied it rather than as the caller intended it.
+
+// containerRecorder captures the database writes RunContainer performs. The
+// embedded nil Querier makes any query the code under test starts issuing panic
+// loudly instead of silently returning zero values.
+type containerRecorder struct {
+ database.Querier
+
+ row database.Container
+ created database.CreateContainerParams
+ statuses []database.ContainerStatus
+ images []string
+}
+
+func (r *containerRecorder) CreateContainer(
+ _ context.Context, arg database.CreateContainerParams,
+) (database.Container, error) {
+ r.created = arg
+ r.row = database.Container{
+ ID: 1,
+ Type: arg.Type,
+ Name: arg.Name,
+ Image: arg.Image,
+ Status: arg.Status,
+ LocalID: arg.LocalID,
+ LocalDir: arg.LocalDir,
+ FlowID: arg.FlowID,
+ }
+ return r.row, nil
+}
+
+func (r *containerRecorder) UpdateContainerImage(
+ _ context.Context, arg database.UpdateContainerImageParams,
+) (database.Container, error) {
+ r.images = append(r.images, arg.Image)
+ r.row.Image = arg.Image
+ return r.row, nil
+}
+
+func (r *containerRecorder) UpdateContainerStatusLocalID(
+ _ context.Context, arg database.UpdateContainerStatusLocalIDParams,
+) (database.Container, error) {
+ r.statuses = append(r.statuses, arg.Status)
+ r.row.Status = arg.Status
+ r.row.LocalID = arg.LocalID
+ return r.row, nil
+}
+
+// newRunContainerClient extends the daemon-bound client with everything
+// RunContainer additionally needs — a recording database and a private data
+// directory — leaving every branch-selecting field at its neutral default so a
+// test only sets the one field its branch is about.
+func newRunContainerClient(t *testing.T) (*dockerClient, *containerRecorder) {
+ t.Helper()
+
+ dc := newDaemonClient(t)
+ recorder := &containerRecorder{}
+ dc.db = recorder
+ dc.dataDir = t.TempDir()
+ dc.defImage = probeImage
+ dc.labels = map[string]string{"pentagi.test": t.Name()}
+
+ // Pull up front so a slow or unreachable registry surfaces as a skip here
+ // rather than as a confusing failure inside a branch assertion.
+ if err := dc.pullImage(t.Context(), probeImage); err != nil {
+ t.Skipf("probe image %s unavailable: %v", probeImage, err)
+ }
+
+ return dc, recorder
+}
+
+// probeName builds a daemon-unique container name. RunContainer derives both the
+// work volume name and the container hostname from it, so collisions between
+// runs would corrupt exactly the things these tests assert on.
+func probeName(t *testing.T) string {
+ t.Helper()
+ return fmt.Sprintf("pentagi-probe-%d", rand.Uint64())
+}
+
+// probeConfig returns a fresh config on every call: RunContainer mutates the one
+// it is handed (hostname, working dir, labels, exposed ports), so tests must
+// never share a single value.
+func probeConfig() *container.Config {
+ return &container.Config{
+ Image: probeImage,
+ Entrypoint: []string{"tail", "-f", "/dev/null"},
+ }
+}
+
+// runProbeContainer runs a container through RunContainer and returns the row it
+// produced together with the daemon's view of the container. Cleanup is armed
+// before the run so a container created by a half-failed run is still reaped.
+func runProbeContainer(
+ t *testing.T,
+ dc *dockerClient,
+ name string,
+ flowID int64,
+ config *container.Config,
+ hostConfig *container.HostConfig,
+) (database.Container, container.InspectResponse) {
+ t.Helper()
+
+ if config == nil {
+ config = probeConfig()
+ }
+ cleanupProbeContainer(t, dc, name)
+
+ row, err := dc.RunContainer(t.Context(), name, database.ContainerTypePrimary, flowID, config, hostConfig)
+ require.NoError(t, err)
+ require.NotEmpty(t, row.LocalID.String)
+
+ inspect, err := dc.client.ContainerInspect(t.Context(), row.LocalID.String, client.ContainerInspectOptions{})
+ require.NoError(t, err)
+
+ return row, inspect.Container
+}
+
+// cleanupProbeContainer removes the container and the work volume RunContainer
+// may have created for it. The volume is named after the container and survives
+// RemoveVolumes (which only reaps anonymous ones), so it has to go explicitly.
+func cleanupProbeContainer(t *testing.T, dc *dockerClient, name string) {
+ t.Helper()
+
+ ctx := context.WithoutCancel(t.Context())
+ t.Cleanup(func() {
+ _, err := dc.client.ContainerRemove(ctx, name, client.ContainerRemoveOptions{
+ Force: true,
+ RemoveVolumes: true,
+ })
+ if err != nil && !cerrdefs.IsNotFound(err) {
+ t.Errorf("cleanup: failed to remove container %q: %v", name, err)
+ }
+
+ _, err = dc.client.VolumeRemove(ctx, name+WorkerVolumeNameSuffix, client.VolumeRemoveOptions{Force: true})
+ if err != nil && !cerrdefs.IsNotFound(err) {
+ t.Errorf("cleanup: failed to remove volume for %q: %v", name, err)
+ }
+ })
+}
+
+// mountAt returns the mount the daemon reports at dst. The mount table is how
+// /work provisioning and Docker-in-Docker wiring are proven, so a missing entry
+// must fail rather than degrade into a zero-value comparison.
+func mountAt(t *testing.T, inspect container.InspectResponse, dst string) container.MountPoint {
+ t.Helper()
+
+ for _, mountPoint := range inspect.Mounts {
+ if mountPoint.Destination == dst {
+ return mountPoint
+ }
+ }
+
+ t.Fatalf("container has no mount at %q, mounts: %+v", dst, inspect.Mounts)
+ return container.MountPoint{}
+}
+
+// requireMountSource asserts a mount resolves to the given host path. Docker
+// Desktop rewrites bind sources into its VM namespace (/host_mnt/private/...),
+// so the daemon-reported source is matched by suffix instead of by equality;
+// the paths under test are unique temporary directories, so a suffix match
+// still pins the mount to exactly one host location.
+func requireMountSource(t *testing.T, mountPoint container.MountPoint, hostPath string) {
+ t.Helper()
+
+ require.Truef(t, strings.HasSuffix(mountPoint.Source, hostPath),
+ "mount at %q has source %q, which does not resolve to host path %q",
+ mountPoint.Destination, mountPoint.Source, hostPath)
+}
+
+// reserveFreePortBase picks a ports base whose derived flow ports are all free
+// right now, so asserting on published ports cannot collide with whatever else
+// happens to listen on the machine running the test.
+func reserveFreePortBase(t *testing.T, flowID int64) int {
+ t.Helper()
+
+ for range 50 {
+ // stay below the 63535 ceiling GetPrimaryContainerPorts enforces, so the
+ // requested base is the one actually used
+ base := 30000 + rand.Intn(20000)
+ if portsAreFree(GetPrimaryContainerPorts(base, flowID)) {
+ return base
+ }
+ }
+
+ t.Skip("no free port range available for the published-port test")
+ return 0
+}
+
+func portsAreFree(ports []int) bool {
+ for _, port := range ports {
+ listener, err := net.Listen("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(port)))
+ if err != nil {
+ return false
+ }
+ listener.Close()
+ }
+ return true
+}
+
+// The sandbox hardening RunContainer applies unconditionally, plus the database
+// lifecycle: a row is inserted as starting and flipped to running with the real
+// container id once the daemon has started it.
+func TestRunContainerAppliesSandboxDefaults(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+ name := probeName(t)
+
+ row, inspect := runProbeContainer(t, dc, name, 7, nil, nil)
+
+ require.Equal(t, fmt.Sprintf("%08x", crc32.ChecksumIEEE([]byte(name))), inspect.Config.Hostname)
+ require.Equal(t, WorkFolderPathInContainer, inspect.Config.WorkingDir)
+ require.Equal(t, t.Name(), inspect.Config.Labels["pentagi.test"])
+
+ require.Equal(t, container.RestartPolicyOnFailure, inspect.HostConfig.RestartPolicy.Name)
+ require.Equal(t, 5, inspect.HostConfig.RestartPolicy.MaximumRetryCount)
+ require.NotNil(t, inspect.HostConfig.PidsLimit)
+ require.Equal(t, int64(2048), *inspect.HostConfig.PidsLimit)
+ require.Equal(t, "json-file", inspect.HostConfig.LogConfig.Type)
+ require.Equal(t, "10m", inspect.HostConfig.LogConfig.Config["max-size"])
+ require.Equal(t, "5", inspect.HostConfig.LogConfig.Config["max-file"])
+
+ require.Equal(t, database.ContainerStatusStarting, recorder.created.Status)
+ require.Equal(t, database.ContainerTypePrimary, recorder.created.Type)
+ require.Equal(t, []database.ContainerStatus{database.ContainerStatusRunning}, recorder.statuses)
+ require.Equal(t, inspect.ID, row.LocalID.String)
+ require.Equal(t, database.ContainerStatusRunning, row.Status)
+
+ running, err := dc.IsContainerRunning(t.Context(), row.LocalID.String)
+ require.NoError(t, err)
+ require.True(t, running)
+}
+
+// A caller-supplied host config is extended, not replaced: its pids limit
+// survives the default and its binds keep the appended /work mount company.
+func TestRunContainerPreservesCallerHostConfig(t *testing.T) {
+ dc, _ := newRunContainerClient(t)
+ callerLimit := int64(64)
+
+ _, inspect := runProbeContainer(t, dc, probeName(t), 8, nil, &container.HostConfig{
+ Resources: container.Resources{PidsLimit: &callerLimit},
+ })
+
+ require.NotNil(t, inspect.HostConfig.PidsLimit)
+ require.Equal(t, callerLimit, *inspect.HostConfig.PidsLimit)
+ require.Len(t, inspect.HostConfig.Binds, 1)
+ require.Contains(t, inspect.HostConfig.Binds[0], ":"+WorkFolderPathInContainer)
+}
+
+// Without a host-side data directory /work has to come from a named, labelled
+// volume owned by the container, and the database row records no host path.
+func TestRunContainerBacksWorkDirWithVolume(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+ dc.hostDir = ""
+ name := probeName(t)
+
+ _, inspect := runProbeContainer(t, dc, name, 3, nil, nil)
+
+ workMount := mountAt(t, inspect, WorkFolderPathInContainer)
+ require.Equal(t, mount.TypeVolume, workMount.Type)
+ require.Equal(t, name+WorkerVolumeNameSuffix, workMount.Name)
+ require.True(t, workMount.RW)
+ require.Empty(t, recorder.created.LocalDir.String)
+
+ volume, err := dc.client.VolumeInspect(t.Context(), name+WorkerVolumeNameSuffix, client.VolumeInspectOptions{})
+ require.NoError(t, err)
+ require.Equal(t, "local", volume.Volume.Driver)
+ require.Equal(t, t.Name(), volume.Volume.Labels["pentagi.test"])
+
+ // the mount is a usable directory, not just a spec the daemon accepted
+ listing, err := dc.ListContainerDir(t.Context(), inspect.ID, WorkFolderPathInContainer)
+ require.NoError(t, err)
+ require.Empty(t, listing.Files)
+}
+
+// With a host-side data directory /work is a bind of the per-flow subdirectory,
+// which is created on the host and recorded on the row.
+func TestRunContainerBindsPerFlowHostDir(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+ // the daemon runs on this machine, so the host path equals the local path
+ dc.hostDir = dc.dataDir
+ flowID := int64(11)
+ flowDir := filepath.Join(dc.dataDir, fmt.Sprintf(containerLocalCwdTemplate, flowID))
+
+ _, inspect := runProbeContainer(t, dc, probeName(t), flowID, nil, nil)
+
+ require.DirExists(t, flowDir)
+ require.Equal(t, flowDir, recorder.created.LocalDir.String)
+
+ workMount := mountAt(t, inspect, WorkFolderPathInContainer)
+ require.Equal(t, mount.TypeBind, workMount.Type)
+ requireMountSource(t, workMount, flowDir)
+ require.True(t, workMount.RW)
+
+ // the bind is live: a file written on the host is visible inside the sandbox
+ require.NoError(t, os.WriteFile(filepath.Join(flowDir, "marker.txt"), []byte("payload"), 0o600))
+ stat, err := dc.ContainerStatPath(t.Context(), inspect.ID, WorkFolderPathInContainer+"/marker.txt")
+ require.NoError(t, err)
+ require.Equal(t, "marker.txt", stat.Name)
+ require.Equal(t, int64(len("payload")), stat.Size)
+}
+
+// In bridge mode the flow's ports are exposed in the image config and published
+// on the configured public IP, which is what makes reverse connections reachable.
+func TestRunContainerPublishesFlowPorts(t *testing.T) {
+ dc, _ := newRunContainerClient(t)
+ dc.publicIP = "127.0.0.1"
+ flowID := int64(4)
+ dc.portsBase = reserveFreePortBase(t, flowID)
+
+ config := probeConfig()
+ _, inspect := runProbeContainer(t, dc, probeName(t), flowID, config, nil)
+
+ ports := GetPrimaryContainerPorts(dc.portsBase, flowID)
+ require.Len(t, ports, containerPortsNumber)
+ for _, port := range ports {
+ containerPort, ok := network.PortFrom(uint16(port), network.TCP)
+ require.True(t, ok)
+
+ require.Contains(t, config.ExposedPorts, containerPort)
+
+ published := inspect.NetworkSettings.Ports[containerPort]
+ require.Len(t, published, 1)
+ require.Equal(t, strconv.Itoa(port), published[0].HostPort)
+ require.Equal(t, "127.0.0.1", published[0].HostIP.String())
+ }
+}
+
+// An unparseable public IP is rejected before anything reaches the daemon, so a
+// misconfigured deployment cannot leave half-created sandboxes behind.
+func TestRunContainerRejectsInvalidPublicIP(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+ dc.publicIP = "definitely-not-an-ip"
+ name := probeName(t)
+ cleanupProbeContainer(t, dc, name)
+
+ _, err := dc.RunContainer(t.Context(), name, database.ContainerTypePrimary, 2, probeConfig(), nil)
+ require.ErrorContains(t, err, "invalid Docker public IP")
+
+ _, inspectErr := dc.client.ContainerInspect(t.Context(), name, client.ContainerInspectOptions{})
+ require.True(t, cerrdefs.IsNotFound(inspectErr), "no container must exist, got: %v", inspectErr)
+ require.Equal(t, []database.ContainerStatus{database.ContainerStatusFailed}, recorder.statuses)
+}
+
+// A missing config is refused before a database row is inserted, so a caller
+// bug cannot leave an orphan row behind.
+func TestRunContainerRejectsMissingConfig(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+
+ _, err := dc.RunContainer(t.Context(), probeName(t), database.ContainerTypePrimary, 1, nil, nil)
+
+ require.ErrorContains(t, err, "no config found")
+ require.Empty(t, recorder.created.Name)
+ require.Empty(t, recorder.statuses)
+}
+
+// When neither the requested nor the default image can be pulled the row is
+// marked failed, which is what lets cleanup treat the flow as dead instead of
+// leaving it stuck in starting.
+func TestRunContainerMarksRowFailedWhenNoImageAvailable(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+ unavailable := probeName(t) + ":0" // a repository that cannot exist
+ dc.defImage = unavailable
+
+ config := probeConfig()
+ config.Image = unavailable
+
+ _, err := dc.RunContainer(t.Context(), probeName(t), database.ContainerTypePrimary, 20, config, nil)
+
+ require.ErrorContains(t, err, "failed to pull default image")
+ require.Equal(t, []string{unavailable}, recorder.images)
+ require.Equal(t, []database.ContainerStatus{database.ContainerStatusFailed}, recorder.statuses)
+}
+
+// A container that is created but cannot start is recorded as failed together
+// with its local id, and nothing is left behind on the host.
+func TestRunContainerMarksRowFailedWhenStartFails(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+ dc.publicIP = "127.0.0.1"
+ flowID := int64(21)
+ dc.portsBase = reserveFreePortBase(t, flowID)
+
+ // hold one of the flow's host ports so the daemon accepts the create but
+ // refuses the start with "port is already allocated"
+ ports := GetPrimaryContainerPorts(dc.portsBase, flowID)
+ listener, err := net.Listen("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(ports[0])))
+ require.NoError(t, err)
+ defer listener.Close()
+
+ name := probeName(t)
+ cleanupProbeContainer(t, dc, name)
+
+ _, err = dc.RunContainer(t.Context(), name, database.ContainerTypePrimary, flowID, probeConfig(), nil)
+
+ require.ErrorContains(t, err, "failed to start container")
+ require.Equal(t, []database.ContainerStatus{database.ContainerStatusFailed}, recorder.statuses)
+ require.NotEmpty(t, recorder.row.LocalID.String)
+
+ _, inspectErr := dc.client.ContainerInspect(t.Context(), name, client.ContainerInspectOptions{})
+ require.True(t, cerrdefs.IsNotFound(inspectErr), "container must not be left behind, got: %v", inspectErr)
+}
+
+// The product hands the container straight to the agents, so a sandbox whose
+// entrypoint does not survive the start must be reported as a failure here —
+// whether it crashed or simply ran to completion — instead of being handed over
+// dead. The daemon acknowledges such a start as successful, so this is the only
+// place the situation can still be recognised.
+func TestRunContainerRejectsContainerThatDoesNotStayRunning(t *testing.T) {
+ tests := []struct {
+ name string
+ entrypoint []string
+ exitCode int
+ }{
+ {
+ name: "entrypoint crashes",
+ entrypoint: []string{"sh", "-c", "echo startup-diagnostic >&2; exit 3"},
+ exitCode: 3,
+ },
+ {
+ name: "entrypoint runs to completion",
+ entrypoint: []string{"sh", "-c", "echo startup-diagnostic; exit 0"},
+ exitCode: 0,
+ },
+ }
+
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+ name := probeName(t)
+ cleanupProbeContainer(t, dc, name)
+
+ config := probeConfig()
+ config.Entrypoint = test.entrypoint
+
+ _, err := dc.RunContainer(t.Context(), name, database.ContainerTypePrimary, 31, config, nil)
+
+ var startupErr *ContainerStartupError
+ require.ErrorAs(t, err, &startupErr)
+ require.Equal(t, name, startupErr.ContainerName)
+ require.Equal(t, test.exitCode, startupErr.ExitCode)
+ // the container's own output travels with the error, so the reason is
+ // visible without reaching for the host
+ require.Contains(t, startupErr.LogTail, "startup-diagnostic")
+
+ require.Equal(t, []database.ContainerStatus{database.ContainerStatusFailed}, recorder.statuses)
+
+ _, inspectErr := dc.client.ContainerInspect(t.Context(), name, client.ContainerInspectOptions{})
+ require.True(t, cerrdefs.IsNotFound(inspectErr),
+ "dead container must not be left behind, got: %v", inspectErr)
+ })
+ }
+}
+
+// A container left behind by an earlier run holds the name and would otherwise
+// make every later create fail with a name conflict. It is also not running, so
+// finding it at all requires listing every container, not just the live ones.
+func TestRunContainerReplacesContainerHoldingTheName(t *testing.T) {
+ dc, _ := newRunContainerClient(t)
+ name := probeName(t)
+
+ stale, err := dc.client.ContainerCreate(t.Context(), client.ContainerCreateOptions{
+ Config: &container.Config{Image: probeImage, Entrypoint: []string{"true"}},
+ Name: name,
+ })
+ require.NoError(t, err)
+
+ row, inspect := runProbeContainer(t, dc, name, 30, nil, nil)
+
+ require.NotEqual(t, stale.ID, row.LocalID.String)
+ require.NotNil(t, inspect.State)
+ require.True(t, inspect.State.Running)
+
+ _, inspectErr := dc.client.ContainerInspect(t.Context(), stale.ID, client.ContainerInspectOptions{})
+ require.True(t, cerrdefs.IsNotFound(inspectErr),
+ "the container holding the name must be removed, got: %v", inspectErr)
+}
+
+// Host network mode hands the container the host stack directly, so port
+// publishing must be skipped entirely even when a public IP and base are set.
+func TestRunContainerHostNetworkSkipsPortPublishing(t *testing.T) {
+ dc, _ := newRunContainerClient(t)
+ dc.network = "host"
+ dc.publicIP = "127.0.0.1"
+ dc.portsBase = BaseContainerPortsNumber
+
+ config := probeConfig()
+ _, inspect := runProbeContainer(t, dc, probeName(t), 5, config, nil)
+
+ require.Equal(t, container.NetworkMode("host"), inspect.HostConfig.NetworkMode)
+ require.Empty(t, config.ExposedPorts)
+ require.Empty(t, inspect.HostConfig.PortBindings)
+ require.Empty(t, inspect.NetworkSettings.Ports)
+ require.Contains(t, inspect.NetworkSettings.Networks, "host")
+
+ // /work is still provisioned; host networking only changes reachability
+ require.Equal(t, WorkFolderPathInContainer, mountAt(t, inspect, WorkFolderPathInContainer).Destination)
+}
+
+// A configured bridge network is created on demand and the sandbox is attached
+// to it, which is what isolates workers from the default bridge.
+func TestRunContainerAttachesConfiguredNetwork(t *testing.T) {
+ dc, _ := newRunContainerClient(t)
+ networkName := probeName(t)
+ ctx := context.WithoutCancel(t.Context())
+
+ require.NoError(t, ensureDockerNetwork(t.Context(), dc.client, networkName))
+ t.Cleanup(func() {
+ if _, err := dc.client.NetworkRemove(ctx, networkName, client.NetworkRemoveOptions{}); err != nil &&
+ !cerrdefs.IsNotFound(err) {
+ t.Errorf("cleanup: failed to remove network %q: %v", networkName, err)
+ }
+ })
+ // a second call must be a no-op rather than a duplicate-network failure
+ require.NoError(t, ensureDockerNetwork(t.Context(), dc.client, networkName))
+
+ dc.network = networkName
+ dc.publicIP = "127.0.0.1"
+ flowID := int64(6)
+ dc.portsBase = reserveFreePortBase(t, flowID)
+
+ _, inspect := runProbeContainer(t, dc, probeName(t), flowID, nil, nil)
+
+ require.Contains(t, inspect.NetworkSettings.Networks, networkName)
+ require.NotEmpty(t, inspect.NetworkSettings.Networks[networkName].IPAddress)
+}
+
+// An image that cannot be pulled falls back to the configured default image,
+// and the fallback is reflected in the config, the database row and the daemon.
+func TestRunContainerFallsBackToDefaultImage(t *testing.T) {
+ dc, recorder := newRunContainerClient(t)
+ config := probeConfig()
+ config.Image = probeName(t) + ":0" // a repository that cannot exist
+
+ row, inspect := runProbeContainer(t, dc, probeName(t), 9, config, nil)
+
+ require.Equal(t, probeImage, config.Image)
+ require.Equal(t, []string{probeImage}, recorder.images)
+ require.Equal(t, probeImage, row.Image)
+ require.Equal(t, probeImage, inspect.Config.Image)
+}
+
+// With DOCKER_INSIDE the sandbox gets the designated daemon socket, the
+// matching client environment, and the TLS material at the same read-only path
+// on both sides.
+func TestRunContainerWiresDockerInsideAccess(t *testing.T) {
+ dc, _ := newRunContainerClient(t)
+ socketPath := filepath.Join(t.TempDir(), "docker.sock")
+ require.NoError(t, os.WriteFile(socketPath, nil, 0o600))
+ certPath := t.TempDir()
+
+ dc.inside = true
+ dc.socket = socketPath
+ dc.insideCertPath = certPath
+ dc.insideEnv = []string{"DOCKER_HOST=tcp://daemon.internal:2376", "DOCKER_TLS_VERIFY=1"}
+
+ config := probeConfig()
+ _, inspect := runProbeContainer(t, dc, probeName(t), 12, config, nil)
+
+ socketMount := mountAt(t, inspect, defaultDockerSocketPath)
+ requireMountSource(t, socketMount, socketPath)
+
+ certMount := mountAt(t, inspect, certPath)
+ requireMountSource(t, certMount, certPath)
+ require.False(t, certMount.RW)
+
+ require.Subset(t, inspect.Config.Env, dc.insideEnv)
+}
+
+// Without DOCKER_INSIDE no daemon socket is handed to the sandbox at all.
+func TestRunContainerWithoutInsideKeepsDaemonUnreachable(t *testing.T) {
+ dc, _ := newRunContainerClient(t)
+
+ _, inspect := runProbeContainer(t, dc, probeName(t), 13, nil, nil)
+
+ for _, mountPoint := range inspect.Mounts {
+ require.NotEqual(t, defaultDockerSocketPath, mountPoint.Destination)
+ }
+ require.Len(t, inspect.HostConfig.Binds, 1)
+}
diff --git a/backend/pkg/server/services/flow_files.go b/backend/pkg/server/services/flow_files.go
index c6d5ba4a..e7aaf937 100644
--- a/backend/pkg/server/services/flow_files.go
+++ b/backend/pkg/server/services/flow_files.go
@@ -27,9 +27,10 @@ import (
"pentagi/pkg/tools"
"pentagi/pkg/version"
- "github.com/docker/docker/api/types/container"
"github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
+ "github.com/moby/moby/api/types/container"
+ "github.com/moby/moby/client"
)
// Local storage layout under {dataDir}/flow-{id}-data/:
@@ -1250,7 +1251,7 @@ func (s *FlowFileService) copyLocalFilesToPrimaryWork(ctx context.Context, flowI
}()
copyErr := s.dockerClient.CopyToContainer(ctx, containerName, docker.WorkFolderPathInContainer, pr,
- container.CopyToContainerOptions{AllowOverwriteDirWithFile: true})
+ client.CopyToContainerOptions{AllowOverwriteDirWithFile: true})
pr.Close()
writeErr := <-errCh
if copyErr != nil {
@@ -1332,7 +1333,7 @@ func (s *FlowFileService) deleteUploadsFromContainer(ctx context.Context, flowID
}
cmd := "rm -rf -- " + strings.Join(quotedPaths, " ")
- createResp, err := s.dockerClient.ContainerExecCreate(ctx, containerName, container.ExecOptions{
+ createResp, err := s.dockerClient.ContainerExecCreate(ctx, containerName, client.ExecCreateOptions{
Cmd: []string{"sh", "-c", cmd},
AttachStdout: true,
AttachStderr: true,
@@ -1341,7 +1342,7 @@ func (s *FlowFileService) deleteUploadsFromContainer(ctx context.Context, flowID
return fmt.Errorf("failed to create container delete exec: %w", err)
}
- resp, err := s.dockerClient.ContainerExecAttach(ctx, createResp.ID, container.ExecAttachOptions{})
+ resp, err := s.dockerClient.ContainerExecAttach(ctx, createResp.ID, client.ExecAttachOptions{})
if err != nil {
return fmt.Errorf("failed to attach container delete exec: %w", err)
}
diff --git a/backend/pkg/server/services/flow_files_partial_test.go b/backend/pkg/server/services/flow_files_partial_test.go
index b185b2df..66086a74 100644
--- a/backend/pkg/server/services/flow_files_partial_test.go
+++ b/backend/pkg/server/services/flow_files_partial_test.go
@@ -12,7 +12,7 @@ import (
"pentagi/pkg/server/models"
"pentagi/pkg/version"
- "github.com/docker/docker/api/types/container"
+ "github.com/moby/moby/api/types/container"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
diff --git a/backend/pkg/server/services/flow_files_test.go b/backend/pkg/server/services/flow_files_test.go
index d317090d..0c02c751 100644
--- a/backend/pkg/server/services/flow_files_test.go
+++ b/backend/pkg/server/services/flow_files_test.go
@@ -32,11 +32,11 @@ import (
"pentagi/pkg/resources"
"pentagi/pkg/server/models"
- "github.com/docker/docker/api/types"
- "github.com/docker/docker/api/types/container"
"github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
+ "github.com/moby/moby/api/types/container"
+ "github.com/moby/moby/client"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -790,6 +790,23 @@ func flowFileMultipartBody(t *testing.T, files []flowFileUploadFile, fieldName s
return &body, writer.FormDataContentType()
}
+// rawFlowFileMultipartBody writes the multipart wire format byte for byte, the
+// way a hostile client would. multipart.Writer percent-encodes CR and LF in a
+// filename, so a body built with it can never carry those bytes to the handler;
+// only a hand-written body actually exercises the defence against them.
+func rawFlowFileMultipartBody(fileName, content string) (*bytes.Buffer, string) {
+ const boundary = "pentagitestboundary"
+
+ var body bytes.Buffer
+ fmt.Fprintf(&body, "--%s\r\n", boundary)
+ fmt.Fprintf(&body, "Content-Disposition: form-data; name=\"files\"; filename=\"%s\"\r\n", fileName)
+ body.WriteString("Content-Type: application/octet-stream\r\n\r\n")
+ body.WriteString(content)
+ fmt.Fprintf(&body, "\r\n--%s--\r\n", boundary)
+
+ return &body, "multipart/form-data; boundary=" + boundary
+}
+
// ─────────────────────────────────────────────────────────────────────────────
// Subscription capture for handler tests.
// ─────────────────────────────────────────────────────────────────────────────
@@ -948,7 +965,7 @@ type copyToCall struct {
containerID string
dstPath string
body []byte
- options container.CopyToContainerOptions
+ options client.CopyToContainerOptions
}
type fakeDockerClient struct {
@@ -1006,37 +1023,37 @@ func (f *fakeDockerClient) RemoveContainer(_ context.Context, _ string, _ int64)
func (f *fakeDockerClient) IsContainerRunning(_ context.Context, _ string) (bool, error) {
return f.running, f.runningErr
}
-func (f *fakeDockerClient) ContainerExecCreate(_ context.Context, _ string, opts container.ExecOptions) (container.ExecCreateResponse, error) {
+func (f *fakeDockerClient) ContainerExecCreate(_ context.Context, _ string, opts client.ExecCreateOptions) (client.ExecCreateResult, error) {
f.mu.Lock()
defer f.mu.Unlock()
if len(opts.Cmd) > 0 {
f.execCommands = append(f.execCommands, strings.Join(opts.Cmd, " "))
}
if f.execCreateErr != nil {
- return container.ExecCreateResponse{}, f.execCreateErr
+ return client.ExecCreateResult{}, f.execCreateErr
}
id := f.execCreateID
if id == "" {
id = "exec-id"
}
- return container.ExecCreateResponse{ID: id}, nil
+ return client.ExecCreateResult{ID: id}, nil
}
-func (f *fakeDockerClient) ContainerExecAttach(_ context.Context, _ string, _ container.ExecAttachOptions) (types.HijackedResponse, error) {
+func (f *fakeDockerClient) ContainerExecAttach(_ context.Context, _ string, _ client.ExecAttachOptions) (client.HijackedResponse, error) {
if f.execAttachErr != nil {
- return types.HijackedResponse{}, f.execAttachErr
+ return client.HijackedResponse{}, f.execAttachErr
}
pr, pw := net.Pipe()
go func() {
_, _ = pw.Write([]byte(f.execAttachOut))
_ = pw.Close()
}()
- return types.HijackedResponse{Conn: pr, Reader: bufio.NewReader(pr)}, nil
+ return client.HijackedResponse{Conn: pr, Reader: bufio.NewReader(pr)}, nil
}
-func (f *fakeDockerClient) ContainerExecInspect(_ context.Context, _ string) (container.ExecInspect, error) {
+func (f *fakeDockerClient) ContainerExecInspect(_ context.Context, _ string) (client.ExecInspectResult, error) {
if f.execInspectErr != nil {
- return container.ExecInspect{}, f.execInspectErr
+ return client.ExecInspectResult{}, f.execInspectErr
}
- return container.ExecInspect{ExitCode: f.execInspectCode}, nil
+ return client.ExecInspectResult{ExitCode: f.execInspectCode}, nil
}
func (f *fakeDockerClient) ContainerStatPath(_ context.Context, _ string, p string) (container.PathStat, error) {
if f.statPathErrMap != nil {
@@ -1069,7 +1086,7 @@ func (f *fakeDockerClient) ListContainerDir(_ context.Context, _ string, p strin
}
return docker.ContainerDirListing{Files: f.listDir}, f.listDirErr
}
-func (f *fakeDockerClient) CopyToContainer(_ context.Context, containerID string, dstPath string, content io.Reader, options container.CopyToContainerOptions) error {
+func (f *fakeDockerClient) CopyToContainer(_ context.Context, containerID string, dstPath string, content io.Reader, options client.CopyToContainerOptions) error {
body, _ := io.ReadAll(content)
f.mu.Lock()
f.copyToCalls = append(f.copyToCalls, copyToCall{
@@ -1331,12 +1348,15 @@ func TestFlowFileService_UploadFlowFilesScenarios(t *testing.T) {
wantStatus: http.StatusBadRequest,
},
{
+ // a name that survives multipart encoding intact, so the rejection
+ // comes from the handler's own validation rather than from the MIME
+ // parser choking on the header
name: "invalid filename returns bad request",
flowOwner: 1,
uid: 1,
flowID: 1,
privs: []string{"flow_files.upload"},
- files: []flowFileUploadFile{{name: "bad\nname.txt", content: "x"}},
+ files: []flowFileUploadFile{{name: "bad*name.txt", content: "x"}},
wantStatus: http.StatusBadRequest,
},
{
@@ -1450,6 +1470,10 @@ func TestFlowFileService_UploadFlowFilesScenarios(t *testing.T) {
// filename embeds traversal segments, absolute paths, NUL bytes, or
// Windows-style separators.
//
+// Control characters are sent through a hand-written multipart body: an
+// attacker writes the wire format directly, and multipart.Writer would
+// percent-encode CR and LF instead of transmitting them.
+//
// The directory tree of the entire dataDir is enumerated after each request
// and any unexpected entry fails the test, ensuring the protection chain
// (SanitizeFileName + filepath.Join + LocalEntryExists) is intact.
@@ -1457,6 +1481,7 @@ func TestFlowFileService_UploadFlowFilesPathTraversalSecurity(t *testing.T) {
tests := []struct {
name string
uploadName string
+ rawHeader bool // write the filename to the wire verbatim
wantStatus int
wantStoredAs string // basename expected on disk under uploads/, empty if rejected
wantContentInFile string
@@ -1518,24 +1543,38 @@ func TestFlowFileService_UploadFlowFilesPathTraversalSecurity(t *testing.T) {
uploadName: "/",
wantStatus: http.StatusBadRequest,
},
+ {
+ // what multipart.Writer transmits for a filename containing a
+ // newline: the encoding must be stored as the literal text it is,
+ // never decoded back into a control character
+ name: "percent-encoded newline is stored verbatim",
+ uploadName: "evil%0Aname.txt",
+ wantStatus: http.StatusOK,
+ wantStoredAs: "evil%0Aname.txt",
+ wantContentInFile: "payload",
+ },
{
name: "embedded NUL byte is rejected",
uploadName: "evil\x00.txt",
+ rawHeader: true,
wantStatus: http.StatusBadRequest,
},
{
name: "newline in filename is rejected",
uploadName: "evil\nname.txt",
+ rawHeader: true,
wantStatus: http.StatusBadRequest,
},
{
name: "carriage return in filename is rejected",
uploadName: "evil\rname.txt",
+ rawHeader: true,
wantStatus: http.StatusBadRequest,
},
{
name: "DEL control character is rejected",
uploadName: "evil\x7fname.txt",
+ rawHeader: true,
wantStatus: http.StatusBadRequest,
},
{
@@ -1573,10 +1612,17 @@ func TestFlowFileService_UploadFlowFilesPathTraversalSecurity(t *testing.T) {
svc := NewFlowFileService(db, dataDir, "", nil, ss)
seedFlow(t, db, 1, 1)
- body, contentType := flowFileMultipartBody(t,
- []flowFileUploadFile{{name: tt.uploadName, content: "payload"}},
- "files",
- )
+ var body io.Reader
+ var contentType string
+ if tt.rawHeader {
+ body, contentType = rawFlowFileMultipartBody(tt.uploadName, "payload")
+ } else {
+ body, contentType = flowFileMultipartBody(t,
+ []flowFileUploadFile{{name: tt.uploadName, content: "payload"}},
+ "files",
+ )
+ }
+
c, w := newFlowFileTestContext(http.MethodPost, "/flows/1/files/", body,
[]string{"flow_files.upload"}, 1, 1)
c.Request.Header.Set("Content-Type", contentType)
diff --git a/backend/pkg/server/services/resources_test.go b/backend/pkg/server/services/resources_test.go
index 4030e6a2..b78fcbfd 100644
--- a/backend/pkg/server/services/resources_test.go
+++ b/backend/pkg/server/services/resources_test.go
@@ -882,8 +882,11 @@ func TestResourceService_UploadResourcesScenarios(t *testing.T) {
wantMissingBlobs: []string{"payload"},
},
{
+ // a name that survives multipart encoding intact, so the rejection
+ // comes from the handler's own validation rather than from the MIME
+ // parser choking on the header
name: "upload invalid filename rejected",
- files: []uploadTestFile{{name: "bad\nname.txt", content: "payload"}},
+ files: []uploadTestFile{{name: "bad*name.txt", content: "payload"}},
privs: []string{"resources.upload"},
wantStatus: http.StatusBadRequest,
wantMissingBlobs: []string{"payload"},
diff --git a/backend/pkg/tools/terminal.go b/backend/pkg/tools/terminal.go
index 2e187344..97449d41 100644
--- a/backend/pkg/tools/terminal.go
+++ b/backend/pkg/tools/terminal.go
@@ -17,7 +17,7 @@ import (
obs "pentagi/pkg/observability"
"pentagi/pkg/observability/langfuse"
- "github.com/docker/docker/api/types/container"
+ "github.com/moby/moby/client"
"github.com/sirupsen/logrus"
)
@@ -222,12 +222,12 @@ func (t *terminal) ExecCommand(
timeout = t.normalizeExecTimeout(timeout)
- createResp, err := t.dockerClient.ContainerExecCreate(ctx, containerName, container.ExecOptions{
+ createResp, err := t.dockerClient.ContainerExecCreate(ctx, containerName, client.ExecCreateOptions{
Cmd: cmd,
AttachStdout: true,
AttachStderr: true,
WorkingDir: cwd,
- Tty: true,
+ TTY: true,
})
if err != nil {
return "", fmt.Errorf("failed to create exec process: %w", err)
@@ -266,8 +266,8 @@ func (t *terminal) getExecResult(ctx context.Context, id string, timeout time.Du
defer cancel()
}
- resp, err := t.dockerClient.ContainerExecAttach(ctx, id, container.ExecAttachOptions{
- Tty: true,
+ resp, err := t.dockerClient.ContainerExecAttach(ctx, id, client.ExecAttachOptions{
+ TTY: true,
})
if err != nil {
return "", fmt.Errorf("failed to attach to exec process: %w", err)
@@ -485,7 +485,7 @@ func (t *terminal) writeFileToContainer(ctx context.Context, flowID int64, path,
}
dir := filepath.Dir(path)
- err = t.dockerClient.CopyToContainer(ctx, containerName, dir, tarBuffer, container.CopyToContainerOptions{
+ err = t.dockerClient.CopyToContainer(ctx, containerName, dir, tarBuffer, client.CopyToContainerOptions{
AllowOverwriteDirWithFile: true,
})
if err != nil {
diff --git a/backend/pkg/tools/terminal_test.go b/backend/pkg/tools/terminal_test.go
index 364970b2..76cafe37 100644
--- a/backend/pkg/tools/terminal_test.go
+++ b/backend/pkg/tools/terminal_test.go
@@ -19,8 +19,8 @@ import (
"pentagi/pkg/docker"
"pentagi/pkg/flowfiles"
- "github.com/docker/docker/api/types"
- "github.com/docker/docker/api/types/container"
+ "github.com/moby/moby/api/types/container"
+ "github.com/moby/moby/client"
"github.com/stretchr/testify/assert"
)
@@ -41,10 +41,10 @@ var _ TermLogProvider = (*contextTestTermLogProvider)(nil)
// inferred/validated action.
type contextAwareMockDockerClient struct {
isRunning bool
- execCreateResp container.ExecCreateResponse
+ execCreateResp client.ExecCreateResult
attachOutput []byte
attachDelay time.Duration
- inspectResp container.ExecInspect
+ inspectResp client.ExecInspectResult
// Set by ContainerExecAttach to track if ctx was canceled during attach
ctxWasCanceled bool
@@ -76,10 +76,10 @@ func (m *contextAwareMockDockerClient) RemoveContainer(_ context.Context, _ stri
func (m *contextAwareMockDockerClient) IsContainerRunning(_ context.Context, _ string) (bool, error) {
return m.isRunning, nil
}
-func (m *contextAwareMockDockerClient) ContainerExecCreate(_ context.Context, _ string, _ container.ExecOptions) (container.ExecCreateResponse, error) {
+func (m *contextAwareMockDockerClient) ContainerExecCreate(_ context.Context, _ string, _ client.ExecCreateOptions) (client.ExecCreateResult, error) {
return m.execCreateResp, nil
}
-func (m *contextAwareMockDockerClient) ContainerExecAttach(ctx context.Context, _ string, _ container.ExecAttachOptions) (types.HijackedResponse, error) {
+func (m *contextAwareMockDockerClient) ContainerExecAttach(ctx context.Context, _ string, _ client.ExecAttachOptions) (client.HijackedResponse, error) {
// Wait for the configured delay, simulating a long-running command
if m.attachDelay > 0 {
select {
@@ -88,7 +88,7 @@ func (m *contextAwareMockDockerClient) ContainerExecAttach(ctx context.Context,
case <-ctx.Done():
// Context was canceled -- this is the bug behavior (without WithoutCancel)
m.ctxWasCanceled = true
- return types.HijackedResponse{}, ctx.Err()
+ return client.HijackedResponse{}, ctx.Err()
}
}
@@ -96,7 +96,7 @@ func (m *contextAwareMockDockerClient) ContainerExecAttach(ctx context.Context,
select {
case <-ctx.Done():
m.ctxWasCanceled = true
- return types.HijackedResponse{}, ctx.Err()
+ return client.HijackedResponse{}, ctx.Err()
default:
}
@@ -106,7 +106,7 @@ func (m *contextAwareMockDockerClient) ContainerExecAttach(ctx context.Context,
pw.Close()
}()
- return types.HijackedResponse{
+ return client.HijackedResponse{
Conn: pr,
Reader: bufio.NewReader(pr),
}, nil
@@ -117,10 +117,10 @@ func (m *contextAwareMockDockerClient) ContainerStatPath(_ context.Context, _ st
func (m *contextAwareMockDockerClient) ListContainerDir(_ context.Context, _ string, _ string) (docker.ContainerDirListing, error) {
return docker.ContainerDirListing{}, nil
}
-func (m *contextAwareMockDockerClient) ContainerExecInspect(_ context.Context, _ string) (container.ExecInspect, error) {
+func (m *contextAwareMockDockerClient) ContainerExecInspect(_ context.Context, _ string) (client.ExecInspectResult, error) {
return m.inspectResp, nil
}
-func (m *contextAwareMockDockerClient) CopyToContainer(_ context.Context, _ string, _ string, src io.Reader, _ container.CopyToContainerOptions) error {
+func (m *contextAwareMockDockerClient) CopyToContainer(_ context.Context, _ string, _ string, src io.Reader, _ client.CopyToContainerOptions) error {
m.copyToCalled = true
tarReader := tar.NewReader(src)
@@ -169,10 +169,10 @@ func TestExecCommandDetachSurvivesParentCancel(t *testing.T) {
mock := &contextAwareMockDockerClient{
isRunning: true,
- execCreateResp: container.ExecCreateResponse{ID: "exec-cancel-test"},
+ execCreateResp: client.ExecCreateResult{ID: "exec-cancel-test"},
attachOutput: []byte("background result"),
attachDelay: 2 * time.Second, // simulates a long-running command
- inspectResp: container.ExecInspect{ExitCode: 0},
+ inspectResp: client.ExecInspectResult{ExitCode: 0},
}
term := &terminal{
@@ -210,10 +210,10 @@ func TestExecCommandNonDetachRespectsParentCancel(t *testing.T) {
mock := &contextAwareMockDockerClient{
isRunning: true,
- execCreateResp: container.ExecCreateResponse{ID: "exec-nondetach-cancel"},
+ execCreateResp: client.ExecCreateResult{ID: "exec-nondetach-cancel"},
attachOutput: []byte("should not complete"),
attachDelay: 5 * time.Second, // longer than cancel delay
- inspectResp: container.ExecInspect{ExitCode: 0},
+ inspectResp: client.ExecInspectResult{ExitCode: 0},
}
term := &terminal{
@@ -654,13 +654,13 @@ func TestConvertSyncEntriesToTarEntries(t *testing.T) {
func TestFindMissingInContainer(t *testing.T) {
mock := &contextAwareMockDockerClient{
- execCreateResp: container.ExecCreateResponse{ID: "exec-file-check"},
+ execCreateResp: client.ExecCreateResult{ID: "exec-file-check"},
attachOutput: []byte(
docker.WorkFolderPathInContainer + "/uploads/a.txt\n" +
docker.WorkFolderPathInContainer + "/resources/b.txt\n" +
docker.WorkFolderPathInContainer + "/unknown.txt\n",
),
- inspectResp: container.ExecInspect{ExitCode: 0},
+ inspectResp: client.ExecInspectResult{ExitCode: 0},
}
fte := &flowToolsExecutor{flowID: 7, docker: mock}
entries := []fileSyncEntry{
@@ -676,9 +676,9 @@ func TestFindMissingInContainer(t *testing.T) {
func TestFindMissingInContainerChecksExitCode(t *testing.T) {
mock := &contextAwareMockDockerClient{
- execCreateResp: container.ExecCreateResponse{ID: "exec-file-check"},
+ execCreateResp: client.ExecCreateResult{ID: "exec-file-check"},
attachOutput: []byte("shell failed"),
- inspectResp: container.ExecInspect{ExitCode: 2},
+ inspectResp: client.ExecInspectResult{ExitCode: 2},
}
fte := &flowToolsExecutor{flowID: 7, docker: mock}
diff --git a/backend/pkg/tools/tools.go b/backend/pkg/tools/tools.go
index 09b949ce..3b00127a 100644
--- a/backend/pkg/tools/tools.go
+++ b/backend/pkg/tools/tools.go
@@ -23,7 +23,8 @@ import (
"pentagi/pkg/providers/embeddings"
"pentagi/pkg/schema"
- "github.com/docker/docker/api/types/container"
+ "github.com/moby/moby/api/types/container"
+ "github.com/moby/moby/client"
"github.com/sirupsen/logrus"
"github.com/vxcontrol/cloud/anonymizer"
"github.com/vxcontrol/cloud/anonymizer/patterns"
@@ -652,7 +653,7 @@ func (fte *flowToolsExecutor) findMissingInContainer(ctx context.Context, entrie
}
containerName := PrimaryTerminalName(fte.cfg.TenantPrefix(), fte.flowID)
- createResp, err := fte.docker.ContainerExecCreate(ctx, containerName, container.ExecOptions{
+ createResp, err := fte.docker.ContainerExecCreate(ctx, containerName, client.ExecCreateOptions{
Cmd: cmd,
AttachStdout: true,
AttachStderr: true,
@@ -661,7 +662,7 @@ func (fte *flowToolsExecutor) findMissingInContainer(ctx context.Context, entrie
return nil, fmt.Errorf("failed to create file-check exec: %w", err)
}
- resp, err := fte.docker.ContainerExecAttach(ctx, createResp.ID, container.ExecAttachOptions{})
+ resp, err := fte.docker.ContainerExecAttach(ctx, createResp.ID, client.ExecAttachOptions{})
if err != nil {
return nil, fmt.Errorf("failed to attach file-check exec: %w", err)
}
@@ -707,7 +708,7 @@ func (fte *flowToolsExecutor) copyEntriesToContainer(ctx context.Context, entrie
containerName := PrimaryTerminalName(fte.cfg.TenantPrefix(), fte.flowID)
copyErr := fte.docker.CopyToContainer(ctx, containerName, docker.WorkFolderPathInContainer, pr,
- container.CopyToContainerOptions{AllowOverwriteDirWithFile: true})
+ client.CopyToContainerOptions{AllowOverwriteDirWithFile: true})
pr.Close()
writeErr := <-errCh