* working on cmd restart logic
* button to restart command
* bind Cmd-R to restart selected command, and Cmd-Shift-R to restart last command. Browser Refresh is now Option-R. also fix 'clear' command to not delete running commands (like archive). some small changes to keyboard utility code to always set 'alt' and 'meta' appropriately. use 'cmd' and 'option' for crossplatform bindings
* focus restarted line
* update termopts, use current winsize to set termopts for new command
* add cmd.restartts to track restart time
* display restarted time in line w/ tooltip with original time
* add restartts to line:show
* create proof of concept ssh library integration
This is a first attempt to integrate the golang crypto/ssh library for
handling remote connections. As it stands, this features is limited to
identity files without passphrases. It needs to be expanded to include
key+passphrase and password verifications as well.
* add password and keyboard-interactive ssh auth
This adds several new ssh auth methods. In addition to the PublicKey
method used previously, this adds password authentication,
keyboard-interactive authentication, and PublicKey+Passphrase
authentication.
Furthermore, it refactores the ssh connection code into its own wavesrv
file rather than storing int in waveshell's shexec file.
* clean up old mshell launch methods
In the debugging the addition of the ssh library, i had several versions
of the MShellProc Launch function. Since this seems mostly stable, I
have removed the old version and the experimental version in favor of
the combined version.
* allow switching between new and old ssh for dev
It is inconvenient to create milestones without being able to merge into
the main branch. But due to the experimental nature of the ssh changes,
it is not desired to use these changes in the main branch yet. This
change disables the new ssh launcher by default. It can be used by
changing the UseSshLibrary constant to true in remote.go. With this, it
becomes possible to merge these changes into the main branch without
them being used in production.
* fix: allow retry after ssh auth failure
Previously, the error status was not set when an ssh connection failed.
Because of this, an ssh connection failure would lock the failed remote
until waveterm was rebooted. This fix properly sets the error status so
this cannot happen.
Readonly variables cannot be reset and attempting to do so causes errors
on my machine. The `keymaps` and `widgets` variables caused problems, so
they have been added to the list of variables to ignore.
adds zsh support to waveterm. big change, lots going on here. lots of other improvements and bug fixes added while debugging and building out the feature.
Commits:
* refactor shexec parser.go into new package shellenv. separate out bash specific parsing from generic functions
* checkpoint
* work on refactoring shexec. created two new packages shellapi (for bash/zsh specific stuff), and shellutil (shared between shellapi and shexec)
* more refactoring
* create shellapi interface to abstract bash specific functionality
* more refactoring, move bash shell state parsing to shellapi
* move makeRcFile to shellapi. remove all of the 'client' options CLI options from waveshell
* get shellType passed through to server/single paths for waveshell
* add a local shelltype detector
* mock out a zshapi
* move shelltype through more of the code
* get a command to run via zsh
* zsh can now switch directories. poc, needs cleanup
* working on ShellState encoding differences between zsh/bash. Working on parsing zsh decls. move utilfn package into waveshell (shouldn't have been in wavesrv)
* switch to use []byte for vardecl serialization + diffs
* progress on zsh environment. still have issues reconciling init environment with trap environment
* fix typeset argument parsing
* parse promptvars, more zsh specific ignores
* fix bug with promptvar not getting set (wrong check in FeState func)
* add sdk (issue #188) to list of rtnstate commands
* more zsh compatibility -- working with a larger ohmyzsh environment. ignore more variables, handle exit trap better. unique path/fpath. add a processtype variable to base.
* must return a value
* zsh alias parsing/restoring. diff changes (and rtnstate changes). introduces linediff v1.
* force zmodload of zsh/parameter
* starting work on zsh functions
* need a v1 of mapdiff as well (to handle null chars)
* pack/unpack of ints was wrong (one used int and one use uint). turned out we only ever encoded '0' so it worked. that also means it is safe to change unpack to unpackUInt
* reworking for binary encoding of aliases and functions (because of zsh allows any character, including nulls, in names and values)
* fixes, working on functions, issue with line endings
* zsh functions. lots of ugliness here around dealing with line dicipline and cooked stty. new runcommand function to grab output from a non-tty fd. note that we still to run the actual command in a stty to get the proper output.
* write uuid tempdir, cleanup with tmprcfilename code
* hack in some simple zsh function declaration finding code for rtnstate. create function diff for rtnstate that supports zsh
* make sure key order is constant so shell hashes are consistent
* fix problems with state diffs to support new zsh formats. add diff/apply code to shellapi (moved from shellenv), that is now specific to zsh or bash
* add log packet and new shellstate packets
* switch to shellstate map that's also keyed by shelltype
* add shelltype to remoteinstance
* remove shell argument from waveshell
* added new shelltype statemap to remote.go (msh), deal with fallout
* move shellstate out of init packet, and move to an explicit reinit call. try to initialize all of the active shell states
* change dont always store init state (only store on demand). initialize shell states on demand (if not already initialized). allow reset to change shells
* add shellpref field to remote table. use to drive the default shell choice for new tabs
* show shelltag on cmdinput, pass through ri and remote (defaultshellstate)
* bump mshell version to v0.4
* better version validation for shellstate. also relax compatibility requirements for diffing states (shelltype + major version need to match)
* better error handling, check shellstate compatibility during run (on waveshell server)
* add extra separator for bash shellstate processing to deal with spurious output from rc files
* special migration for v30 -- flag invalid bash shell states and show special button in UI to fix
* format
* remove zsh-decls (unused)
* remove test code
* remove debug print
* fix typo
* first draft at ui
* first draft connecting openai to cmd info ui
* added more updates and added prompt engineering
* focus textarea on mount
* fix aichat layout issue
* added focus back to input after closing cmd info chat
* added ability to clear chat history, closes on command enter, better initial greeting message, and small things like user can refocus the help textarea by pressing ctrl + space again
* added a bunch of small upgrades
* added context for chatgpt info command
* added context to chatgpt cmd info command
* added ability to use arrow keys to grab code markdown
* added error handling as well as fixed the text area outline bug
* slightly changed the ui for selecting
* revamped ui and added correct scroll behavior
* changed ui, fixed up code block selection, some other small changes
* deep copied cmd info chat when we return
* added error checking and removed logs
* made deep copy code more clear
* prettier with the right version
* more prettier changes
* removed extraneous comment
* remove byte sanitization for user commands
When serializing jsonBytes in packet.go::MarshalPacket, a step existed
that attempted to manually sanitize the bytes before sending them. This
was initially done to avoid invalid characters in json; however, go
should handle this for us. But this sanitization broke
internationalization because it excluded characters required for unicode
in other languages. Because of that, it has been removed.
* properly decode non-ascii on frontend
The functions atob and btoa do not convert base 64 to strings in the
expected way. The base64ToArray function handles it properly but other
cases do not. These other cases have been replaced with a helper
function that makes use of the base64-js package. This package has
already been included as a dependency of another package we use, but it
was added to the package.json file to make the inclusion explicit.
* automatically set/share LANG var with waveshell
Waveterm previously did not set the LANG environment variable which
caused problems for international users. On Linux, this is done
automatically, but it needs to be done manually on macos.
Even on linux, the wavesrv LANG variable is shared with waveshell to
ensure the same one is used on remotes.
* only set the lang var if not previously set
In order to prevent waveterm from overriding the lang var entirely, this
ensures that it is only manually determined if it hasn't previously been
set.
* use envMap instead of os to determine var
This is slightly more performant and relies more directly on our code
instead of external code.
* Fix unvalidated path warning in cirfile.go
* Adding test
* move dir path vars into global scope, set wave home in test if not set already
* separate validation code into own testable func
* do removal of cir file in cleanup
* rename test file names
* flock should return err if waiting without done fn
* update comment
* use timeout context
* remove redundant validation
* add more error messages
* use filepath.join instead
* validate when creating cirfile too
* support .ptyout.cf, etc.
* remove validation as cirfile is "trusted", since it only accepts pre-validated input
* revert to passing nil context for flock in the Create file case
* take a stab at fixing #99. ignore invalid output before we see a real packet. the complication here was ensuring we always output a real packet in every flow so we don't actually lose valid errors.
* add ping packets to prime the parser (when in ignoreUntilValid mode)
* wrote client code for communicating with lambda cloud
* Added timeout functionality, added check for telemetry enabled for clouod completion, added capability to unset token, other small fixes
* removed stale prints and comments, readded non stream completion for now
* changed json encode to json marshal, also testing my new commit author
* added no telemetry error message and removed check for model in cloud completion
* added defer conn.close() to doOpenAIStreamCompletion, so websocket is always closed
* made a constant for the long telemetry error message
* added endpoint getter, made errors better
* updated scripthaus file to include dev ws endpoint
* added error check for open ai errors
* changed bool condition for better readability
* update some error messages (use error message from server if returned)
* dont blow up the whole response if the server times out. just write a timeout message
* render streaming errors with a new prompt in openai.tsx (show content and error). render cmd status 'error' with red x as well. show exitcode in tooltip of 'x'
* set hadError for errors. update timeout error to work with new frontend code
* bump client timeout to 5 minutes (longer than server timeout)
---------
Co-authored-by: sawka
* switch emain to using the bash from PATH, not defaulting to /bin/bash. not convinced this fixes#132 yet because the PATH set for MacOS applications is not set from .bash_profile or .zprofile. those seem to be set with launchctl setenv.
* move MacUserShell() func to shexec. use dscl UserShell output as bash path on MacOS when present. fixes#132