Skip to content

fix: add tiktoken as a direct dependency#576

Open
licat2023 wants to merge 1 commit into
Opencode-DCP:masterfrom
licat2023:fix/missing-tiktoken-dep
Open

fix: add tiktoken as a direct dependency#576
licat2023 wants to merge 1 commit into
Opencode-DCP:masterfrom
licat2023:fix/missing-tiktoken-dep

Conversation

@licat2023

Copy link
Copy Markdown

Problem

On a fresh install (3.1.13), the plugin silently fails to load: no /dcp or /dcp-compress commands, no compress tool, no prune notifications, and no debug logs are written even with "debug": true.

Root cause

@anthropic-ai/tokenizer does require("tiktoken/lite"), but tiktoken is only a transitive dependency. opencode's plugin installer does not always install it into the plugin cache (~/.cache/opencode/packages/@tarquinen/opencode-dcp@latest/node_modules), so importing the plugin entry throws:

Cannot find module 'tiktoken/lite' from '...@anthropic-ai/tokenizer/dist/cjs/index.js'

opencode catches this and silently drops the whole plugin, so nothing is surfaced to the user.

Fix

Promote tiktoken to a direct dependency. Direct dependencies are installed reliably by opencode's installer; the one that went missing here was a child of @anthropic-ai/tokenizer. tiktoken was already present in package-lock.json as a transitive dep (1.0.22), so this only adds the top-level declaration — no version change, no new resolution.

Verification

Reproduced the broken import, applied the equivalent of this change to the installed cache, then re-imported:

bun -e "await import('.../dist/index.js')"  # before: IMPORT ERROR: Cannot find module 'tiktoken/lite'
                                            # after:  OK

After the fix, restarting opencode exposes /dcp + /dcp-compress and DCP debug logs are written as expected.

Closes #575

@anthropic-ai/tokenizer requires tiktoken (tiktoken/lite), but tiktoken
was only a transitive dependency. opencode's plugin installer does not
always install it into the plugin cache, so importing the plugin entry
throws "Cannot find module 'tiktoken/lite'" and opencode silently drops
the whole plugin (no /dcp or /dcp-compress commands, no compress tool,
and no debug logs even with debug enabled).

Promoting tiktoken to a direct dependency makes the installer fetch it
reliably.

Closes Opencode-DCP#575
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.

[Bug]: Plugin silently fails to load — missing transitive dep 'tiktoken' (3.1.13)

1 participant