Skip to content

Add daemon-backed OpenCode npm plugin #95

Add daemon-backed OpenCode npm plugin

Add daemon-backed OpenCode npm plugin #95

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
plugins:
name: Plugin packages
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up pinned Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Build and validate plugins
run: make test
js-daemon-client:
name: JavaScript daemon client (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up pinned Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Test RPC transport contracts
run: bun test src/runtime/js-daemon-client/tests
opencode-compatibility:
name: OpenCode package (${{ matrix.peer-version }})
strategy:
fail-fast: false
matrix:
peer-version: ["1.0.0", "latest"]
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up pinned Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Build validated tarball
run: make validate-opencode
- name: Install package with OpenCode peers
env:
PEER_VERSION: ${{ matrix.peer-version }}
run: |
set -euo pipefail
mkdir install-test
npm install --prefix install-test --no-audit --no-fund \
./dist/opencode/braintrust-trace-opencode-*.tgz \
"@opencode-ai/plugin@${PEER_VERSION}" \
"@opencode-ai/sdk@${PEER_VERSION}"
node -e 'import(process.argv[1]).then((m) => { if (typeof m.default !== "function") process.exit(1) })' \
"$PWD/install-test/node_modules/@braintrust/trace-opencode/dist/index.js"
daemon:
name: Daemon (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
agent_suffix: ""
- os: macos-latest
agent_suffix: ""
- os: windows-latest
agent_suffix: ".cmd"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
rustup component add clippy rustfmt
- name: Install latest coding agents
run: npm install --prefix "${{ runner.temp }}/coding-agents" --no-save --no-package-lock --no-audit --no-fund --cache "${{ runner.temp }}/npm-cache" @openai/codex@latest @anthropic-ai/claude-code@latest opencode-ai@latest
- name: Set up pinned Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Build OpenCode plugin for integration harness
run: make build-opencode
- name: Report coding-agent versions
run: |
npm exec --prefix "${{ runner.temp }}/coding-agents" -- codex --version
npm exec --prefix "${{ runner.temp }}/coding-agents" -- claude --version
npm exec --prefix "${{ runner.temp }}/coding-agents" -- opencode --version
- name: Check formatting
if: runner.os == 'Linux'
run: cargo fmt --manifest-path bt-daemon/Cargo.toml -- --check
- name: Build daemon
run: cargo build --manifest-path bt-daemon/Cargo.toml --all-features --locked
- name: Test daemon
run: cargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked
- name: Test coding-agent integrations with deterministic inference
env:
BT_AGENT_INFERENCE_MODE: mock
BT_AGENT_INGEST_MODE: mock
CODEX_BIN: ${{ runner.temp }}/coding-agents/node_modules/.bin/codex${{ matrix.agent_suffix }}
CLAUDE_BIN: ${{ runner.temp }}/coding-agents/node_modules/.bin/claude${{ matrix.agent_suffix }}
OPENCODE_BIN: ${{ runner.temp }}/coding-agents/node_modules/.bin/opencode${{ matrix.agent_suffix }}
run: cargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked --test agent_integration -- --ignored --nocapture --test-threads=1
- name: Lint daemon
run: cargo clippy --manifest-path bt-daemon/Cargo.toml --all-targets --all-features --locked -- -D warnings