Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
- name: Set up pnpm
uses: pnpm/action-setup@v6
with:
# Pinned to the version that generated pnpm-lock.yaml; `allowBuilds`
# in pnpm-workspace.yaml is a pnpm 10+ feature.
version: 12.21.0
# Pinned to the version in `packageManager`; `allowBuilds` in
# pnpm-workspace.yaml is a pnpm 10+ feature. Bump both together.
version: 12.25.1

- name: Set up Node.js
uses: actions/setup-node@v7
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
- name: Set up pnpm
uses: pnpm/action-setup@v6
with:
version: 12.21.0
version: 12.25.1

- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v7
Expand All @@ -115,3 +115,11 @@ jobs:

- name: Test
run: pnpm test

# `pnpm test` runs the TypeScript sources through vitest, so nothing above
# proves that the emitted `dist/` actually boots. Start it and probe /health.
- name: Smoke the built output
run: pnpm smoke:dist

- name: Audit the production dependencies
run: pnpm audit --prod
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ These were verified against `opencode serve` 2.3.2; re-read
`http(s)` URLs are rejected, so remote media must be fetched and inlined.
* `/api/event` is a single global SSE stream; frames are `data: {json}` with the
discriminator **inside** the JSON (`type`), plus `: heartbeat` comments. The
stream is volatile — handle reconnects by reconciling from
`GET /api/session/{id}/message`.
stream is volatile. A mid-turn reconnect is **not** reconciled from
`GET /api/session/{id}/message`: `runCompletion` keeps a 5 s grace window for
the terminal event and otherwise fails the turn with `503 event_stream_lost`.
* `time.released` is in **milliseconds**; OpenAI's `created` is in seconds.
* The free tier answers `429 provider.free-limit` with `retryAfterMs`. A live test
failing with 429 is an environment problem, not a code defect — do not "fix"
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ Both print the resulting key; edit `.env` directly to set a specific value. Run
`pnpm setup -- --random --force` to rotate an existing custom key.

With no `.env` at all the gateway still starts and logs a warning that the default
key is in use. `OPENCODE_ALLOW_NO_AUTH=true` disables authentication entirely on a
key is in use. The same warning is logged when `.env` lists the published key
explicitly, which is what `.env.example` and `pnpm setup` do — `GET /admin/config`
reports `auth.usingDefaultApiKey: true` in both cases.
`OPENCODE_ALLOW_NO_AUTH=true` disables authentication entirely on a
trusted loopback host.

Health check:
Expand Down Expand Up @@ -403,9 +406,13 @@ Limitations, stated plainly:
`patch`, `task`, `skill`) for that session, so the model cannot "answer" your
request by running its own shell or web tools instead of emitting a bridged
call. This is controlled by `OPENCODE_TOOL_BRIDGE_DENY_NATIVE_TOOLS` (default
`true`); the deny rules are merged on top of `OPENCODE_AGENT_PERMISSIONS`.
`true`); the deny rules are merged on top of `OPENCODE_AGENT_PERMISSIONS`. The
rules apply whenever `tools` is non-empty — even with `tool_choice: "none"`,
which disables the bridge instructions but never the containment.
* `tool_choice: "none"` disables the bridge; `"required"` and a named tool are
rendered as instructions, not as a hard guarantee.
rendered as instructions, not as a hard guarantee. A `tool_choice` that requires
a tool while `tools` is absent or empty is rejected with
`400 invalid_request` (`param: "tool_choice"`).
* **Native** OpenCode tool activity (the `build` agent reading files, running
commands) is *not* part of the OpenAI or Anthropic contract. It is reported as
the non-standard `x_opencode.native_tool_calls` field of the final payload (an
Expand Down Expand Up @@ -509,9 +516,12 @@ Every variable, with types, defaults and security notes:
hashed and compared, so reuse can never change semantics: on any mismatch the
gateway starts a fresh session and replays. The cache holds
`OPENCODE_SESSION_MAX` entries for `OPENCODE_SESSION_TTL_MS` and is keyed by
model + agent + variant + tool-set hash + conversation root. Pass
model + agent + variant + tool-set hash + permission profile + conversation
root. Pass
`x-conversation-id` to control the key explicitly, or set
`OPENCODE_SESSION_CACHE=false` for fully stateless routing.
`OPENCODE_SESSION_CACHE=false` for fully stateless routing. An explicit key is
still only reused while the message prefix, the model, the agent, the variant,
the tool set and the permission profile match.
* **Free-tier rate limits.** The bundled free models are limited per model and
per window upstream. The gateway answers `429` with a `retry-after` header in
seconds and repeats the upstream message; back off for that long. A stream
Expand Down
Loading