Skip to content

feat(agents): TypeScript 7 code intelligence for coding agents, load-aware tsrs checkers - #33408

Merged
nwparker merged 4 commits into
mainfrom
nwparker/agent-ts7-lsp
Oct 25, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/agent-ts7-lsp

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​151 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​151
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​316 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​305

Why

The stock agent TypeScript plugin needs a compiler build that TS 7 no longer ships. In this repo, agents either got no diagnostics or quietly used some other TypeScript. The TS 7 language servers (tsc --lsp --stdio, tsrs --lsp --stdio) only serve pull diagnostics (textDocument/diagnostic), but the agent client only accepts pushed publishDiagnostics. I checked this by probing the protocol directly: with no pull capability, neither server pushes anything.

What

  • config/scripts/agent-typescript-lsp.mjs: starts the repo's own TS 7 language server and sits between it and the agent:
    • Server choice: tsrs on Apple Silicon and Linux (same rule as pnpm tc), otherwise the typescript package's tsc (Windows, Intel macOS). ORCA_TYPESCRIPT_LSP=tsrs|tsc overrides it.
    • Clients that pull diagnostics themselves pass straight through.
    • For push-only clients, it advertises pull support to the server and pulls (debounced) after each open, change, or save, and on workspace/diagnostic/refresh. Results are sent back as versioned publishDiagnostics. A result that a newer edit has outdated is dropped.
    • The server lives only as long as the agent session: it exits when the client's stdio closes. There is no global daemon.
  • Claude Code: .claude/settings.json registers a repo-local directory marketplace (config/agent-plugins) and enables orca-typescript@orca-agent-plugins. It also turns off the stock typescript-lsp for this repo so it can't take over .ts files. The plugin's .lsp.json runs node ${CLAUDE_PROJECT_DIR}/config/scripts/agent-typescript-lsp.mjs, so it always uses the current worktree's script and node_modules, even when the per-user marketplace registration points at another worktree. The marketplace loads after the user accepts the workspace trust dialog.
  • OpenCode: opencode.json turns off the built-in TypeScript server and runs the same script.
  • Typecheck parallelism: by default tsrs runs one checker per core per project, and pnpm tc runs two projects at once, so 32 checker threads on a 16-core machine. That's before counting other agents. Local tsrs checks now pass --checkers, splitting the cores the 1-minute load average leaves idle between the projects in flight, with a floor of 4. On Windows the load average reads 0, so it splits all cores. ORCA_TYPECHECK_CHECKERS=<n> pins the value.

Measurements (M-series, 16 cores, 128 GB; load average 55–70 during runs)

first diagnostics after a 1-line edit definition RSS
tsrs LSP via bridge 1.2–2.0 s 130–190 ms 8–13 ms ~1.4–1.5 GB (+55 MB bridge)
tsc LSP via bridge 3.6–6.8 s 40–130 ms 4–5 ms ~3.4–4.0 GB

Idle CPU after the first check is about 0%.

End-to-end in Claude Code with the plugin: the server starts on the first edit of a .ts file. After the next edit, the agent was shown Type 'number' is not assignable to type 'string'. [2322] (ts) and the unused-variable warnings. Under heavy load, the first project load took about 6 s, so the very first edit of a session can come back before diagnostics are ready. Later edits get them.

tsrs --checkers on config/tsconfig.node.json (load ~60):

checkers warm, no change body-only 1-line edit exported-signature edit
default (16) 1.3 s / 1.2 GB 2.3 s / 1.3 GB 9.8 s / 4.8 GB
8 1.0 s — 9.1 s / 4.2 GB
4 1.1 s 1.5–2.1 s / 1.3 GB 13.8 s / 3.6 GB
2 1.3 s — 15.0 s / 3.3 GB

Watch-daemon investigation (not shipped)

I measured a hot per-worktree tsrs --watch against today's incremental pnpm tc path:

  • Body-only edit: watch rechecks in 0.7–2.7 s, versus 1.5–2.3 s for a cold incremental run.
  • Exported-signature edit: watch takes 15–28 s, slower than the 9–10 s incremental run.
  • Memory: a watcher keeps 4–8 GB resident per worktree the whole time.

There is no 2x win, and the memory cost doesn't fit hundreds of worktrees. Whole-project pnpm tc is mostly fixed overhead: about 1.9 s of build:packages plus about 1.3 s of no-change tsrs. For the edit-and-check loop, the per-session language server above is already the hot path, with 130–190 ms per-file diagnostics after an edit.

Validation

  • pnpm tc passes.
  • pnpm test config/scripts/agent-typescript-lsp.test.mjs config/scripts/run-typecheck-projects-in-parallel.test.mjs config/scripts/tsrs-typecheck-compiler.test.mjs passes (46 tests).
  • pnpm run check:code-quality:changed passes.
  • claude plugin validate passes for both the marketplace and the plugin.

…aware tsrs checkers

The stock agent TypeScript plugin needs a compiler build TS 7 no longer ships, so agents in
this repo got no diagnostics or ran some other TypeScript.

- config/scripts/agent-typescript-lsp.mjs starts the repo's own TS 7 language server
  (tsrs on Apple Silicon and Linux, the typescript package's tsc elsewhere) and turns its
  pull-only diagnostics into pushed publishDiagnostics for push-only clients.
- .claude/settings.json registers a repo-local plugin marketplace (config/agent-plugins)
  and enables the orca-typescript LSP plugin; opencode.json runs the same server.
- Local tsrs typechecks now pass --checkers, splitting the cores the load average leaves
  idle between concurrent projects (floor 4); ORCA_TYPECHECK_CHECKERS pins it.
@nwparker
nwparker marked this pull request as ready for review October 25, 2026 05:53
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 12 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4cf42ebf-3e64-4ca0-9460-d0aae96f9d3f
Commits

Reviewing files that changed from the base of the PR and between b1e18d8 and 5ecf17b.

Files selected for processing: 11
  • .claude/settings.json
  • .github/scripts/check-root-directory-entries.mjs
  • config/agent-plugins/.claude-plugin/marketplace.json
  • config/agent-plugins/orca-typescript/.claude-plugin/plugin.json
  • config/agent-plugins/orca-typescript/.lsp.json
  • config/scripts/agent-typescript-lsp.mjs
  • config/scripts/agent-typescript-lsp.test.mjs
  • config/scripts/run-typecheck-projects-in-parallel.mjs
  • config/scripts/run-typecheck-projects-in-parallel.test.mjs
  • config/scripts/tsrs-typecheck-compiler.mjs
  • opencode.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 13464ed into main Oct 25, 2026
37 checks passed
@nwparker
nwparker deleted the nwparker/agent-ts7-lsp branch October 25, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant