Add chat.message fallback for /dcp-compress when host skips command registration - #610
Open
1kUnD0G wants to merge 1 commit into
Open
Add chat.message fallback for /dcp-compress when host skips command registration#6101kUnD0G wants to merge 1 commit into
1kUnD0G wants to merge 1 commit into
Conversation
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.
Fixes #609
Problem
On recent OpenCode versions (post Effect-refactor), the slash-command list is built as a one-shot snapshot in
packages/opencode/src/command/index.tsbefore pluginconfighooks run. DCP registers/dcp-compressinside itsconfighook, so the registration lands after the snapshot was taken and never gets picked up: the command is missing from autocomplete and typing it manually just sends a plain user message.Fix
Add a
"chat.message"hook as a fallback path:/dcp-compress, run the same manual-trigger flow as the slash command (handleManualTriggerCommand->state.manualMode = "compress-pending"->state.pendingManualTrigger), which the existingapplyPendingManualTriggerconsumes on the next messages transform./dcp-compress [focus]marker so downstream pruning/summary logic sees exactly what the slash-command path emits.state.pendingManualTriggeralready exists (the real slash-command path ran and set it), whencommands.enabledis false, or when compress permission resolves todeny.This makes
/dcp-compresswork even when the host never registered the command, with zero behavior change on hosts where registration works normally.Verification
npm run buildpasses (tsup + tsc)./dcp-compress <focus>fetches session state, sets the pending trigger, and normalizes the marker;ignored/syntheticparts are not intercepted.opencode.jsonworkaround for restoring autocomplete.