Repository navigation
Conversation
psychoscript upstream will not take TypeScript mode, so the carrier stops using it. A script plugin's entry is `init.js` and its modules are `.js`, compiled as plain JavaScript; an `init.ts` entry is refused at load with the rename that fixes it, and a `.ts` module a `.js` plugin imports is refused the same way. Authors type-check the JavaScript against the generated `opencode-plugin.d.ts` and `psychoscript.d.ts`. The carrier's `opencode:plugin` prelude is unchanged and is now `prelude.js`, which is what it always compiled to.
Script plugins are JavaScript only (O-229): the examples are init.js and .js modules, checked with checkJs against the generated plugin types. The converted files keep the same code, comments aside, so the counter and hello twins still match their frozen traces.
Script plugins are JavaScript now: psychoscript takes no TypeScript mode, and the client refuses a `.ts` entry. Convert life, other and title the way the ten ports were, with `// @ts-check` and JSDoc for the checker, and point the life machine, the P.0b fixture and the docs at `init.js`. The code each file emits is the same, so the life state machine and the title twins still reproduce their traces.
The five worker branches left a few places on the TypeScript entry: the ports twin's fixture plugin wrote script/init.ts, the TUI script fixtures built their plugins from init.ts (two with type annotations in their source), and the F16 deviation still described stripped types. plugin check now compiles before it runs tsc, so a .js plugin importing a .ts module is refused with the loader's own wording instead of tsc's import-extension error.
There was a problem hiding this comment.
The change looks sound from reading it, but I couldn't run it: the sandbox has no Rust toolchain, so I couldn't build opencode-native or run the crate tests, and check:plugin-types stops at the cargo-driven types step. I read the diff end to end. The manifest refuses a .ts entry, the build only links .js and maps an unresolved .ts import to the same refusal, and plugin check now builds before running tsc so its errors read like the loader's. I found no leftover init.ts assumptions in the plugin crate or docs.
Public API (script plugin file format), not backwards compatible for script plugins:
- Default entry:
init.ts, elseinit.js→init.jsonly. - An
entryor import ending in.tsnow fails to load withscript plugins are JavaScript: rename <x>.ts to <x>.js and remove its types. .tsmodules are no longer compiled. The documented tsconfig dropsallowImportingTsExtensions,erasableSyntaxOnlyandverbatimModuleSyntax.- Existing TypeScript script plugins must rename to
.jsand move their types to JSDoc. - TS TUI plugins on the JS host are unchanged.
One small concern is inline: check-plugin-types.ts no longer skips plugin.toml directories that aren't script plugins.
The checker treated every plugin.toml as a script plugin, so a legacy Luau directory (an init.luau, or an entry ending in .luau) counted as an error and was told to rename init.luau to itself. It now mirrors the loader's source::carrier and skips a directory routed to the Luau carrier. A directory routed to Script keeps its refusal, and an init.ts with no init.js is now named in that refusal rather than reported as a missing init.js, as the loader's default entry does. script/script-expect/luau is the row that holds this: it is scanned and must be skipped, so a regression fails the check.
There was a problem hiding this comment.
The new commit fixes the earlier thread: check-plugin-types.ts now works out the carrier the way the loader's source::carrier does, and skips Luau plugins instead of refusing them. A script-expect/luau fixture covers the skip. I checked this by reading the diff; I couldn't run the script because the sandbox has no Rust toolchain. This commit changes no public API beyond what the earlier review noted. Nothing new to raise.
Issue for this PR
N/A (follows psychoscript keeping TypeScript out of the interpreter; anomalyco/psychoscript#179 was closed)
Type of change
What does this PR do?
The native client's script plugins ran TypeScript through psychoscript's TS mode, which only exists on our integration branch: upstream psychoscript stays JavaScript-only and leaves type stripping to the host. Until we decide whether the client strips types itself, script plugins are JavaScript: the entry is
init.js, modules are.js, and everything is compiled as plain JavaScript. Aninit.tsentry or an imported.tsmodule is refused withscript plugins are JavaScript: rename init.ts to init.js and remove its types. Authors keep type checking:opencode-native plugin typeswrites the same.d.tsfiles and atsconfigwithallowJs,checkJsandstrict, andplugin checkruns it on.js. The in-repo example and parity plugins are converted (same emitted code,// @ts-check, JSDoc only wherecheckJsneeds it), and the plugin docs say JavaScript.This is a breaking change for script plugin authors, but no
cli-rsrelease has shipped script plugins yet, and the ten known third-party ports are already converted. No feature flag for that reason. TS TUI plugins (tui.ts/tui.tsxon the JS host) are unchanged.How did you verify your code works?
check:plugin-typesreports 0 errors on every in-repo script plugin and still refuses its four bad fixtures;opencode-cli --test plugin,opencode-pluginscript::,loader::,script_loader_tests::,twin::,opencode-plugin-abisdk,opencode-tuiplugin_script::,plugin_machines::,plugin_twins::; P-PTYP.0b/foreground-title.cargo fmt --check,clippy -D warnings,bun typecheck,check:drift. The merge lane's gate and full suites (P-CLI, P-PTY, ACP, P-TUI, drift, machines, Windows check, cargo deny) passed on36c65f6fa0.Screenshots / recordings
N/A (plugin loading and tooling; no UI change).
Checklist
Added by the opencode bot (AI-generated).
Public API: script plugins: default entry init.ts → init.js; .ts entries and imports are now refused (breaking for TypeScript script plugins; TS TUI plugins unchanged)