Skip to content

refactor(codemode): use the psychoscript package for the language - #65011

Merged
jlongster merged 2 commits into
devfrom
codemode-psychoscript
Nov 20, 2026
Merged

jlongster merged 2 commits into
devfrom
codemode-psychoscript

Conversation

@jlongster

@jlongster jlongster commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Mode's language (compiler, VM, runtime, stdlib, prelude, snapshots, Effect driver) now lives in psychoscript, published as psychoscript@0.1.2. packages/codemode depends on it and keeps only the tool-specific code.

  • Deleted 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 from psychoscript's package entry; test/language-boundary.test.ts now checks that. compareText and validateLimit are inlined, and SuspendError comes from Runtime.SuspendError. @opencode/codemode's public exports are unchanged.
  • Kept tests: codemode, openapi, signature, scan, tool-paths, extensions, language-boundary, plus the tool-related cases of enumeration, promise, stdlib and suspend.
  • psychoscript is added to minimumReleaseAgeExcludes as a first-party package. acorn stays for the AST types scan.ts uses.

Verification

  • packages/codemode: bun typecheck, bun test (321 pass), bun run pack
  • packages/core: bun test test/tool-execute.test.ts test/codemode (67 pass), bun typecheck
  • bun run check from the repo root passes

Inference gateway

Nothing here touches the Code Mode tool sent to providers. It is still named execute with a code parameter (packages/core/src/codemode/tool.ts is unchanged), so the checks in free-tier-access.ts and protocol.ts are unaffected.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@jlongster
jlongster force-pushed the codemode-psychoscript branch from 1f0e90e to 2ab7f86 Compare November 20, 2026 00:29
User decisions:
- Publish psychoscript with the array iterator fix and use it in OpenCode

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jlongster
jlongster merged commit eb2dfb2 into dev Nov 20, 2026
12 checks passed
@jlongster
jlongster deleted the codemode-psychoscript branch November 20, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant