Repository navigation
feat: add OpenCode agent profile - #124
Merged
Merged
Conversation
Add support for OpenCode (anomalyco/opencode) as a dashboard agent. OpenCode is an open-source AI coding agent with multi-provider support (Anthropic, OpenAI, Gemini, Copilot, Bedrock, etc.). Profile configuration: - Install via npm (opencode-ai package) - Session resume via --continue flag - OTLP traces and logs enabled via OTEL_EXPORTER_OTLP_ENDPOINT - MCP server detection from ~/.opencode/config.json - Permission prompt detection for tool approval dialogs - spawn_settings patches experimental.openTelemetry into config Known limitations: - OTEL_SERVICE_NAME is hardcoded to 'opencode' in the CLI (anomalyco/opencode#25839). Agent ID resolution falls back to tool-type matching in _resolve_agent_id(). - No OTLP metrics export — token usage, cost, and activity counters are not available. Dashboard cards show model and activity from span attributes but no token/cost data. Also includes: - _merge_missing_keys(): Deep-merge for spawn_settings to support nested JSON config (e.g. experimental.openTelemetry). Replaces the flat key-only check that couldn't handle nested dicts. Backward compatible — flat keys work as before. - OpenCode fallback in _resolve_agent_id() for the hardcoded 'opencode' service.name. - 5 new unit tests (agent ID resolution + deep merge). Co-authored-by: Claude [email protected]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds OpenCode (formerly sst/opencode) as a supported agent in the dashboard.
Profile Details
opencode-ainpm packageopencode --continueOTEL_EXPORTER_OTLP_ENDPOINT(no metrics)~/.opencode/config.jsonKnown Limitations
OTEL_SERVICE_NAMEand hardcodes it to"opencode"(#25839). Agent ID resolution falls back to tool-type matching. Multiple simultaneous OpenCode sessions may have telemetry routing issues.Code Changes
agent/profiles/opencode.yaml— new profileagent/host_daemon.py:"opencode"to_resolve_agent_id()fallback hints_merge_missing_keys()for deep-merge of nested spawn_settings (OpenCode's config uses{"experimental": {"openTelemetry": true}})agent/tests/test_host_daemon.py— 5 new tests (agent ID resolution + deep merge)Testing
95 unit tests passing.