Commit graph

41 commits

Author SHA1 Message Date
Mike Sawka
0cc6c454a9
detect if omz is installed and shell completion mode in zsh (#2891) 2026-02-19 10:22:56 -08:00
Mike Sawka
458fcc2a5d
New ConnMonitor to Track "Stalled" Connection State for SSH Conns (#2846)
* ConnMonitor to track stalled connections
* New Stalled Overlay to show feedback when we think a connection is
stalled
* New Icon in ConnButton to show stalled connections
* Callbacks in domain socket and PTYs to track activity
2026-02-09 17:11:55 -08:00
Mike Sawka
0fb25daf24
Durable Session PR #5 (Icon Flyover, More Bug Fixes, Corner Cases) (#2825)
* Track wave version when job was created (for future backward compat)
* New Flyover Menu off of "shell durability" icon.  Help + Actions + UX
* Bug with conn typeahead not closing when clicking disconnect
* Auto-reconnect jobs that have been disconnected (check for "gone"
state)
* Disable tab indicator stuff (only indicates tab not block)
* Fix bug with dev logging path on connserver
* Fix bugs with restarting blockcontrollers on startup
* Fix bugs with getting HasExited status from job manager
* Fix startup files, quoting, tilde, etc in start job flow
* ...
2026-02-05 10:15:22 -08:00
Mike Sawka
ff9923f486
Session Durability Checkpoint (#2821)
Working on bug fixes and UX. Streams restarting, fixed lots of bugs,
timing issues, concurrency bugs. Get status shipped to the FE to drive
"shield" state display. Deal with stale streams.

Also big UX changes to the block headers. Specialize the terminal
headers to prioritize the connection (sense of place), remove old
terminal icon and word "Terminal" from the header. Also drop "Web" and
"Preview" labels on web/preview blocks.

Added `wsh focusblock` command.
2026-02-03 11:49:52 -08:00
Mike Sawka
2b243627c3
very large refactor of wshrouter (#2732)
the PR spiraled and ended up being much larger than anticipated.

it is a refactor of wshrouter to have it track "links" as opposed to
just routes. this lets us simplify a lot of things when it comes to
multi-level routing.

* now the router can handle unauthenticated links directly, instead of a
weird limbo in wshproxy
* no more wshmultiproxy
* no more "authtoken" weirdness
* more straightforward handling in connserver (when using router option)

also adds more debugging, more logging, some windows fixes, other wsl
fixes
2026-01-01 17:44:00 -08:00
Mike Sawka
fbb0c4d052
windows, have a new "local" conn option for Git Bash if installed (#2666) 2025-12-12 14:05:48 -08:00
Mike Sawka
c32eb6690b
fixup macos zsh_history (merge wave history back to => ~/.zsh_history) (#2625) 2025-12-02 15:50:23 -08:00
Mike Sawka
8b246d749c
fix osc7 encoding for zsh (bad regex substitutions) (#2578) 2025-11-20 12:42:17 -08:00
Mike Sawka
42769068e4
do not enable OSC 7 support for old 5.x powershell (#2485)
fix for #2471, and better debugging for #2481
2025-10-27 12:51:20 -07:00
Mike Sawka
2e0b3d2569
implement more OSC 16162 for fish, pwsh, and bash (#2462) 2025-10-20 17:29:38 -07:00
Copilot
2619c85d03
Add OSC 7 support for Fish and PowerShell shells (#2456)
## Overview

This PR implements OSC 7 (current working directory reporting) support
for Fish shell and PowerShell, completing the shell integration coverage
alongside the existing Bash and Zsh implementations added in #2444.

## What is OSC 7?

OSC 7 is an operating system command that allows shells to automatically
report their current working directory to the terminal emulator using
the format:
```
ESC]7;file://hostname/path BEL
```

This enables the terminal to track the current directory without manual
commands, providing better context for AI features and ensuring accurate
path information.

## Implementation Details

### Fish Shell (`fish_wavefish.sh`)

Added shell integration functions using Fish-native features:
- `_waveterm_si_blocked()` - Prevents OSC 7 in tmux/screen environments
using `set -q` and `string match -q`
- `_waveterm_si_osc7()` - Sends the OSC 7 sequence with built-in URL
encoding
- Uses `string escape --style=url` for UTF-8 percent-encoding
- Hooked to `fish_prompt` event and `PWD` variable changes for automatic
updates

**Key Features:**
- Fish-native checks (`set -q`, `string match`) instead of non-portable
`test -o`
- Built-in `string escape --style=url` for proper UTF-8 percent-encoding
- Simple, portable, and maintainable (32 lines total)

### PowerShell (`pwsh_wavepwsh.sh`)

Added simplified shell integration that leverages frontend
normalization:
- `_waveterm_si_blocked()` - Prevents OSC 7 in tmux/screen environments
- `_waveterm_si_osc7()` - Sends OSC 7 with raw path encoding
- Uses `[System.Uri]::EscapeDataString()` for proper percent-encoding
- Integrated into the prompt function while preserving existing prompts

**Key Features:**
- **No path rewriting**: Sends raw paths (e.g., `C:\Users\Name` →
`C%3A%5CUsers%5CName`)
- **UNC support**: Network paths like `\\server\share` encoded as
`%5C%5Cserver%5Cshare`
- **Hostname fallback**: `$env:COMPUTERNAME` → `$env:HOSTNAME` → empty
(produces `file:///path`)
- **No DNS lookup**: Avoids potentially slow DNS calls
- Simple and efficient (53 lines total)

## Implementation Benefits

Both implementations use native, built-in features for maximum
compatibility and maintainability:

**Fish:**
-  Replaced `test -o` with fish-native `set -q` and `string match -q`
for better portability
-  Replaced manual string replacements with `string escape --style=url`
for proper UTF-8 support
-  Removed custom URL encoding function (19 lines removed)

**PowerShell:**
-  Uses built-in `[System.Uri]::EscapeDataString()` for proper
percent-encoding
-  No path rewriting - frontend handles normalization via
`decodeURIComponent()` and backslash conversion
-  Proper UNC path support without special-casing
-  Removed DNS lookup to avoid slow operations
-  Removed custom URL encoding function

## Testing

All implementations were tested for:
-  URL encoding of special characters (spaces, #, ?, &, ;, +, %)
-  Correct OSC 7 format generation
-  Fish-native checks work correctly (TMUX, STY, TERM patterns)
-  Raw path encoding (PowerShell - no rewriting)
-  UNC path support (PowerShell)
-  Unix path handling
-  Go package compilation
-  No security issues (CodeQL)

## Path Handling Examples

**Fish:**
- `/home/user` → `/home/user`
- `/path with spaces` → `/path%20with%20spaces`
- `/file#hash` → `/file%23hash`

**PowerShell:**
- Windows: `C:\Users\Name` → `file://HOST/C%3A%5CUsers%5CName`
- UNC: `\\server\share\folder` →
`file://HOST/%5C%5Cserver%5Cshare%5Cfolder`
- Empty hostname: produces `file:///path` format

## Files Changed

- `pkg/util/shellutil/shellintegration/fish_wavefish.sh` (+22 lines, -18
lines = net +4 lines, but 19 lines of custom code removed)
- `pkg/util/shellutil/shellintegration/pwsh_wavepwsh.sh` (+26 lines, -51
lines = net -25 lines)

Total: 38 fewer lines of code with better functionality and
maintainability.

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-17 17:23:08 -07:00
Mike Sawka
6a173a6227
working on more terminal context (#2444)
* add automatic OSC 7 support to bash and zsh
* add new wave OSC 16162 (planck length) to get up-to-date shell
information into blockrtinfo. currently implemented only for zsh. bash
will not support as rich of data as zsh, but we'll be able to do some.
* new rtinfo will be used to provide better context for AI in the
future, and to make sure AI is running safe commands.
* added a small local machine description to tab context (so AI knows
we're running on MacOS, Linux, or Windows)
2025-10-17 12:19:40 -07:00
Evan Simkowitz
aa7713e015
Remove env vars in shellexec if the value is empty in the overriding map (#2007) 2025-02-21 10:38:25 -08:00
Mike Sawka
bba94a62d0
add jwt token back to wsl connections (#1841)
Co-authored-by: Evan Simkowitz <esimkowitz@users.noreply.github.com>
2025-01-24 14:24:15 -08:00
Evan Simkowitz
209647f343
Handle integer overflow cases in shellquote (#1822)
Resolves CodeQL warnings
2025-01-23 18:18:44 -08:00
Mike Sawka
ec07b172e5
pull cmd:env and initscripts into wave terminals (#1793) 2025-01-22 16:04:08 -08:00
Sylvie Crowe
ff5f26709c
WSL Updates for New Architecture (#1756)
This adapts most of the WSL code to follow the new architecture that ssh
uses.

---------

Co-authored-by: sawka <mike@commandline.dev>
2025-01-16 15:54:58 -08:00
Mike Sawka
9dc9066a81
conn updates 5 (#1755)
* token swap
* setting environment variables for different local/remote shells
* bug fixes for init scripts
* more logging
* update connserver startup flow
2025-01-16 11:17:29 -08:00
Mike Sawka
07d07472db
move genconn quote, and getshelltype to shellutil (#1731) 2025-01-14 15:29:36 -08:00
Mike Sawka
a24fe750c5
conn updates 4 (#1726) 2025-01-14 14:09:26 -08:00
Evan Simkowitz
b51ff834b2
Happy new year! (#1684)
Update all 2024 references to 2025
2025-01-04 20:56:57 -08:00
Mike Sawka
4fd6d36d8e
conn updates 2 (#1660)
* use pwsh over powershell if installed (on windows) for default shell
* refactor blockcontroller.DoRunShellCommand into a "setup" and "manage" phase
* fix wshcmd-conn to also disconnect wsl connections
* new genconn interfaces to make a standardized environment to run SSH/WSL commands via `sh -c`.  also create better quoting functions that are composable
* replace html/template with text/template for shell command templating (avoids special chars getting turned into HTML entities, breaking the commands)
* do not reinstall wsh if the installed version has a higher version (prevents flip-flopping on shared systems)
* simplify clientOs/clientArch detection.  use `uname -sm`.  also validate the os/arch combo as compatible with our builds.
* replace CpHostToRemote with CpWshToRemote. hard codes wsh paths inside of the function instead of having them passed in (quoting restrictions)
* new SyncBuffer class to use with commands that properly synchronizes Writes/String output
* fix setTermSize to actually update DB with terminal size
2025-01-02 14:15:32 -08:00
Evan Simkowitz
33f05c6e0c
Update data and config paths to match platform defaults (#1047)
Going forward for new installations, config and data files will be
stored at the platform default paths, as defined by
[env-paths](https://www.npmjs.com/package/env-paths).

For backwards compatibility, if the `~/.waveterm` or `WAVETERM_HOME`
directory exists and contains valid data, it will be used. If this check
fails, then `WAVETERM_DATA_HOME` and `WAVETERM_CONFIG_HOME` will be
used. If these are not defined, then `XDG_DATA_HOME` and
`XDG_CONFIG_HOME` will be used. Finally, if none of these are defined,
the [env-paths](https://www.npmjs.com/package/env-paths) defaults will
be used.

As with the existing app, dev instances will write to `waveterm-dev`
directories, while all others will write to `waveterm`.
2024-10-22 09:26:58 -07:00
Evan Simkowitz
74cda378f8
Embed static copy of docsite for help view (#949)
This will take the latest artifact from the waveterm-docs repo and embed
it in the app binary. When the help view is launched, it will be served
from our backend. If the embedded copy doesn't exist, such as in
unpackaged versions of the app or in locally packaged versions, it will
use the hosted site instead.

There is a sibling PR in the docs repository to build the embedded
version of the app (strips out some external links, removes Algolia
DocSearch, updates the baseUrl)
https://github.com/wavetermdev/waveterm-docs/pull/46
2024-10-03 20:28:05 -07:00
Mike Sawka
e46be65baf
guard wsh completion installation by prereqs (#364) 2024-09-11 11:14:38 -07:00
sawka
62eb04090a fix shell integration directories, add bash/zsh completion scripts 2024-09-09 22:26:10 -07:00
Sylvie Crowe
a9533b0426
SSH Agent Integration (#334)
Hook into an existing SSH Agent.
This allows us to pull keys already authenticated by the agent and write
to the agent ourselves.

---------

Co-authored-by: Evan Simkowitz <esimkowitz@users.noreply.github.com>
2024-09-06 13:19:38 -07:00
Mike Sawka
8ad84fd78a
update all gopkg imports (#330) 2024-09-05 14:25:45 -07:00
Mike Sawka
a5f563b52d
new directory structure and oldmigrate (#327) 2024-09-05 14:05:42 -07:00
Evan Simkowitz
0413b240dd
Only copy the relevant wavesrv binary when packaging for a specific architecture (#316)
This change shaves ~20 MB off the download size by only copying over the
wavesrv binary that is relevant for whichever architecture we're
currently packaging. This is only relevant for macOS at the moment,
though it can also apply to Windows when we get multi-arch builds
working.

This required renaming our Go binaries from .amd64 to .x64 to comply
with electron-builder's naming conventions.
2024-09-04 11:23:39 -07:00
Sylvie Crowe
b3a7c466e5
Powershell Wsh Integration (#320)
Add wsh to the path in powershell. Should work locally and in remote
connections. Should work on both windows and unix systems.
2024-09-04 02:13:00 -07:00
Evan Simkowitz
bd4bf93d4a
Update copyright indicators on a bunch of files (#255) 2024-08-20 17:01:29 -07:00
Mike Sawka
037497e7f1
wsh edit working (#252) 2024-08-20 14:56:48 -07:00
Sylvie Crowe
5cbf2673f4
windows ssh fixes (#250)
a couple small bug fixes
- wsh not being executable in windows (this doesn't add it to the path
yet)
- windows using the wrong slash for the path to wsh on the remote
2024-08-20 12:42:43 -07:00
Mike Sawka
85874f92ca
set up remote connserver (#245) 2024-08-18 21:26:44 -07:00
Sylvie Crowe
6bc3054733
SSH Wsh Install (#225)
This change adds the wsh installation to remote shells, so they have
access to its commands.
2024-08-15 21:32:08 -07:00
Sylvie Crowe
c192fe2663
Windows Pty (#206)
Add Windows Pty support, so the terminal works properly on windows
machines
2024-08-09 18:49:35 -07:00
sawka
de28e7e00c fix wshhome/bindir 2024-08-01 01:53:42 -07:00
Mike Sawka
75c274c104
wsh shellintegration (#189) 2024-07-31 23:47:33 -07:00
sawka
5b2a5eb5eb resize observer + run an ls command 2024-05-14 22:37:19 -07:00
sawka
35c6b232fc round trip a message to the backend that updates the terminal fe component 2024-05-14 16:53:03 -07:00