* 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