Skip to content

fix(tui): load local plugins via SEA-safe import - #42485

Closed
xdagiz wants to merge 1 commit into
anomalyco:v2from
xdagiz:tui-plugin-sea-import
Closed

xdagiz wants to merge 1 commit into
anomalyco:v2from
xdagiz:tui-plugin-sea-import

Conversation

@xdagiz

@xdagiz xdagiz commented Aug 14, 2026 •

Copy link
Copy Markdown

Issue for this PR

#42481
Closes #42481

Type of change

  • Bug fix

What does this PR do?

the TUI plugin loader used a raw import(), which the node SEA binary can't service for file urls. switched it to the existing importModule runtime import which is the same mechanism the server-side plugin loader already uses, so both builds resolve plugins through one SEA-safe path.

How did you verify your code works?

ran a local build and manually tested it

Screenshots / recordings

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@xdagiz
xdagiz force-pushed the tui-plugin-sea-import branch from c71d85d to 7358afc Compare August 19, 2026 23:20
@Enough1122

Copy link
Copy Markdown

AI code review — automated review for reference; please use your judgment.

  • packages/tui/src/plugin/context.tsx:594 — the checked annotation : { readonly default?: unknown } was replaced by an unchecked as assertion on importModule()'s return — if runtime-import's return type ever drifts (e.g. starts returning a namespace wrapper), this silently widens what reaches mod.default handling — consider a small typed wrapper in runtime-import (or a satisfies-style shape check) so the previous compile-time safety survives.
  • packages/tui/src/plugin/context.tsx:591-594 — version reaching this call site comes from either the raw entrypoint or freshSpecifier(entrypoint, generation), so its form (plain path, file:// URL, bare/package specifier) varies — please confirm importModule falls back to native import() for every one of those forms so behavior outside SEA builds stays byte-identical to the old await import(version).
  • packages/tui/src/plugin/context.tsx:594-604 — native import() failures carry recognizable error types/messages and the surrounding retry logic keys off import failures — verify importModule re-throws with equivalent error shapes rather than swallowing/wrapping them, otherwise the generation-retry path may mis-classify failures.
  • packages/tui/test — no test covers plugin loading through importModule under the SEA/bundled runtime this change targets — a single integration test that loads a fixture plugin through this path would pin the exact regression class this PR fixes.
  • nit — packages/tui/src/plugin/context.tsx:594 — a one-line comment stating why raw await import() is unsuitable here (SEA dynamic-import semantics) would spare future readers re-deriving the reason.

— AI code review (automated)

@xdagiz

xdagiz commented Sep 6, 2026

Copy link
Copy Markdown
Author

fixed in #46901

@xdagiz xdagiz closed this Sep 6, 2026
@xdagiz
xdagiz deleted the tui-plugin-sea-import branch September 6, 2026 22:17
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.

2 participants