Documentation
¶
Overview ¶
Package gateway owns the "installed on first agent use" half: making sure the pinned docker-mcp-gateway and harness images are present and the local runner image is built, before any run needs them. Only the containerized gateway is supported: the CLI-plugin auto-install path is rejected for its supply-chain surface.
Index ¶
- Constants
- func EnsureExecImage(ctx context.Context, d dockerx.Client, runnerImage string, ...) ([]string, error)
- func EnsureHarnessImage(ctx context.Context, d dockerx.Client, adapterName string, ...) error
- func EnsureInstalled(ctx context.Context, d dockerx.Client, pol *policy.Policy, ...) error
- func EnsureInstalledFor(ctx context.Context, d dockerx.Client, pol *policy.Policy, ...) error
- func EnsurePodmanRuntime(ctx context.Context, d dockerx.Client, e dockerx.Engine, pol *policy.Policy) error
- func EnsureRunnerImage(ctx context.Context, d dockerx.Client, pol *policy.Policy, ...) error
- func EnsureRuntime(ctx context.Context, d dockerx.Client, pol *policy.Policy) error
Constants ¶
const CoderRecordFile = "/etc/agentry/coder/record"
CoderRecordFile is where the Coding agent's toolchain image records each tool's version and the Debian snapshot it was built from, read back into the receipt.
const ExecFailedFile = "/etc/agentry/exec-failed"
ExecFailedFile is where an Unsafe Mode exec image build records what did not install ("what<TAB>why" a line). An image whose record is not empty is rebuilt on its next use rather than reused, so a passing mirror or PyPI fault does not leave a tool missing for good under the same tag.
const ExecPackagesFile = "/etc/agentry/exec-packages"
ExecPackagesFile is where the exec image build records the resolved versions of the catalogued packages it installed ("name-version" per line, `apk list --installed`), read back into the receipt.
const PodmanRuntimeRecipe = "register it in containers.conf under [engine.runtimes], the name as a path to a script that runs the runtime binary (rootless podman needs `runsc --ignore-cgroups`), and docker.gatewayRuntime as a second script that adds " + dockerx.HostUDSOpen
PodmanRuntimeRecipe is how a runtime is registered with podman: by name, as a path, in the operator's containers.conf. The runtime's own flags go in a wrapper script, since podman passes none; the gateway's wrapper adds --host-uds=open, and a rootless podman needs --ignore-cgroups.
Variables ¶
This section is empty.
Functions ¶
func EnsureExecImage ¶
func EnsureExecImage(ctx context.Context, d dockerx.Client, runnerImage string, img spec.ExecImageSpec, ctxDir string, logw io.Writer) ([]string, error)
EnsureExecImage builds the per-QuickAgent exec image for a plan when absent: `FROM <runnerImage>`, the operator's catalogued apk packages installed (from the policy's mirror when one is named) with their resolved versions recorded into the image, git's safe.directory when git is declared, then one exec-form RUN of the runner binary's `minimize` role, so the resulting image holds only the declared commands (and the runner binary that serves the tools). The context is a generated Dockerfile under ctxDir. Returns the resolved package versions, read from the image whether it was built now or found; nil when no exec is declared.
An Unsafe Mode exec image (img.Unsafe) is built from the unsafe base instead and rebuilt when its last build left tools uninstalled; its result lists what installed, then what did not, each of those marked spec.ExecNotInstalledPrefix.
func EnsureHarnessImage ¶
func EnsureHarnessImage(ctx context.Context, d dockerx.Client, adapterName string, h policy.HarnessImage, logw io.Writer) error
EnsureHarnessImage makes adapterName's harness image h present: pulled by its pinned ref, which names a digest, or built here from the artifact it is pinned by. Setup prepares the default adapter's image with it, a run its plan's (EnsureInstalledFor).
func EnsureInstalled ¶
func EnsureInstalled(ctx context.Context, d dockerx.Client, pol *policy.Policy, runnerTag, imageCtxDir string, logw io.Writer, harnessImage bool, ) error
EnsureInstalled verifies the docker engine answers, pulls the pinned gateway + harness images if absent, and builds the local runner image from the embedded context if absent. Called from the install step of `agentry run`: after this returns nil, a run needs no further network access for infrastructure. harnessImage says whether this run needs the pinned harness image at all: an adapter that drives the person's own installation runs no container, so pulling docker-agent for it would be a download nobody asked for.
func EnsureInstalledFor ¶
func EnsureInstalledFor(ctx context.Context, d dockerx.Client, pol *policy.Policy, runnerTag, imageCtxDir string, logw io.Writer, plan *spec.Plan, ) error
EnsureInstalledFor is EnsureInstalled for one plan: the harness image prepared is the one the plan's adapter runs and no other, none for a host harness. A published image is pulled by its pinned ref; one pinned by the artifact it is built from is built on this machine (harnessbuild), refused when this build cannot build it.
func EnsurePodmanRuntime ¶
func EnsurePodmanRuntime(ctx context.Context, d dockerx.Client, e dockerx.Engine, pol *policy.Policy) error
EnsurePodmanRuntime is EnsureRuntime on podman: the policy's runtime, and the gateway's, are each tried by name (`podman --runtime <name> info`), since podman lists every runtime its configuration names, installed or not, and the gateway's registration is read for --host-uds=open and the runtime it runs. The sandbox is held through podman's own CLI alone: the docker CLI's route to podman cannot read a container's runtime back (podman's Docker-compatible API answers "oci" for every container), and a podman service on another machine (a podman machine) is refused by Engine.
func EnsureRunnerImage ¶
func EnsureRunnerImage(ctx context.Context, d dockerx.Client, pol *policy.Policy, runnerTag, imageCtxDir string, logw io.Writer) error
EnsureRunnerImage builds the local runner image from the embedded context when it is missing, and does nothing else: no daemon check, no pull. A step that needs only the runner's own binary (a later delivery) calls it alone.
func EnsureRuntime ¶
EnsureRuntime refuses, before anything is pulled or started, a policy whose docker.runtime the daemon has not registered: a run that quietly landed on runc after asking for runsc would carry a receipt claiming an isolation it did not have. The error names the runtime the policy wants and the ones the daemon has. The gateway's own runtime (docker.gatewayRuntime) is held to the same rule, and by what it runs as well as its name: it must be docker.runtime's binary registered again with --host-uds=open and nothing else, since the receipt says the gateway ran under it. An unset runtime asks nothing. On podman each name is tried (EnsurePodmanRuntime).
Types ¶
This section is empty.