Commit Graph

58 Commits

Author SHA1 Message Date
Mike Sawka
9a825761da
merge v0.7.4 and v0.7.5 changes back into main (#644) 2024-05-02 16:17:38 -07:00
Sylvie Crowe
167277ec11
Rename Waveshell First Pass (#632)
This begins the process of renaming mshell to waveshell everywhere by
making the most simple changes. There will need to be additional changes
in the future, but the hope is to merge simple changes in now to reduce
the number of future merge conflicts.
2024-05-02 14:16:00 -07:00
Evan Simkowitz
c6a8797ddd
Break out non-autocomplete changes from autocomplete PR (#618)
This improves the ephemeral command runner to allow for honoring of
timeouts and proper handling of overriding the current working
directory. It also fixes some partially transparent font colors in light
mode, making them solid instead. It also updates the InputModel to be
auto-observable and utilize some getters to ensure the cmdinput is
getting updated whenever necessary state changes take place.
2024-04-29 18:29:27 -07:00
Mike Sawka
fcf8e4ed44
ignore ptmx error (#608) 2024-04-25 15:35:48 -07:00
Mike Sawka
0649a73d84
bump wave version to v0.7.3, bump waveshell version to v0.7 (#604) 2024-04-25 11:17:52 -07:00
Sylvie Crowe
2913babea7
Sudo Caching (#573)
* feat: share sudo between pty sessions

This is a first pass at a feature to cache the sudo password and share
it between different pty sessions. This makes it possible to not require
manual password entry every time sudo is used.

* feat: allow error handling and canceling sudo cmds

This adds the missing functionality that prevented failed sudo commands
from automatically closing.

* feat: restrict sudo caching to dev mode for now

* modify fullCmdStr not pk.Command

* refactor: condense ecdh encryptor creation

This refactors the common pieces needed to create an encryptor from an
ecdh key pair into a common function.

* refactor: rename promptenc to waveenc

* feat: add command to clear sudo password

We currently do not provide use of the sudo -k and sudo -K commands to
clear the sudo password. This adds a /sudo:clear command to handle it in
the meantime.

* feat: add kwarg to force sudo

In cases where parsing for sudo doesn't work, this provides an alternate
wave kwarg to use instead. It can be used with [sudo=1] at the beginning
of a command.

* refactor: simplify sudoArg parsing

* feat: allow user to clear all sudo passwords

This introduces the "all" kwarg for the sudo:clear command in order to
clear all sudo passwords.

* fix: handle deadline with real time

Golang's time module uses monatomic time by default, but that is not
desired for the password timeout since we want the timer to continue
even if the computer is asleep. We now avoid this by directly comparing
the unix timestamps.

* fix: remove sudo restriction to dev mode

This allows it to be used in regular builds as well.

* fix: switch to password timeout without wait group

This removes an unnecessary waiting period for sudo password entry.

* fix: update deadline in sudo:clear

This allows sudo:clear to cancel the goroutine for watching the password
timer.

* fix: pluralize sudo:clear message when all=1

This changes the output message for /sudo:clear to indicate multiple
passwords cleared if the all=1 kwarg is used.

* fix: use GetRemoteMap for getting remotes in clear

The sudo:clear command was directly looping over the GlobalStore.Map
which is not thread safe. Switched to GetRemoteMap which uses a lock
internally.

* fix: allow sudo metacmd to set sudo false

This fixes the logic for resolving if a command is a sudo command. This
change makes it possible for the sudo metacmd kwarg to force sudo to be
false.
2024-04-16 16:58:17 -07:00
Mike Sawka
6919dbfb5f
force our exit trap to always run (for rtnstate commands) (#556)
* add command validation to shellapi.  mock out bash/zsh versions

* implement validate command fn bash and zsh

* test validate command

* change rtnstate commands to always end with a builtin, so we always get our exit trap to run

* simplify the rtnstate modification, don't add the 'wait' (as this is a different problem/feature)

* update schema
2024-04-09 11:33:23 -07:00
Mike Sawka
181e14f55c
try to detect and return mimetype with stream file info (#552) 2024-04-05 10:52:04 -07:00
Mike Sawka
097623ab51
have initial run-command return faster to the frontend for quicker updating (#549)
* have initial run-command return faster to the frontend for quicker updating.  cuts time from 70-80ms down to 20ms for an average command

* remove wlogs

* more logging cleanup

* fix focus for when start cmd returns an error
2024-04-04 15:08:45 -07:00
Evan Simkowitz
ccc63937b6
Support running ephemeral commands (#543)
* initial

* save work, starting to add backend types

* save work

* save work

* Add EphemeralWriteCloser

* Command pipes thru, triggers infinite loop

* save debugging

* fix bad merge

* save debug statements

* fixing spaghetti

* clean up code

* got cwd override working

* Add separate paths for stdout and stderr writers

* fix stdout/stderr

* env vars are now working

* revert waveshell changes

* Making EphemeralWriteCloser into a more generic BufferedPipe

* formatting

* comment

* delete unused package

* more naming changes

* add package comment

* add UsePty to EphemeralRunOpts

* document UsePty

* ensure only one downstream writer can read from the buffer

* store pointer to syncs

* remove inshellisense stuff for now

* remove debugs

* revert yarn

* remove unnecessary debugs in main-server

* more debugging removed

* revert tsconfig
2024-04-02 15:46:32 -07:00
Mike Sawka
a1e4e807cc
update statediff algorithm for wavesrv / remote instances (#530)
* remote statemap from waveshell server (diff against initial state)

* move ShellStatePtr from sstore to packet so it can be passed over the wire

* add finalstatebaseptr to cmddone

* much improved diff computation code on wavesrv side

* fix displayname -- now using hash

* add comments, change a couple msh.WriteToPtyBuffer calls to log.Printfs
2024-03-28 16:56:39 -07:00
Mike Sawka
964751aae1
bump version to v0.7.2, bump waveshell version to 0.6 (#512) 2024-03-27 14:27:55 -07:00
Mike Sawka
bed191186c
allow empty pvars (important to *unset* the git directory when you leave it) (#507) 2024-03-27 13:07:24 -07:00
Mike Sawka
3c3eec73aa
reinit updates (#500)
* working on re-init when you create a tab.  some refactoring of existing reinit to make the messaging clearer.  auto-connect, etc.

* working to remove the 'default' shell states out of MShellProc.  each tab should have its own state that gets set on open.

* refactor newtab settings into individual components (and move to a new file)

* more refactoring of tab settings -- use same control in settings and newtab

* have screensettings use the same newtab settings components

* use same conn dropdown, fix classes, update some of the confirm messages to be less confusing (replace screen with tab)

* force a cr on a new tab to initialize state in a new line.  poc right now, need to add to new workspace workflow as well

* small fixups

* remove nohist from GetRawStr, make const

* update hover behavior for tabs

* fix interaction between change remote dropdown, cmdinput, error handling, and selecting a remote

* only switch screen remote if the activemainview is session (new remote flow).  don't switch it if we're on the connections page which is confusing.  also make it interactive

* fix wording on tos modal

* allow empty workspaces. also allow the last workspace to be deleted.  (prep for new startup sequence where we initialize the first session after tos modal)

* add some dead code that might come in use later (when we change how we show connection in cmdinput)

* working a cople different angles.  new settings tab-pulldown (likely orphaned).  and then allowing null activeScreen and null activeSession in workspaceview (show appropriate messages, and give buttons to create new tabs/workspaces).  prep for new startup flow

* don't call initActiveShells anymore.  also call ensureWorkspace() on TOS close

* trying to use new pulldown screen settings

* experiment with an escape keybinding

* working on tab settings close triggers

* close tab settings on tab switch

* small updates to tos popup, reorder, update button text/size, small wording updates

* when deleting a screen, send SIGHUP to all running commands

* not sure how this happened, lineid should not be passed to setLineFocus

* remove context timeouts for ReInit (it is now interactive, so it gets canceled like a normal command -- via ^C, and should not timeout on its own)

* deal with screen/session tombstones updates (ignore to quite warning)

* remove defaultfestate from remote

* fix issue with removing default ris

* remove dead code

* open the settings pulldown for new screens

* update prompt to show when the shell is still initializing (or if it failed)

* switch buttons to use wave button class, update messages, and add warning for no shell state

* all an override of rptr for dyncmds.  needed for the 'connect' command (we need to set the rptr to the *new* connection rather than the old one)

* remove old commented out code
2024-03-27 00:22:57 -07:00
Mike Sawka
0781e6e821
more zsh reinitialization fixes (allow user input during initialization process) (#480)
* fix error logs in scws

* new RpcFollowUpPacketType

* make the rpc/followup handlers generic on the server side -- using new RpcHandlers map and RpcFollowUpPacketType

* rpcinputpacket for passing user input back through to reinit command

* add WAVETERM_DEV env var in dev mode

* remove unused code, ensure mshell and rcfile directory on startup (prevent root clobber with sudo)

* combine all feinput into one function msh.HandleFeInput, and add a new concept of input sinks for special cases (like reinit)

* allow reset to accept user input (to get around interactive initialization problems)

* tone down the selection background highlight color on dark mode.  easier to read selected text

* fix command focus and done focus issues with dynamic (non-run) commands

* add 'module' as a 'rtnstate' command (#478)

* reinitialize shells in parallel, fix timeouts, better error messages
2024-03-20 23:38:05 -07:00
Mike Sawka
5616c9abbb
zsh reinit fixes (#477)
* reset command now initiates and completes async so there is feedback that something is happening when it takes a long time

* switch from standard rpc to rpciter

* checkpoint on reinit -- stream output, stats packet, logging to cmd pty, new endBytes for EOF

* make generic versions of endbytes scanner and channel output funcs

* update bash to use more modern state parsing (tricks learned from zsh)

* verbose mode, fix stats output message

* add a diff when verbose mode is on
2024-03-19 16:38:38 -07:00
Mike Sawka
901dcccaa5
zsh fixes (zmodload, k8s, new var type, track zsh prompt) (#473)
* checkpoint.  track zmodloads, get the expanded PS1 value, change how we store and deal with 'prompt vars', add commands to track k8s context

* fix some warnings, change IsPVar to IsExtVar, checkpoint

* parse zmodloads into state

* restore zmodloads, be more careful around readonly variable setting to avoid errors
2024-03-18 22:51:16 -07:00
Cole Lashley
0a14a58663
List Config dir if directory is specified (#468)
* implemented list dir for config

* added file stat and path check

* addressed comments, added file not found error
2024-03-18 17:11:13 -07:00
Mike Sawka
318aae18d5
better exit code handling -- fix error highlights to not cover SIGINT or SIGPIPE (#465)
* fix exitcode return to handle signals correctly -- use bash convention of 128 + signum.  don't show red error mask for SIGINT or SIGPIPE

* dont show left border for errors unless selected
2024-03-14 23:58:09 -07:00
Mike Sawka
bff51c851a
sync command to synchronize shell state with wave prompt (#444)
* remove two unused packet types, remove unused detatched command code

* CmdStart is invalid in this command loop

* slight refactor, remove closure funcs

* pass rct through to 'handle' funcs

* deal with rct (running command), update handler funcs accordingly

* update for runningcmdtype to be a pointer in the map (for updates)

* lots of changes related to ephemeral commands (for sync), checkpoint

* fix ephemeral setting

* sync shell state when you switch to a new tab
2024-03-13 18:52:41 -07:00
Mike Sawka
8b540cd989
bump waveshell to v0.5.0 (#403) 2024-03-07 13:06:34 -08:00
Mike Sawka
4357bcf1c8
implement /reset:cwd (fix for #278) and more (#392)
* checkpoint some ideas on a new branch

* checkpoint on new errors / errorcode passing

* get CodedError piped all the way through to infomsg

* implement a /reset:cwd command to deal with cases when the cwd is invalid.  other assorted debugging, utility, and fixups

* on invalid cwd, show message to run /reset:cwd
2024-03-06 16:37:54 -08:00
Mike Sawka
2735b03cb8
update go.sum files (#391) 2024-03-06 14:47:41 -08:00
Mike Sawka
a1ab25936e
zsh fixes (fix for #368), clean up zsh option handling, more debugging code (#387)
* logging and add a flag to debug returnstate file

* fix for issue #368.  clean up more zsh options.  force global_rcs to be off.
2024-03-06 11:38:27 -08:00
Evan Simkowitz
bde2a9ccfe
Update dependencies (#383)
* Bump go-github and update license disclaimers

* update go version

* upgrade electron-builder
2024-03-05 16:12:52 -08:00
Sylvie Crowe
6c115716b0
Integrate SSH Library with Waveshell Installation/Auto-update (#322)
* refactor launch code to integrate install easier

The previous set up of launch was difficult to navigate. This makes it
much clearer which will make the auto install flow easier to manage.

* feat: integrate auto install into new ssh setup

This change makes it possible to auto install using the ssh library
instead of making a call to the ssh cli command. This will auto install
if the installed waveshell version is incorrect or cannot be found.

* chore: clean up some lints for sshclient

There was a context that didn't have it's cancel function deferred and
an error that wasn't being handle. They're fixed now.

* fix: disconnect client if requested or launch fail

A recent commit made it so a client remained part of the MShellProc
after being disconnected. This is undesireable since a manual
disconnection indicates that the user will need to enter their
credentials again if required. Similarly, if the launch fails with an
error, the expectation is that credentials will have to be entered
again.

* fix: use legacy timer for the time being

The legacy timer frustrates me because it adds a lot of state to the
MShellProc struct that is complicated to manage. But it currently works,
so I will be keeping it for the time being.

* fix: change separator between remoteref and name

With the inclusion of the port number in the canonical id, the :
separator between the remoteref and remote name causes problems if the
port is parsed instead. This changes it to a # in order to avoid this
conflict.

* fix: check for null when closing extra files

It is possible for the list of extra files to contain null files. This
change ensures the null files will not be erroneously closed.

* fix: change connecting method to show port once

With port added to the canonicalname, it no longer makes sense to append
the port afterward.

* feat: use user input modal for sudo connection

The sudo connection used to have a unique way of entering a password.
This change provides an alternative method using the user input modal
that the other connection methods use. It does not work perfectly with
this revision, but the basic building blocks are in place. It needs a
few timer updates to be complete.

* fix: remove old timer to prevent conflicts with it

With this change the old timer is no longer needed. It is not fully
removed yet, but it is disabled so as to not get in the way.
Additionally, error handling has been slightly improved.

There is still a bug where an incorrect password prints a new password
prompt after the error message. That needs to be fixed in the future.
2024-02-29 11:37:03 -08:00
Evan Simkowitz
cbe9acf21b
Update go-github to latest version and tidy up dependencies (#337) 2024-02-26 11:39:04 -08:00
Mike Sawka
e2e71898c1
new wlog package to do distributed logging from waveshell back to wavesrv (#295) 2024-02-15 17:42:43 -08:00
sawka
fb7f055449 do not try to set ZDOTDIR in rcfile (ignore). remove spurious log messages 2024-02-14 18:21:23 -08:00
sawka
7a5afccab3 do not unset ZDOTDIR otherwise interactive configs will be unnecessarily re-read (causing big performance problem for zsh command initialization) 2024-02-09 20:05:00 -03:00
Cole Lashley
b37f7f722e
Command to copy file from remote to local (#231)
* first pass of copy file

* first pass fixing up function

* fleshed out copy function, still working on display and parameters

* implemented scp like syntax

* finished implemententation of copy file - there are still issues

* more bug fixes, still running into error

* pushing waveshell concurrency and channel fixes - still need to do some qol fixes before merge

* aesthetic fixes and removed logs

* fixed bug in GetRemoteRuntimeState

* formatting small fix

* fixed pretty print bytes

* added local to local command

* small fix removing workaround

* added workaround back

* added some logs for debug

* added some more logs

* quick bug fix for update cmd race condition

* added fix for race condition

* added some more logs for debugging

* fixed up logs

* added proper fe state for dest parameter

* implemented setting status indicator output

* first pass at updating status indicators

* removed logs and small fix ups

* removed whitespace

* addressed review comments
2024-02-08 17:37:23 -03:00
Mike Sawka
b136c915df
Restart command (#253)
* 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
2024-01-26 16:25:21 -08:00
Sylvie Crowe
018bb14b6a
Use ssh library for remote connections (#250)
* 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.
2024-01-25 10:18:11 -08:00
sawka
713acb664d fix setting of readonly vars issue with zsh rc files 2024-01-20 13:18:14 -08:00
sawka
467664af85 don't try to set readonly variables 2024-01-18 11:00:13 -08:00
Sylvia Crowe
0feaa57662 add two readonly variables to the ZshIgnoreVars
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.
2024-01-18 10:50:26 -08:00
Mike Sawka
7b9287316d
touchups to UI for AI chat feature (#237) 2024-01-17 15:39:24 -08:00
sawka
781ed2e57e updated build-helper.yml 2024-01-17 14:52:49 -08:00
Mike Sawka
422338c04b
zsh support (#227)
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
2024-01-16 16:11:04 -08:00
Cole Lashley
ea3be8115a
Chat GPT Command Info Chat (#207)
* 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
2024-01-11 17:34:23 -08:00
Sylvie Crowe
e1e5b67ff6
I18n fixes (#211)
* 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.
2024-01-08 18:31:17 -08:00
sawka
01074af129 fix warnings in waveshell 2023-12-26 15:03:17 -08:00
Evan Simkowitz
e7725e0e11
Clean up cirfile and cirfile_tests, ensure we are using contexts with cancellation signals (#183)
* 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
2023-12-22 18:07:58 -08:00
sawka
c56ee23843 add lines to ignored variables 2023-12-21 14:32:27 -08:00
Mike Sawka
a639d72e30
Packetparser Ignore Spurious Invalid Input at Beginning of Stream (#140)
* 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)
2023-12-18 12:42:40 -08:00
Mike Sawka
633cb8fbd0
fix openai packets to be PacketType. better compatibility with backend (#154)
also pass clientid to openapi cloud service
2023-12-15 22:43:59 -08:00
Cole Lashley
4ccd62f12a
Add support for proxying open AI chat completion through cloud (#148)
* 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
2023-12-15 22:20:03 -08:00
Mike Sawka
8200a312b9
On MacOS allow UserShell to override /bin/bash (#137)
* 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
2023-12-14 21:45:27 -08:00
Mike Sawka
4adcf6d92e
pass flexrows through to packet.TermOpts so it gets back to the FE correctly. this fixes wterm overrides and github issue #116 (#134) 2023-12-12 14:24:09 -08:00
sawka
0ece51e690 remove more go warnings 2023-12-05 10:49:30 -08:00