Commit Graph
1 Commits
Author SHA1 Message Date
yetone 3c921835d0 library: RTK switches on for OpenCode 2 with rtk 0.52 or newer, not "Not for OpenCode 2" (#2295, witt-bit)
The RTK tab blocked OpenCode 2 whatever rtk was installed: rtk's
OpenCode plugin used to be written for OpenCode 1 only, which OpenCode 2
refuses ("Plugin must export a default definition with an id and an
effect or setup function", rtk-ai/rtk#4311). rtk-ai/rtk#4187 (merged
10-12, first released in rtk 0.52.0, also in 1.0.0 and 1.0.1, the
reporter's) writes one default object with OpenCode 2's id and setup()
beside OpenCode 1's server(). Checked with gh: 0.52.0's and 1.0.1's
hooks/opencode/rtk.ts are byte-identical, 0.51.0's is the old named
export.

- openCodeBlocked: with OpenCode 2, blocked only when rtk is older than
  0.52 or doesn't say its version; the reason now says to update RTK.
  OpenCode 1 is unchanged with any rtk.
- openCodeHas: under OpenCode 2, an old plugin (no setup()) left from
  before an rtk update counts as off once the rtk here is 0.52+, so
  switching it on runs rtk init, which writes the new one over it. With
  an older rtk it still counts as on, so it can be switched off.
- GUI: the OpenCode row's tag is "Update RTK" with OpenCode 2 reasons
  (on: refuses this plugin, update or switch off; off: needs 0.52), in
  en, zh, zh-TW, ja, de; the "Not for OpenCode 2" strings are gone.
- docs/subsystems/library.md says the same.

What was run:
- Real binaries in a sandbox HOME (throwaway test, not committed):
  rtk 1.0.1 and 0.51.0 (aarch64-apple-darwin release tarballs) with the
  real OpenCode 2.0.25 on PATH. rtk 1.0.1: row not blocked, SetRTK on
  wrote an 8425-byte plugin with setup(), off took it out. rtk 0.51.0:
  blocked "OpenCode 2.0.25 needs RTK 0.52 or newer, and this RTK is
  0.51.0 …", SetRTK on refused, nothing written.
- Real OpenCode 2.0.25 in a sandbox HOME (its own service, stopped
  after): rtk 1.0.1's plugin logs "loading plugin" with no error;
  0.51.0's logs "failed to load plugin … Plugin must export a default
  definition with an id and an effect or setup function".
- TestRTKOpenCode2 rewritten (fake rtk writes each version's real
  plugin shape). Broken by hand three ways, each a FAIL: old rtk.go
  (blocked: "RTK doesn't support OpenCode 2 yet …"), stale-plugin rule
  dropped ("OpenCode 1's plugin under OpenCode 2 is listed as on"), gate
  at 1.0 ("rtk 0.52.0 blocked for OpenCode 2").
- New GUI test library-rtk-opencode2.test.cjs: every language, 1100
  and 420, on and off rows, Chromium and WebKit 21/21 each; red on the
  old client.js/i18n.js. gui-de, gui-ja, gui-zh-tw, i18n-keys and all
  library-*.test.cjs: 286/286 in Chromium and in WebKit.
- gofmt -l clean; go vet, GOOS=linux and GOOS=windows go vet -tags
  nogui ./internal/library; go test -tags nogui ./internal/library
  under a temp HOME with pinned caches, on the rebased head.
Full suite: SUITE_LINE
2026-10-15 23:07:59 +08:00