- Bump go.mod and Dockerfile from go 1.26.5 to go 1.27.0
- Run go mod tidy to update checksums
- Remove obsolete // +build build tag from e2e/binary/binary_test.go
- Use slices.Backward in cmd/wasm/runtime_wasm.go reverse loop
- Use strings.CutLast (new in Go 1.27) at 6 sites:
pkg/toolinstall/installer.go, pkg/model/provider/dmr/available.go,
pkg/model/provider/dmr/pull.go, pkg/config/auto.go,
pkg/modelinfo/modelinfo.go (×2)
- Bump golangci-lint from v2.12.2 to v2.13.1 (v2.12.2 panics on
Go 1.27 AST via staticcheck v0.7.0)
Drop Exec and ExecWithEnv wrappers that minted context.Background and update binary_required tests to pass t.Context() through the existing context-aware helpers.
Annotate the remaining context.Background()/TODO() call sites that are
legitimate independent roots with //rubocop:disable Lint/ContextConnectivity.
These fall into a few categories that cannot (and should not) derive from
the program's root context:
- Bubble Tea event-loop handlers (pkg/tui): Update/Init and tea.Cmd
callbacks have no context parameter, and appModel deliberately does not
store the root ctx — threading it would make persistence writes
cancellable at shutdown.
- runtime.Runtime / interface implementations with fixed signatures
(remote_runtime, LocalRuntime Steer/FollowUp, accessors).
- Shutdown/flush paths that must outlive the cancelled parent ctx
(otel providers, HTTP server Shutdown, OAuth callback servers).
- sync.Once / memoized initializers and deliberately detached subprocesses
(gateway catalog, LSP process, sound, event hooks).
- Test/e2e helpers (pkg/fake, e2e/binary).
No behavior change.
Expose any docker-agent agent through an OpenAI-compatible HTTP
server, so tools that already speak the Chat Completions protocol
(Open WebUI, the official `openai` SDKs, ad-hoc curl scripts, etc.)
can drive an agent without any custom integration.
Endpoints:
GET /v1/models — lists exposed agents as OpenAI models
POST /v1/chat/completions — runs the agent; supports stream: true
(Server-Sent Events) and false
The team is loaded once at startup and shared across requests; each
chat completion gets a fresh session and runtime. Tool calls and
elicitation prompts are auto-handled (this is a non-interactive
endpoint). The `model` field can pin a specific agent in a multi-
agent team, or is ignored and the team's default agent runs.
Implementation notes:
- New `cmd/root/chat.go` cobra command (default 127.0.0.1:8083,
--agent / --listen flags) wired into `cmd/root/serve.go`.
- New `pkg/chatserver` package, split into:
- server.go — Run, router, HTTP handlers, sseStream, errors
- agent.go — agentPolicy, buildSession, runAgentLoop, sessionUsage
- types.go — request/response shapes
- Reuses `openai.Model` from github.com/openai/openai-go/v3 for
/v1/models. Other OpenAI SDK response types serialise too noisily
with stdlib `encoding/json` (the SDK relies on its internal
`apijson` package which we can't import), so request/response
shapes are hand-rolled for clean output.
- Defensive event handling in runAgentLoop: ToolsApproved=true and
NonInteractive=true mean the runtime never blocks for confirmation
in normal flow, but ElicitationRequestEvent must still be answered
or the runtime would hang on its dedicated channel.
Tests cover session-building, agent-policy, error-envelope shape,
and the three early-validation paths of /v1/chat/completions via
httptest. Validated with `mise lint` (0 issues), `mise test` (all
packages green), and a curl smoke test against examples/42.yaml.
Fixesdocker/docker-agent#2502
Assisted-By: docker-agent
Also simplifies the aqua registry from which lsp commands are downloaded from
Fixes#1969
Assisted-By: cagent
Signed-off-by: David Gageot <david.gageot@docker.com>