mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-24 09:18:27 +00:00
This PR introduces a standalone Tsunami terminal element (`wave:term`)
and routes terminal IO outside the normal render/event loop for
lower-latency streaming. It adds imperative terminal output
(`TermWrite`) over SSE and terminal input/resize delivery over a
dedicated `/api/terminput` endpoint.
- **Frontend: new `wave:term` element**
- Added `tsunami/frontend/src/element/tsunamiterm.tsx`.
- Uses `@xterm/xterm` with `@xterm/addon-fit`.
- Renders as an outer `<div>` (style/class/ref target), with xterm
auto-fit to that container.
- Supports ref passthrough on the outer element.
- **Frontend: terminal transport wiring**
- Registered `wave:term` in `tsunami/frontend/src/vdom.tsx`.
- Added SSE listener handling for `termwrite` in
`tsunami/frontend/src/model/tsunami-model.tsx`, dispatched to the
terminal component via a local custom event.
- `onData` and `onResize` now POST directly to `/api/terminput` as JSON
payloads:
- `id`
- `data64` (base64 terminal input)
- `termsize` (`rows`, `cols`) for resize updates
- **Backend: new terminal IO APIs**
- Added `/api/terminput` handler in `tsunami/engine/serverhandlers.go`.
- Added protocol types in `tsunami/rpctypes/protocoltypes.go`:
- `TermInputPacket`, `TermWritePacket`, `TermSize`
- Added engine/client support in `tsunami/engine/clientimpl.go`:
- `SendTermWrite(id, data64)` -> emits SSE event `termwrite`
- `SetTermInputHandler(...)` and `HandleTermInput(...)`
- Exposed app-level APIs in `tsunami/app/defaultclient.go`:
- `TermWrite(id, data64) error`
- `SetTermInputHandler(func(TermInputPacket))`
- **Example usage**
```go
app.SetTermInputHandler(func(input app.TermInputPacket) {
// input.Id, input.Data64, input.TermSize.Rows/Cols
})
_ = app.TermWrite("term1", "SGVsbG8gZnJvbSB0aGUgYmFja2VuZA0K")
```
- **<screenshot>**
- Provided screenshot URL:
https://github.com/user-attachments/assets/58c92ebb-0a52-43d2-b577-17c9cf92a19c
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
|
||
|---|---|---|
| .. | ||
| app | ||
| build | ||
| cmd | ||
| demo | ||
| engine | ||
| frontend | ||
| rpctypes | ||
| templates | ||
| tsunamibase | ||
| ui | ||
| util | ||
| vdom | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||