Skip to content

feat(opencode): support native command invocation - #59

Merged
0xranx merged 3 commits into
0xranx:mainfrom
TheCaffinatedDeveloper:opencode_command_support
Sep 20, 2026
Merged

0xranx merged 3 commits into
0xranx:mainfrom
TheCaffinatedDeveloper:opencode_command_support

Conversation

@TheCaffinatedDeveloper

@TheCaffinatedDeveloper TheCaffinatedDeveloper commented Sep 9, 2026 •

Copy link
Copy Markdown

What does this PR do?

  • Adds an optional native-command capability to the engine interface and implements it for OpenCode using opencode run --command.
  • Exposes native commands through Assistant.command() and the authenticated POST /command SSE endpoint.
  • Adds IM gateway passthrough for unknown slash commands, while preserving Golem built-in command precedence and ordinary chat fallback for unsupported engines.
  • Hardens native command handling with trimmed argument forwarding, protected capability detection, single typing lifecycle, and group self-message, mention-only, and max-turn safeguards.
  • Adds coverage for command transport, validation, sessions, HTTP behavior, Slack thread isolation, gateway routing, and group safety behavior.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (describe below)

Checklist

  • pnpm run build passes
  • pnpm run test passes
  • New code has tests (if applicable)
  • Updated documentation (if applicable)

@0xranx

0xranx commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution! The build and 364 related tests pass, but I found three issues to address before merging:

  1. The new maxTurns check runs before the idle reset. Once a group hits the limit, slash commands stay blocked even after the cooldown. This also affects fallback chat on other engines.
  2. Native command names are lowercased: /ReviewAPI becomes reviewapi, but OpenCode looks up commands by their exact name. Please preserve the original case for native dispatch.
  3. Native replies don’t increment the group turn counter. With maxTurns: 1, two consecutive commands both execute.

I reproduced these with four additional regression tests, covering both native and fallback paths for the first issue. Could you fix these and add coverage? Real OpenCode CLI E2E testing is still pending.

@TheCaffinatedDeveloper

Copy link
Copy Markdown
Author

Thanks for the feedback, addressed in df8408c

@0xranx
0xranx merged commit a968b28 into 0xranx:main Sep 20, 2026
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.

3 participants