An open-source, AI-integrated, cross-platform terminal for seamless workflows
Find a file
Copilot 58e000bf12
Add alert and confirm modal system for tsunami apps (#2484)
## Alert and Confirm Modal System for Tsunami

This PR implements a complete modal system for the tsunami app framework
as specified in the requirements.

### Implementation Summary

**Backend (Go) - 574 lines changed across 11 files:**

1. **Type Definitions** (`rpctypes/protocoltypes.go`):
- `ModalConfig`: Configuration for modal display with icon, title, text,
and button labels
- `ModalResult`: Result structure containing modal ID and confirmation
status

2. **Client State Management** (`engine/clientimpl.go`):
   - Added `ModalState` to track open modals with result channels
   - `OpenModals` map to track all currently open modals
- `ShowModal()`: Sends SSE event to display modal and returns result
channel
   - `CloseModal()`: Processes modal result from frontend
- `CloseAllModals()`: Automatically cancels all modals when frontend
sends Resync flag (page refresh)

3. **API Endpoint** (`engine/serverhandlers.go`):
- `/api/modalresult` POST endpoint to receive modal results from
frontend
   - Validates and processes `ModalResult` JSON payload
   - Closes all modals on Resync (page refresh) before processing events

4. **User-Facing Hooks** (`app/hooks.go`):
   - `UseAlertModal()`: Returns (isOpen, triggerAlert) for alert modals
- `UseConfirmModal()`: Returns (isOpen, triggerConfirm) for confirm
modals
   - Both hooks manage local state and handle async modal lifecycle

**Frontend (TypeScript/React):**

1. **Type Definitions** (`types/vdom.d.ts`):
   - Added `ModalConfig` and `ModalResult` TypeScript types

2. **Modal Components** (`element/modals.tsx`):
- `AlertModal`: Dark-mode styled alert with icon, title, text, and OK
button
- `ConfirmModal`: Dark-mode styled confirm with icon, title, text, OK
and Cancel buttons
   - Both support keyboard (ESC) and backdrop click dismissal
   - Fully accessible with focus management

3. **Model Integration** (`model/tsunami-model.tsx`):
   - Added `currentModal` atom to track displayed modal
   - SSE event handler for `showmodal` events
- `sendModalResult()`: Sends result to `/api/modalresult` and clears
modal

4. **UI Integration** (`vdom.tsx`):
   - Integrated modal display in `VDomView` component
   - Conditionally renders alert or confirm modal based on type

**Demo Application** (`demo/modaltest/`):
- Comprehensive demonstration of modal functionality
- Shows 4 different modal configurations:
  - Alert with icon
  - Simple alert with custom button text
  - Confirm modal
  - Delete confirmation with custom buttons
- Displays modal state and results in real-time

### Key Features

 **SSE-Based Modal Display**: Modals are pushed from backend to
frontend via SSE
 **API-Based Result Handling**: Results sent back via
`/api/modalresult` endpoint
 **Automatic Cleanup**: All open modals auto-cancel on page refresh
(when Resync flag is set)
 **Type-Safe Hooks**: Full TypeScript and Go type safety  
 **Dark Mode UI**: Components styled for Wave Terminal's dark theme  
 **Accessibility**: Keyboard navigation, ESC to dismiss, backdrop click
support
 **Zero Security Issues**: Passed CodeQL security analysis  
 **Zero Code Review Issues**: Clean implementation following best
practices

### Testing

-  Go code compiles without errors
-  TypeScript/React builds without errors  
-  All existing tests pass
-  Demo app created and compiles successfully
-  CodeQL security scan: 0 vulnerabilities
-  Code review: 0 issues

### Security Summary

No security vulnerabilities were introduced. All modal operations are
properly scoped to the client's SSE connection, and modal IDs are
generated server-side to prevent tampering.


Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
2025-10-27 18:11:19 -07:00
.github Bump actions/setup-node from 5 to 6 in /.github/workflows (#2445) 2025-10-17 17:49:17 -07:00
.roo/rules handle reasoning deltas and display them in the UI (#2443) 2025-10-16 11:17:24 -07:00
.storybook add tailwind to wave, support shadcn + donut chart as a POC (#1775) 2025-02-04 17:58:36 -08:00
.vscode tsunami app builder 2 (#2486) 2025-10-27 16:37:15 -07:00
.zed Add basic Zed workspace configs (#1942) 2025-02-09 15:00:46 -08:00
aiprompts waveapps builder window (scaffolding, restructure AI panel to work in both builder and tab windows) (#2482) 2025-10-26 17:48:01 -07:00
assets Make the Wave logo icons slightly smaller (#1500) 2024-12-11 13:24:12 -08:00
build Squash some leftover bugs (#1495) 2024-12-11 12:52:15 -08:00
cmd allow wsh ai to attach directory listings to the chat (#2469) 2025-10-22 09:47:58 -07:00
db Allow AI Presets To Automatically Update Widgets (#1954) 2025-02-13 13:38:12 -08:00
docs Bump the dev-dependencies-patch group with 4 updates (#2476) 2025-10-26 11:10:52 -07:00
emain tsunami app builder 2 (#2486) 2025-10-27 16:37:15 -07:00
frontend tsunami app builder 2 (#2486) 2025-10-27 16:37:15 -07:00
pkg tsunami app builder 2 (#2486) 2025-10-27 16:37:15 -07:00
public tsunami framework (waveapps v2) (#2315) 2025-09-11 14:25:07 -07:00
schema add config setting to disable overlay blocknums from showing when holding ctrl:shift (#2288) 2025-08-25 21:47:35 -07:00
testdriver touch up final test condition (#1338) 2024-11-22 17:16:04 -08:00
tests/copytests Add S3 fileshare implementation, improve cp behavior (#1896) 2025-02-14 17:27:02 -08:00
tsunami Add alert and confirm modal system for tsunami apps (#2484) 2025-10-27 18:11:19 -07:00
.editorconfig Oops i actually made the tabs wrong (#1384) 2024-12-04 13:49:14 -08:00
.gitattributes WSL Integration (#1031) 2024-10-23 22:43:17 -07:00
.gitignore Batch Approval for AI Tool Calls, fix "AI is thinking" message, chunk JS (#2430) 2025-10-13 23:37:45 -07:00
.golangci.yml reduce some logging for prod release (#2440) 2025-10-15 22:10:00 -07:00
.prettierignore Add filewatcher for config files (#63) 2024-06-19 23:59:41 -07:00
ACKNOWLEDGEMENTS.md Add back the acknowledgements readme, update about modal link (#818) 2024-09-24 16:58:18 -07:00
BUILD.md switch from yarn to npm (#2347) 2025-09-12 15:36:03 -07:00
CNAME Move docsite to main repo (#1204) 2024-11-06 10:45:21 -08:00
CODE_OF_CONDUCT.md move some metadata files over to new repo 2024-09-18 12:04:28 -07:00
CONTRIBUTING.md Add link to Good First Issues in Contributing Guide (#1991) 2025-02-18 17:06:56 -08:00
electron-builder.config.cjs move rpm section to top level instead of under linux (#2301) 2025-08-28 15:13:29 -07:00
electron.vite.config.ts Batch Approval for AI Tool Calls, fix "AI is thinking" message, chunk JS (#2430) 2025-10-13 23:37:45 -07:00
eslint.config.js Switch to using electron-vite instead of WebPack (#45) 2024-06-13 16:49:25 -07:00
go.mod Bump github.com/aws/aws-sdk-go-v2/config from 1.31.13 to 1.31.15 (#2474) 2025-10-25 22:33:49 -07:00
go.sum Bump github.com/aws/aws-sdk-go-v2/config from 1.31.13 to 1.31.15 (#2474) 2025-10-25 22:33:49 -07:00
index.html add tailwind to wave, support shadcn + donut chart as a POC (#1775) 2025-02-04 17:58:36 -08:00
LICENSE Happy new year! (#1684) 2025-01-04 20:56:57 -08:00
NOTICE Happy new year! (#1684) 2025-01-04 20:56:57 -08:00
package-lock.json Bump the dev-dependencies-patch group with 4 updates (#2476) 2025-10-26 11:10:52 -07:00
package.json Bump the dev-dependencies-patch group with 4 updates (#2476) 2025-10-26 11:10:52 -07:00
prettier.config.cjs Windows Line Endings (#923) 2024-10-01 12:54:15 -07:00
README.md Update README.md (#2079) 2025-03-24 23:56:53 -07:00
RELEASES.md Update more links in releases.md (#1826) 2025-01-23 17:59:16 -08:00
ROADMAP.md new tevents analytics framework (#1894) 2025-02-03 15:32:44 -08:00
SECURITY.md Add markdown alert parsing, fix buffer issue when switching files (#988) 2024-10-08 09:25:41 -07:00
staticcheck.conf standalone fixes, linting errors, speedups, QOL changes ported from wave-12 branch (#2271) 2025-08-20 18:07:11 -07:00
Taskfile.yml working on more terminal context (#2444) 2025-10-17 12:19:40 -07:00
tsconfig.json waveapps builder window (scaffolding, restructure AI panel to work in both builder and tab windows) (#2482) 2025-10-26 17:48:01 -07:00
version.cjs If prerelease is false and action is none, remove the prerelease version string (#395) 2024-09-18 13:12:34 -07:00
vitest.config.ts Switch to using electron-vite instead of WebPack (#45) 2024-06-13 16:49:25 -07:00

Wave Terminal Logo

Wave Terminal

FOSSA Status

Wave is an open-source terminal that combines traditional terminal features with graphical capabilities like file previews, web browsing, and AI assistance. It runs on MacOS, Linux, and Windows.

Modern development involves constantly switching between terminals and browsers - checking documentation, previewing files, monitoring systems, and using AI tools. Wave brings these graphical tools directly into the terminal, letting you control them from the command line. This means you can stay in your terminal workflow while still having access to the visual interfaces you need.

WaveTerm Screenshot

Key Features

  • Flexible drag & drop interface to organize terminal blocks, editors, web browsers, and AI assistants
  • Built-in editor for seamlessly editing remote files with syntax highlighting and modern editor features
  • Rich file preview system for remote files (markdown, images, video, PDFs, CSVs, directories)
  • Integrated AI chat with support for multiple models (OpenAI, Claude, Azure, Perplexity, Ollama)
  • Command Blocks for isolating and monitoring individual commands with auto-close options
  • One-click remote connections with full terminal and file system access
  • Rich customization including tab themes, terminal styles, and background images
  • Powerful wsh command system for managing your workspace from the CLI and sharing data between terminal sessions

Installation

Wave Terminal works on macOS, Linux, and Windows.

Platform-specific installation instructions can be found here.

You can also install Wave Terminal directly from: www.waveterm.dev/download.

Minimum requirements

Wave Terminal runs on the following platforms:

  • macOS 11 or later (arm64, x64)
  • Windows 10 1809 or later (x64)
  • Linux based on glibc-2.28 or later (Debian 10, RHEL 8, Ubuntu 20.04, etc.) (arm64, x64)

The WSH helper runs on the following platforms:

  • macOS 11 or later (arm64, x64)
  • Windows 10 or later (arm64, x64)
  • Linux Kernel 2.6.32 or later (x64), Linux Kernel 3.1 or later (arm64)

Roadmap

Wave is constantly improving! Our roadmap will be continuously updated with our goals for each release. You can find it here.

Want to provide input to our future releases? Connect with us on Discord or open a Feature Request!

Building from Source

See Building Wave Terminal.

Contributing

Wave uses GitHub Issues for issue tracking.

Find more information in our Contributions Guide, which includes:

License

Wave Terminal is licensed under the Apache-2.0 License. For more information on our dependencies, see here.