19 Commits

Author SHA1 Message Date
218dc1d0d1 update readme to reflect new config system 2026-10-22 10:09:29 +02:00
9246decc9f move permissions config to new v2 format 2026-10-21 10:09:46 +02:00
1ce6cea6c9 convert provider config to new v2 providers config 2026-10-20 15:13:02 +02:00
5b7c1f98bd use agents.title.model instead of small_model 2026-10-20 14:59:41 +02:00
5bd2eb398e config(opencode): drop lsp configuration 2026-10-20 14:58:22 +02:00
3e373104e7 update opencode image to feature-opencode-v2 tag 2026-10-20 14:57:30 +02:00
b98130e648 bump opencode container to 0.0.2
provides more tools in the base image
2026-10-07 07:32:31 +00:00
581e5ed5ac make glm-5.3-flash the default 2026-10-06 11:11:01 +00:00
ca7eaf3776 update model config
- made glm-5.3 the default
- added glm-5.3-flash as the small default
- replaced glm-5.2 with mistral glm-5.2
- dropped sonnet
2026-09-08 11:46:44 +02:00
4b430129e6 Revert "run opencode in "interactive shell" mode"
This reverts commit 520943689a.
2026-09-08 11:36:54 +02:00
520943689a run opencode in "interactive shell" mode
this should resolve any clipboard issues with copying and pasting text
2026-07-07 12:05:59 +00:00
5b240e8d95 improve readme readability and add some tutorials 2026-07-06 12:55:36 +02:00
Aad Versteden
1f357fe2e3 Remove version keyword
Because Docker doesn't understand that version has a value for documentation, we
otherwise get an error.
2026-07-02 17:07:28 +02:00
Aad Versteden
4425dcfd41 Curate models for getting started easily 2026-07-02 17:05:39 +02:00
felix
539d2eb4d6 remove trailing whitespace 2026-07-02 16:21:12 +02:00
5675c5e75a Merge pull request 'adds scaleway glm as an alternative to glm from deepinfra' (#1) from scaleway-glm into master
Reviewed-on: #1
2026-07-02 14:17:56 +00:00
felix
1d45a7caea remove Dockerfile 2026-07-02 16:17:15 +02:00
felix
8a4e21fc2e Update README.md 2026-07-02 16:17:02 +02:00
felix
113db0b0dd Build version 2026-07-02 16:13:14 +02:00
4 changed files with 181 additions and 186 deletions

126
README.md
View File

@@ -1,51 +1,139 @@
# app-opencode-experiment # app-opencode
[opencode](https://opencode.ai/) in a Docker container, wired to [weave](https://weave.redpencil.io) as the model provider. Default model `weave/glm-5.2`. LSP baked in for TypeScript/JS and Python. [opencode](https://opencode.ai/) packaged in a Docker container and wired to
[weave](https://weave.redpencil.io) as the model provider. It ships with an
LSP for TypeScript/JavaScript and Python baked in, so opencode gets real
type-aware navigation out of the box. The default model is `weave/glm-5.2`.
## Setup The docs below are split into three parts: a **Getting started** walkthrough to
run it the first time, **How-to guides** for specific tasks, and a **Reference**
for the moving parts.
Create a `docker-compose.override.yml` (gitignored) with your weave key and repo mount: ## Getting started
A first run from a clean checkout.
1. **Get a weave API key.** You need an account on
[weave.redpencil.io](https://weave.redpencil.io/ui/) and/or an API key (ask us!).
2. **Create your local override.** `docker-compose.override.yml` is gitignored
and holds your key plus the repo you want opencode to work on. Create it with
your key and mount:
```yaml ```yaml
services: services:
opencode: opencode:
environment: environment:
WEAVE_API_KEY: "..." WEAVE_API_KEY: "your-key-here"
volumes: volumes:
- /path/to/your/repo:/workspace/repo - /path/to/your/repo:/workspace/repo
``` ```
Then: 3. **Start the container.**
``` ```
drc up -d drc up -d
```
4. **Open the TUI.**
```
drc exec opencode opencode drc exec opencode opencode
``` ```
## TUI You're now in opencode, talking to `weave/glm-5.2`. Type `/models` to switch
models, or just start prompting.
In the TUI, type `/models` to select a model from the registered weave models. ## How-to guides
## Layout ### Switch the model in a session
- `config/opencode/` - image: Dockerfile + `opencode.json` (mounted live, see below) In the TUI, type `/models` and pick from the registered weave models. This only
- `data/` - persisted opencode state (gitignored) changes the current session; to change the default for every session, edit
- `docker-compose.yml` - opencode service `opencode.json` (see below).
## Updating the config ### Change the default model
`opencode.json` is mounted into the container, so edits take effect with a restart — no rebuild needed: Edit `model` (and optionally `agents.title.model`) in
[`config/opencode/opencode.json`](config/opencode/opencode.json), then apply the
change:
``` ```
drc restart opencode drc restart opencode
``` ```
Rebuild only when changing the `Dockerfile` or installed packages: `opencode.json` is mounted into the container, so a restart is all that's
needed.
``` ### Register a new weave model
drc build opencode
Add the model under `providers.weave.models` in `opencode.json`:
```json
"provider": {
"weave": {
"models": {
"my-new-model": {
"capabilities" {
"tools": true
}
}
}
}
}
``` ```
## Caveats Then `drc restart opencode`. It will show up in the `/models` picker.
See the [model list on weave](https://weave.redpencil.io/ui/models-and-endpoints/) for an overview of available models. Need another model, please let us know :)
- Copy from the TUI is weird over Docker: To copy text out of the opencode TUI running in a container, I have to do `Shift`+click to select the text, then `Ctrl`+`Shift`+`C` to copy. Plain `COPY` doesn't work. ### Copy text out of the TUI
Copying from the opencode TUI over Docker is fiddly: `Shift`+click to select the
text, then `Ctrl`+`Shift`+`C` to copy. A plain copy doesn't work.
### Connect opencode to a (backend) service
To let opencode call a service over HTTP, e.g. a stack you've brought up in dev
mode and want the agent to follow up against, have that stack join opencode's
network instead of publishing ports or going via the host.
opencode's stack creates a default network named `app-opencode_default`. Attach the
dev-mode service to it as an external network:
```yaml
# the dev-mode app stack
services:
app:
networks:
- default
- app-opencode_default
networks:
app-opencode_default:
external: true
```
opencode can then reach it at `http://app:<port>`, where `app` is the **service
name** from that stack's compose and `<port>` is the container's *internal* port.
> Note: Bring the opencode stack up first, so `app-opencode_default` exists before adding to your app.
## Reference
### `opencode.json` keys
- **`model`** — default model.
- **`agents.title.model`** — model used to generate session titles (replaces deprecated `small_model`)
- **`providers.weave`** — the weave provider, using the
`@opencode/ai/providers/openai-compatible` adapter against `https://weave.redpencil.io/v1`
with the key from `WEAVE_API_KEY`.
- **`providers.weave.models`** — the models offered in `/models`.
- **`permissions`** — set to `ask` for read, edit, bash, and external-directory
actions, so opencode prompts before acting.
Check-out https://opencode.ai/v2/docs/config/ for more options.
### Caveats
- Copy from the TUI over Docker needs the `Shift`+click / `Ctrl`+`Shift`+`C`
dance described above.

View File

@@ -1,19 +0,0 @@
FROM node:22-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl ca-certificates python3 \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g \
opencode-ai@1.17.9 \
typescript \
typescript-language-server \
pyright
ENV NODE_PATH=/usr/local/lib/node_modules
COPY opencode.json /root/.config/opencode/opencode.json
WORKDIR /workspace
CMD ["sleep", "infinity"]

View File

@@ -1,155 +1,83 @@
{ {
"$schema": "https://opencode.ai/config.json", "$schema": "https://opencode.ai/config.json",
"model": "weave/glm-5.2", "model": "weave/glm-5.3-flash",
"small_model": "weave/glm-5.2", "agents": {
"lsp": { "title": {
"typescript": { "model": "weave/glm-5.3-flash"
"command": [
"typescript-language-server",
"--stdio"
],
"extensions": [
".ts",
".tsx",
".js",
".jsx",
".mjs",
".cjs",
".mts",
".cts"
]
},
"pyright": {
"command": [
"pyright-langserver",
"--stdio"
],
"extensions": [
".py",
".pyi"
]
} }
}, },
"provider": { "providers": {
"weave": { "weave": {
"npm": "@ai-sdk/openai-compatible", "package": "@opencode/ai/providers/openai-compatible",
"options": { "settings": {
"baseURL": "https://weave.redpencil.io/v1", "baseURL": "https://weave.redpencil.io/v1",
"apiKey": "{env:WEAVE_API_KEY}" "apiKey": "{env:WEAVE_API_KEY}"
}, },
"models": { "models": {
"claude-sonnet": { "kimi-K2.7-code": {
"capabilities": {
"tools": true "tools": true
},
"claude-opus": {
"tools": true
},
"claude-haiku": {
"tools": true
},
"Mistral-Small-3.2-24B-Instruct-2506": {
"tools": true
},
"phi-4": {
"tools": true
},
"gemini-3.5-flash": {
"tools": true
},
"gemini-3.1-pro": {
"tools": true
},
"qwen3.6-35B-A3B": {
"tools": true
},
"qwen3-coder-480B-A35B-Instruct": {
"tools": true
},
"glm-5.2": {
"tools": true
},
"scaleway-glm-5.2": {
"tools": true,
"options": {
"max_tokens": 16384
} }
}, },
"kimi-K2.7-code": { "glm-5.3": {
"capabilities": {
"tools": true "tools": true
}
}, },
"MiniMax-M2.7": { "glm-5.3-flash": {
"capabilities": {
"tools": true "tools": true
}
}, },
"DeepSeek-V4-Flash": { "mistral-glm-5.2": {
"tools": true "capabilities": {
"tools": true,
"reasoning": {
"supported": true
}
}, },
"DeepSeek-V4-Pro": { "settings": {
"tools": true "reasoningEffort": "xhigh"
}, }
"nemotron-3-ultra": {
"tools": true
},
"mimo-v2.5-pro": {
"tools": true
},
"qwen3-max-thinking": {
"tools": true
},
"gpt-oss-120b": {
"tools": true
},
"mistral-large": {
"tools": true
},
"mistral-medium": {
"tools": true
},
"mistral-small": {
"tools": true
},
"magistral-medium": {
"tools": true
},
"magistral-small": {
"tools": true
},
"codestral": {
"tools": true
}, },
"devstral": { "devstral": {
"capabilities": {
"tools": true "tools": true
}, }
"mistral-embed": {
"tools": false
},
"mistral-ocr": {
"tools": false
},
"ministral-14b": {
"tools": true
},
"ministral-8b": {
"tools": true
},
"ministral-3b": {
"tools": true
},
"local-gemma3:27b-it-qat": {
"tools": true
},
"local-gpt-oss:20b": {
"tools": true
}, },
"local-qwen3.6:27b": { "local-qwen3.6:27b": {
"capabilities": {
"tools": true
}
},
"mistral-medium": {
"capabilities": {
"tools": true "tools": true
} }
} }
} }
}
}, },
"permission": { "permissions": [
"read": "ask", {
"edit": "ask", "action": "read",
"bash": "ask", "resource": "*",
"external_directory": "ask" "effect": "ask",
} },
{
"action": "edit",
"resource": "*",
"effect": "ask",
},
{
"action": "shell",
"resource": "*",
"effect": "ask",
},
{
"action": "external_directory",
"resource": "*",
"effect": "ask",
},
],
} }

View File

@@ -1,8 +1,6 @@
version: '3.7'
services: services:
opencode: opencode:
build: ./config/opencode/ image: redpencil/opencode:feature-opencode-v2
volumes: volumes:
- ./data/opencode/share:/root/.local/share/opencode - ./data/opencode/share:/root/.local/share/opencode
- ./config/opencode/opencode.json:/root/.config/opencode/opencode.json - ./config/opencode/opencode.json:/root/.config/opencode/opencode.json