Summary
On a fresh install, the plugin silently fails to load: no /dcp or /dcp-compress commands, no compress tool, no prune notifications, and no debug logs are ever written even with "debug": true. The root cause is a missing transitive dependency tiktoken in the installed plugin tree, which makes importing the plugin entry throw before any of DCP's code runs.
Environment
- OS: Windows 11
- opencode:
1.17.9 (reproduced in both the Electron Desktop app and the terminal TUI)
- DCP:
@tarquinen/opencode-dcp@latest → resolved to 3.1.13
- Installed via:
opencode plugin @tarquinen/opencode-dcp@latest --global
Root cause
The package's runtime dependency chain is:
@tarquinen/opencode-dcp
└─ @anthropic-ai/tokenizer@0.0.4
└─ tiktoken@^1.0.10 ← NOT installed
opencode installs DCP into its plugin cache at
~/.cache/opencode/packages/@tarquinen/opencode-dcp@latest/node_modules.
That tree contains @anthropic-ai/tokenizer but tiktoken is missing entirely (no directory anywhere under it). Because @anthropic-ai/tokenizer/dist/cjs/index.js does require("tiktoken/lite"), importing the plugin entry throws:
Cannot find module 'tiktoken/lite' from
'...\.cache\opencode\packages\@tarquinen\opencode-dcp@latest\node_modules\@anthropic-ai\tokenizer\dist\cjs\index.js'
opencode catches this and silently drops the plugin — nothing is surfaced to the user, which is why it looks like the install "did nothing" (commands absent, no logs even with debug on).
Reproduction
- Install on a clean machine:
opencode plugin @tarquinen/opencode-dcp@latest --global, restart opencode.
- Observe
/dcp is not available and ~/.config/opencode/logs/dcp/ is never created (even with "debug": true in dcp.jsonc).
- Confirm the broken import directly:
bun -e "await import('file:///<HOME>/.cache/opencode/packages/@tarquinen/opencode-dcp@latest/node_modules/@tarquinen/opencode-dcp/dist/index.js').then(m=>console.log('OK')).catch(e=>console.log('IMPORT ERROR:',e.message))"
# IMPORT ERROR: Cannot find module 'tiktoken/lite' from '...@anthropic-ai/tokenizer/dist/cjs/index.js'
Workaround (confirmed fix)
Manually installing the missing transitive dep into the plugin cache resolves it; after restart /dcp + /dcp-compress appear and debug logs are written:
npm install tiktoken@^1.0.10 --no-save --prefix "$HOME\.cache\opencode\packages\@tarquinen\opencode-dcp@latest"
After the patch the same import returns OK.
Suggested fix
tiktoken is currently only a transitive dependency, and opencode's installer is not pulling it. Two options inside DCP's control:
- (preferred, minimal) Promote
tiktoken to a direct dependency in package.json. Direct deps are installed reliably by opencode's installer; the failing one here was a child of @anthropic-ai/tokenizer.
- Bundle
@anthropic-ai/tokenizer via tsup noExternal (the same approach already used for jsonc-parser). Note tiktoken ships a .wasm, so this path needs wasm asset handling.
This is the same class of "plugin silently fails to load" regression seen in #432, #507, and #511, all of which were addressed by bundling more into the tsup output (PR #499). This time the trigger is the un-installed tiktoken transitive dep specifically.
Summary
On a fresh install, the plugin silently fails to load: no
/dcpor/dcp-compresscommands, no compress tool, no prune notifications, and no debug logs are ever written even with"debug": true. The root cause is a missing transitive dependencytiktokenin the installed plugin tree, which makes importing the plugin entry throw before any of DCP's code runs.Environment
1.17.9(reproduced in both the Electron Desktop app and the terminal TUI)@tarquinen/opencode-dcp@latest→ resolved to3.1.13opencode plugin @tarquinen/opencode-dcp@latest --globalRoot cause
The package's runtime dependency chain is:
opencode installs DCP into its plugin cache at
~/.cache/opencode/packages/@tarquinen/opencode-dcp@latest/node_modules.That tree contains
@anthropic-ai/tokenizerbuttiktokenis missing entirely (no directory anywhere under it). Because@anthropic-ai/tokenizer/dist/cjs/index.jsdoesrequire("tiktoken/lite"), importing the plugin entry throws:opencode catches this and silently drops the plugin — nothing is surfaced to the user, which is why it looks like the install "did nothing" (commands absent, no logs even with debug on).
Reproduction
opencode plugin @tarquinen/opencode-dcp@latest --global, restart opencode./dcpis not available and~/.config/opencode/logs/dcp/is never created (even with"debug": trueindcp.jsonc).Workaround (confirmed fix)
Manually installing the missing transitive dep into the plugin cache resolves it; after restart
/dcp+/dcp-compressappear and debug logs are written:After the patch the same
importreturnsOK.Suggested fix
tiktokenis currently only a transitive dependency, and opencode's installer is not pulling it. Two options inside DCP's control:tiktokento a directdependencyinpackage.json. Direct deps are installed reliably by opencode's installer; the failing one here was a child of@anthropic-ai/tokenizer.@anthropic-ai/tokenizerviatsupnoExternal(the same approach already used forjsonc-parser). Notetiktokenships a.wasm, so this path needs wasm asset handling.This is the same class of "plugin silently fails to load" regression seen in #432, #507, and #511, all of which were addressed by bundling more into the tsup output (PR #499). This time the trigger is the un-installed
tiktokentransitive dep specifically.