refactor(terminal): decouple terminal input from JSON RPC path#4696
refactor(terminal): decouple terminal input from JSON RPC path#4696coffeedeveloper merged 1 commit intomainfrom
Conversation
|
/next |
总体说明该变更为终端服务客户端接口添加了 变更详情
预估代码审查工作量🎯 3 (Moderate) | ⏱️ ~20 minutes 建议审阅者
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/terminal-next/src/node/terminal.service.client.ts`:
- Around line 157-169: The onMessage handler currently parses msg and may pass
undefined into resize or terminalService.onMessage; update onMessage to validate
parsed payload fields before calling downstream: after JSON.parse(msg) check
that method is a string, that for method === 'resize' params is an object with
numeric rows and cols (or coerce/default to safe values) before calling
this.resize(id, rows, cols), and for other methods ensure data is not undefined
(fallback to original msg or a safe default) before calling
this.terminalService.onMessage(id, data); also keep the catch fallback for
legacy/raw messages. This change affects the onMessage method and calls to
this.resize and this.terminalService.onMessage.
|
🎉 PR Next publish successful! 3.9.1-next-1769515889.0 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4696 +/- ##
==========================================
- Coverage 52.88% 52.88% -0.01%
==========================================
Files 1686 1686
Lines 104888 104888
Branches 22954 22787 -167
==========================================
- Hits 55475 55471 -4
- Misses 41054 41058 +4
Partials 8359 8359
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Types
Background
Terminal input was flowing through the same JSON RPC path as resize/other messages, causing per‑keystroke JSON.stringify/parse overhead and coupling input with output handling under high output load.
Solution
Introduce a dedicated raw input RPC method for terminal input. The browser now sends input via input(id, data) and resize via its own method, avoiding JSON serialization on every keystroke. The node side handles raw input directly and keeps a backward‑compatible fallback for legacy JSON messages.
Changelog
Summary by CodeRabbit
发布说明
重构
测试
✏️ Tip: You can customize this high-level summary in your review settings.