Skip to content

fix(kimi-code): ship node-pty natives in the packaged CLI - #3353

Open
astraltrekkin wants to merge 2 commits into
MoonshotAI:mainfrom
astraltrekkin:fix/sea-node-pty-native-assets
Open

fix(kimi-code): ship node-pty natives in the packaged CLI#3353
astraltrekkin wants to merge 2 commits into
MoonshotAI:mainfrom
astraltrekkin:fix/sea-node-pty-native-assets

Conversation

@astraltrekkin

@astraltrekkin astraltrekkin commented Aug 29, 2026

Copy link
Copy Markdown

Related Issue

Resolve #3326

Problem

See linked issue. Starting kimi web from the packaged single-file CLI and creating a terminal (POST /api/v1/sessions/{session_id}/terminals) fails with 50001 / ERR_UNKNOWN_BUILTIN_MODULE because node-pty prebuilds are not shipped as native assets and the SEA loader cannot resolve prebuilds/<target>/*.node.

What changed

Register node-pty in the native-asset set (per-target .node files, darwin spawn-helper at 0755, Windows sidecars plus conoutSocketWorker.js). Extract the package JS next to those files and load it through the existing native-package cache so require(), spawn-helper, and the Windows worker Worker(__dirname/…) paths resolve on disk. Rewrite await import('node-pty') in the SEA bundle to that loader.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e588144

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 600414f779

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +57 to +58
'linux-arm64': [],
'linux-x64': [],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include the Linux node-pty native payload

For both released Linux targets, these empty lists cause collectPackageFiles to extract only node-pty's JS and package metadata: js-and-native-file does not enable native auto-scanning, and the recursive collector explicitly skips .node files. Node-pty requires both prebuilds/<linux-arch>/pty.node and the executable spawn-helper on Linux, as also documented in scripts/fix-node-pty-perms.mjs:3-9, so creating a web terminal from either packaged Linux binary will still fail when it loads or spawns the PTY. Add the Linux prebuild paths and mark spawn-helper executable just as for Darwin.

Useful? React with 👍 / 👎.

Linux packaged builds omitted pty.node and spawn-helper, so web terminals failed the same way as before the Darwin/Windows payload fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

kimi web: terminal creation fails in the packaged binary (node-pty native assets not bundled; deeper hang after fixing)

1 participant