Skip to content

Add daemon-backed OpenCode npm plugin - #7

Draft
Stephen Belanger (Qard) wants to merge 7 commits into
agent/trace-attach-runfrom
agent/opencode-daemon-integration
Draft

Add daemon-backed OpenCode npm plugin#7
Stephen Belanger (Qard) wants to merge 7 commits into
agent/trace-attach-runfrom
agent/opencode-daemon-integration

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • import @braintrust/trace-opencode as monorepo-owned npm package content while preserving its four Braintrust data-access tools
  • delete the standalone JavaScript tracing processor, API sink, queue, replay, git metadata, file logger, and their tracing-only tests
  • keep OpenCode tracing as a thin fail-open adapter that forwards native events to the daemon and performs no span construction or Braintrust API delivery
  • keep direct Braintrust API access isolated to src/tools for the four explicit data-access tools
  • add the private reusable newline-delimited JSON-RPC client; shared daemon delivery now stamps braintrust.plugin.<source> using the package version supplied by each JavaScript adapter
  • send only an optional profile/org selection and typed project destination; the daemon host resolves the default or named profile and owns refresh
  • add the OpenCode Rust translator, npm tarball build/validation/publish-safety scripts, compatibility CI, and actual-agent integration coverage

Validation

  • make test
  • make validate-opencode
  • bun test src/runtime/js-daemon-client/tests
  • cargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked
  • cargo clippy --manifest-path bt-daemon/Cargo.toml --all-targets --all-features --locked -- -D warnings
  • BT_AGENT_INFERENCE_MODE=mock BT_AGENT_INGEST_MODE=mock cargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked --test agent_integration opencode_session_emits_traces -- --ignored --nocapture --test-threads=1 using OpenCode 1.18.13 locally
  • isolated tarball imports with the claimed OpenCode peer range in CI

The real-agent scenario installs the built npm tarball, loads it in the actual OpenCode CLI, calls deterministic mock inference, forwards native events over JSON-RPC, and verifies daemon-produced rows at mock Braintrust ingest. It also verifies shared OpenCode origin name and package version metadata.

Release safety

No npm package, marketplace repository, tag, or GitHub release was published. Real npm publishing requires an explicit release confirmation.

Merge dependency

This remains draft until the companion bt embedding implements AuthProvider through its existing non-interactive profile resolver. The profile is optional and resolves to the default automatically when omitted.

@Qard
Stephen Belanger (Qard) force-pushed the agent/opencode-daemon-integration branch from 99fe5ec to f0928df Compare August 5, 2026 18:11
@Qard
Stephen Belanger (Qard) changed the base branch from main to agent/trace-attach-run August 5, 2026 18:11
@Qard
Stephen Belanger (Qard) force-pushed the agent/opencode-daemon-integration branch from f0928df to b83b9ef Compare August 5, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant