Skip to content

Add wave:term component with direct SSE output + /api/terminput input path#2974

Open
Copilot wants to merge 2 commits intomainfrom
copilot/add-new-tsunami-component
Open

Add wave:term component with direct SSE output + /api/terminput input path#2974
Copilot wants to merge 2 commits intomainfrom
copilot/add-new-tsunami-component

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

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

    app.SetTermInputHandler(func(input app.TermInputPacket) {
        // input.Id, input.Data64, input.TermSize.Rows/Cols
    })
    
    _ = app.TermWrite("term1", "SGVsbG8gZnJvbSB0aGUgYmFja2VuZA0K")

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new tsunami component with TermWrite functionality Add wave:term component with direct SSE output + /api/terminput input path Mar 4, 2026
Copilot finished work on behalf of sawka March 4, 2026 05:36
@sawka sawka marked this pull request as ready for review March 4, 2026 06:22
}
}

const TsunamiTerm = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(function TsunamiTerm(
Copy link
Contributor

Choose a reason for hiding this comment

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

CRITICAL: Missing displayName for React.forwardRef component

According to the project's coding guidelines, when using React.memo() or React.forwardRef(), you must add a displayName for the component. This helps with debugging and React DevTools.

Add after the component definition:

TsunamiTerm.displayName = "TsunamiTerm";

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 4, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
tsunami/frontend/src/element/tsunamiterm.tsx 39 Missing displayName for React.forwardRef component
Files Reviewed (7 files)
  • tsunami/app/defaultclient.go - No issues
  • tsunami/engine/clientimpl.go - No issues
  • tsunami/engine/serverhandlers.go - No issues
  • tsunami/frontend/src/element/tsunamiterm.tsx - 1 issue
  • tsunami/frontend/src/model/tsunami-model.tsx - No issues
  • tsunami/frontend/src/vdom.tsx - No issues
  • tsunami/rpctypes/protocoltypes.go - No issues

Fix these issues in Kilo Cloud

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.

2 participants