feat(opencode): add non-breaking V2 plugin entrypoint - #729
Open
pascalandr wants to merge 1 commit into
Open
Conversation
Preserve the existing root export and V1 hook adapter while exposing @dietrichgebert/ponytail/v2 for OpenCode 2 beta configurations. Register Ponytail commands and skills through V2 transforms, inject mode-aware instructions through the session context hook, and retain the single-system-entry behavior required by Qwen-compatible providers. Support both the current documented skill source draft and beta-17595's direct skill registration shape. Document the V2 beta caveat and the lack of a command lifecycle hook, including the supported persistent default mechanism. Add structural tests for package resolution, transforms, and context mutation; validate with the full suite and an isolated beta server API load test.
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
@dietrichgebert/ponytail/v2package export while leaving the root V1 export unchangedctx.session.hook("context"), appending to the existingSystemPartso Qwen-compatible requests keep one system entryCompatibility rationale
V1 plugins do not run under V2, but changing Ponytail's root export would break existing V1 consumers. The new subpath keeps
@dietrichgebert/ponytailand@dietrichgebert/ponytail/pluginon the existing V1 adapter and gives V2 an explicit default{ id, setup }entrypoint.The current V2 docs expose skill directory registration through
draft.source(...). Installed beta0.0.0-beta-17595instead exposesdraft.add(...). The adapter prefers the documented source API and has a small direct-definition fallback for that concrete beta, verified against the installed runtime.V2 currently has no command execution lifecycle hook equivalent to V1's
command.execute.before. The adapter therefore does not infer mode changes from messages or command templates./ponytail <level>affects that command prompt only; persistent defaults remain available throughPONYTAIL_DEFAULT_MODEor Ponytail'sdefaultModeconfig, which the context hook reads each turn. V1 mode persistence is unchanged.Validation
npm test: 88 root tests, 23 Pi tests, and 3 MCP tests passnode --test tests/opencode-plugin.test.js tests/opencode-v2-plugin.test.js: 12/12 passnpm pack --dry-run --json: confirms.opencode/plugins/ponytail-v2.mjsships@dietrichgebert/ponytail/v2opencode2 v0.0.0-beta-17595, privateserve, temporaryXDG_CONFIG_HOMEplus the Windows-specificOPENCODE_CONFIG_DIRoverride:/api/pluginincludesponytail/api/commandlists all sixponytail*commands/api/skilllists all sixponytail*skillsThe temporary server, config root, and temporary pandas test dependency were removed afterward. The user's global OpenCode config and V1 state were not modified.