Repository navigation
refactor(codemode): use the psychoscript package for the language - #65011
Conversation
There was a problem hiding this comment.
The change looks sound. Code Mode now runs on psychoscript@0.1.0. The remaining codemode tests (321) and core's Code Mode and tool-execute tests (67) pass, and tsc and bun run pack succeed for packages/codemode. bun check isn't available in the local Bun, so I type-checked with tsc instead (core's source is clean; its test files weren't checked). No leftover imports of the deleted src/language remain, and nothing in CI or other packages uses the removed scripts. The inlined compareText and validateLimit match the old implementations.
Public API unchanged: @opencode/codemode's exports are the same (SuspendError now comes from psychoscript's Runtime.SuspendError), and the execute tool sent to providers is untouched.
No blocking concerns.
User decisions: - Move the language into the psychoscript package; keep only tool-specific code in packages/codemode - packages/codemode depends on psychoscript from npm - Keep it as simple and clean as possible
1f0e90e to
2ab7f86
Compare
User decisions: - Publish psychoscript with the array iterator fix and use it in OpenCode
There was a problem hiding this comment.
The new commits are a rebase onto dev plus the psychoscript 0.1.0 → 0.1.2 bump. The error-stack fix from #64939, which landed in src/language/ on dev and is removed by this PR, is in psychoscript 0.1.2. The Code Mode tests #64939 added still pass (packages/codemode: 322 pass, tsc clean). Core's Code Mode and tool-execute tests also pass (67). Public API unchanged. No new concerns.
Code Mode's language (compiler, VM, runtime, stdlib, prelude, snapshots, Effect driver) now lives in psychoscript, published as
psychoscript@0.1.2.packages/codemodedepends on it and keeps only the tool-specific code.src/language/, the language-only tests, test262/WPT files and licenses,interpreter-support.md, and the prelude, disasm, bench, setup and test262 scripts. Also removed the round-trip test mode (test:roundtrip, test preload) and the stale oxlint overrides for the old interpreter paths.src/codemode/**imports only frompsychoscript's package entry;test/language-boundary.test.tsnow checks that.compareTextandvalidateLimitare inlined, andSuspendErrorcomes fromRuntime.SuspendError.@opencode/codemode's public exports are unchanged.psychoscriptis added tominimumReleaseAgeExcludesas a first-party package.acornstays for the AST typesscan.tsuses.Verification
packages/codemode:bun typecheck,bun test(321 pass),bun run packpackages/core:bun test test/tool-execute.test.ts test/codemode(67 pass),bun typecheckbun run checkfrom the repo root passesInference gateway
Nothing here touches the Code Mode tool sent to providers. It is still named
executewith acodeparameter (packages/core/src/codemode/tool.tsis unchanged), so the checks infree-tier-access.tsandprotocol.tsare unaffected.