9 Commits
Author SHA1 Message Date
Arnaud Héritier 2bb1e4b264 chore: upgrade to Go 1.27.0 and apply 1.27 modernizations
- 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)
2026-08-23 09:35:49 +00:00
David Gageot 69231c755e test: add t.Parallel() to eligible tests
Assisted-By: Claude
2026-06-29 13:39:47 +02:00
David Gageot 8458a0ba1b test(e2e): remove contextless binary exec helpers
Drop Exec and ExecWithEnv wrappers that minted context.Background and update binary_required tests to pass t.Context() through the existing context-aware helpers.
2026-06-29 10:17:44 +02:00
David Gageot 7ed9f788b8 chore: suppress intentional detached-context roots (Lint/ContextConnectivity)
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.
2026-06-29 10:16:55 +02:00
David Gageot 4f7d8f8d68 feat: add docker agent serve chat command (OpenAI-compatible API)
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.

Fixes docker/docker-agent#2502

Assisted-By: docker-agent
2026-04-27 15:46:10 +02:00
David Gageot dc49baf94d Add LSP multiplexer to support multiple LSP toolsets
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>
2026-03-09 14:40:04 +01:00
Guillaume Tardif ff1d1178c6 auto-complete tests
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2026-03-09 10:08:29 +01:00
David Gageot 5aed75d972 Fix cobra command and rename more things from cagent to docker agent
Signed-off-by: David Gageot <david.gageot@docker.com>
2026-03-07 19:20:39 +01:00
Guillaume Tardif 5ea4c7e01b Add e2e tests on binaries, checking cli plugin execution
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2026-02-20 19:00:52 +01:00