feat: enable GitLab Agent Platform with workflow model discovery (#18014)

This commit is contained in:
Vladimir Glafirov 2026-03-20 18:55:22 +01:00 committed by GitHub
parent 51618e9cef
commit 05d3e65f76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 393 additions and 181 deletions

View file

@ -722,7 +722,20 @@ Cloudflare Workers AI lets you run AI models on Cloudflare's global network dire
### GitLab Duo
GitLab Duo provides AI-powered agentic chat with native tool calling capabilities through GitLab's Anthropic proxy.
:::caution[Experimental]
GitLab Duo support in OpenCode is experimental. Features, configuration, and
behavior may change in future releases.
:::
OpenCode integrates with the [GitLab Duo Agent Platform](https://docs.gitlab.com/user/duo_agent_platform/),
providing AI-powered agentic chat with native tool calling capabilities.
:::note[License requirements]
GitLab Duo Agent Platform requires a **Premium** or **Ultimate** GitLab
subscription. It is available on GitLab.com and GitLab Self-Managed.
See [GitLab Duo Agent Platform prerequisites](https://docs.gitlab.com/user/duo_agent_platform/#prerequisites)
for full requirements.
:::
1. Run the `/connect` command and select GitLab.
@ -807,13 +820,15 @@ export GITLAB_TOKEN=glpat-...
```
:::note
Your GitLab administrator must enable the following:
Your GitLab administrator must:
1. [Duo Agent Platform](https://docs.gitlab.com/user/gitlab_duo/turn_on_off/) for the user, group, or instance
2. Feature flags (via Rails console):
- `agent_platform_claude_code`
- `third_party_agents_enabled`
:::
1. [Turn on GitLab Duo](https://docs.gitlab.com/user/duo_agent_platform/turn_on_off/#turn-gitlab-duo-on-or-off)
for the user, group, or instance
2. [Turn on the Agent Platform](https://docs.gitlab.com/user/duo_agent_platform/turn_on_off/#turn-gitlab-duo-agent-platform-on-or-off)
(GitLab 18.8+) or [enable beta and experimental features](https://docs.gitlab.com/user/duo_agent_platform/turn_on_off/#turn-on-beta-and-experimental-features)
(GitLab 18.7 and earlier)
3. For Self-Managed, [configure your instance](https://docs.gitlab.com/administration/gitlab_duo/configure/gitlab_self_managed/)
:::
##### OAuth for Self-Hosted instances
@ -831,7 +846,7 @@ Then expose application ID as environment variable:
export GITLAB_OAUTH_CLIENT_ID=your_application_id_here
```
More documentation on [opencode-gitlab-auth](https://www.npmjs.com/package/@gitlab/opencode-gitlab-auth) homepage.
More documentation on [opencode-gitlab-auth](https://www.npmjs.com/package/opencode-gitlab-auth) homepage.
##### Configuration
@ -843,17 +858,27 @@ Customize through `opencode.json`:
"provider": {
"gitlab": {
"options": {
"instanceUrl": "https://gitlab.com",
"featureFlags": {
"duo_agent_platform_agentic_chat": true,
"duo_agent_platform": true
}
"instanceUrl": "https://gitlab.com"
}
}
}
}
```
##### GitLab Duo Agent Platform (DAP) Workflow Models
DAP workflow models provide an alternative execution path that routes tool calls
through GitLab's Duo Workflow Service (DWS) instead of the standard agentic chat.
When a `duo-workflow-*` model is selected, OpenCode will:
1. Discover available models from your GitLab namespace
2. Present a selection picker if multiple models are available
3. Cache the selected model to disk for fast subsequent startups
4. Route tool execution requests through OpenCode's permission-gated tool system
Available DAP workflow models follow the `duo-workflow-*` naming convention and
are dynamically discovered from your GitLab instance.
##### GitLab API Tools (Optional, but highly recommended)
To access GitLab tools (merge requests, issues, pipelines, CI/CD, etc.):
@ -861,7 +886,7 @@ To access GitLab tools (merge requests, issues, pipelines, CI/CD, etc.):
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@gitlab/opencode-gitlab-plugin"]
"plugin": ["opencode-gitlab-plugin"]
}
```