Commit Graph

115 Commits

Author SHA1 Message Date
Sylvie Crowe
d1319c0a2c
Fix Commands that Require Quoted Paths (#198)
* fix commands that require quoted paths

Several commands did not wrap the path in quotes which caused problems
when attempting to store the waveterm installation in a place that had a
space in the path. This corrects this in the particular case where the
username does not have spaces but the path to the executable does.

Note: the case of a user name having spaces has not been tested but
likely does not work.

* fix logging problem for wavesrv

A previous fix replaced the getWaveSrvCmd with getWaveSrvPath. This
needs to be getWaveSrvCmd to enable logging.

* fix variable name
2023-12-30 22:52:30 -08:00
Sylvie Crowe
8d88e2cf94
ssh config import (#156)
* create migrations for required database change

This is a first attempt that does not appear to be working properly. It
requires review.

* fix errors in db migrations

The previous commit had an extra json call that broke the update and did
not remove the imported interies during a downgrade.

* change migrations to use column instead of json

It makes more sense to associate the source of a config with the remote
type than the sshopts type. This change makes that clear in the database
structure.

* ensure adding a remote manually tags correctly

Using the usual way of adding a remote should result in a sshconfigsrc
of "waveterm-manual". This will be important for filtering out remotes
installed manually and remotes installed via import

* create basic structure for parsing ssh config

This entails creating a new command, making it possible to query only
the imported remotes from the database, and implementing the logic to
handle all of the updates needed.

This needs improvements in a few areas:
- the /etc/ssh/config needs to be parsed as well
- the logic for editing exisiting imported remotes needs to be written
- error handling needs to be improved
- update packet responses need to be provided

* add sshkey support and implement editing

We now search for the ssh identity keyfile and add it if it is found.
Additionally, the logic to edit previously imported ssh hosts has been
added.

* combine hosts from user and system ssh config

We now check both the user ~/.ssh/config as well as the /etc/ssh/config
for hosts. This loops through each file starting with the user one. For
each host, it selects the first pattern without a wildcard and chooses
that to be the alias. If any future hosts are found to have the same
alias, they are skipped. Errors are raised if neither config file can be
opened or no aliases were found.

* improve logging and error reporting

Error reporting is now shortcircuited in cases of individual remotes in
order to allow the other remotes to continue. These errors are now
printed to logs instead.

* allow imports to edit ssh port

Previously, ssh ports could not be edited after the fact. Unfortunately,
this can cause problems since the port can be changed in an ssh config
file. To address this, we allow imports to change the port if a host
with the same canonical name had previously been imported.

* fix response to parse command

* fix error handline for alias parsing

Small mistake of checking for equality instead of inequality

* fix the ability to overwrite hostName with alias

if ssh_config does not find Hostname, it won't output an error. Now we
compare against the result instead of looking for an error.

* fix the error catching for User and Port

This fixes the same problem where parsing the config doesn't give an
error in the case when nothing is found. As before, this checks for a
blank result instead.

* remove unused code

* remove repeated canonical name check

The logic that checks for an existing canonical name already exists in
the AddRemote function, so it is not needed here.

Secondly, we now only allow edits of previously created remotes if they
have not been archived. If they have, the usual logic for creating a new
remote takes precedence.

Lastly, there is no need to archive a remote that has already been
archived so an additional check has been added.

* allow archives to preserve the SSHConfigSrc

* add log message for archiving of imported remotes

* create variables for string variants

Matches existing code style

* add cleanup for opened files

* move migration 25 to migration 26 (already merged a migration 25)

* fix RemoteRuntimeState in ModelUpdate by moving type to sstore.go.  Fix some bugs in remote:parse.  Fix key/identityfile, return value, and remote editing (should go through msh).  remote sudo.  add info messages around parse status

* fix issue with archiving the sshconfigsrc

A bug in RemoteType's FromMap caused the loss of sshconfigsrc during the
conversion. This has been corrected and the schema has been updated.

* fix order of archiving removed imported remotes

Previously, if the canonical name changed, the code would try to create
a new remote before archiving the old one. This did not work if the
alias didn't change. Now we archive first and add a new remote after.

* fix ability to change port when importing config

Importing from sshconfig needs to allow the port to change. This was not
happening because of a bug that has been corrected.

* always use host in place of hostname

Since host is the key actually searched for in the ssh config file,
searching for user@hostName may not actually work. To avoid this, we now
always use user@host instead.

* automatically determine ConnectMode

This aims to select a connection mode based off what is provided in the
ssh config file. It aims for auto connections when possible but will
fall back to manual if we can't easily support it

* remove sshkeysource migration number confilict

Previously had conflicting migration numbers of 26. The change not in
the main branch has been moved to 27 to remove the conflict.

* move sshkeysource migration to migration 28

* add WaveOptions flag parsing for ssh config

This is currently being used to allow users to force manual connect mode
if desired. It will also be used to force skipping options in the future
but that is not complete in this commit.

* implement ignore flag for ssh config parsing

The ignore flag will now archive an imported remote if it previously
existed and not create a new remote in its place.

* fix discovery of identity file

Previously, a ~ in the identity file's path was not expanded to the home
dir. Because of this, files with a ~ were previously identified as
invalid files. By expanding it during the search, this is no longer the
case.

* disable frontend edit button for imported remotes

Imported Remotes should not be editable in waveterm by users. This edit
makes it clear that the button will not work for those cases. Further
edits may be needed to explain why it doesn't work and what to do
instead.

* add backend rejection of updating imported remote

As before, we don't want manual editing of an imported remote inside the
app. This ensures that it can't happen on the backend.

* create tooltips for sshconfig edit/delete buttons

For remotes that are imported, edits are not allowed. This adds a
tooltip that explains what to do instead.

Deleting remotes that are imported is allowed, but they will come back
if the user imports again. The tooltip explains a way to avoid this.

* add logo after name for imported remotes

In the connections screen, there previously was not a way to tell
imported connections from manually created connections. This change adds
a logo after the imported ones to differentiate them.

* small formatting updates

* add import tooltip to connection modal

Added the logo for an imported config to the connection modal. It also
provides a short description when it the mouse hovers over it.

* add button to import ssh config

Make the command into a button for a simple gui interface.

Also ran prettier to clean up some syntax.

* remove strict casing on WaveOptions

WaveOptions was previously very specific about the casing of the ignore
and connectmode subcommands. With this update, the casing is
automatically converted to lowercase and can be ignored.

* add status dot before name in connections screen

* add space and tooltip to connection imported icon

* re-prettier
2023-12-28 11:09:41 -08:00
Mike Sawka
2f7cce294c
big update to screen/session delete, and clear (#199)
* sync schema.sql with running schema

* remove incognito field from history table. also don't add empty FeState vars

* history updates, add festate, durationms, exitcode, status, and tags into history table

* update screen/session delete, and clear to no longer purge history items.  move deleted screens/sessions into a tombstone table.

* update schema

* fix alias -> fn

* quiet the security warning about an unchecked byte conversion. no real security issue here, but add a range check for good measure.
2023-12-27 13:11:53 -08:00
Mike Sawka
6a1b2c8bd4
Screen MemStore (#197)
* working on an in-memory store for screen information

* nostrpos sentinel

* textareainput now tracks selection (to update backend)

* make websocket connections much safer.  add a defer/panic handler for each ws message handled on backend.  don't allow client to reconnect to backend ws handler more than once per second (handles issue with lots of fast fails)

* use onSelect to have frontend textarea sync state to backend ScreenMem store

* restore cmdline when switching screens

* prettier
2023-12-26 12:59:25 -08:00
Evan Simkowitz
092a8de715
Escape error output in main-server to quiet security alert (#185) 2023-12-22 17:55:20 -08:00
sawka
8246f8118e bump to v0.5.3 to fix #174 2023-12-21 12:30:57 -08:00
sawka
e66f34c9b5 upgrade go crypto library 2023-12-18 20:45:00 -08:00
sawka
58e971276e minor fixes 2023-12-18 20:41:15 -08:00
Evan Simkowitz
226699732d
Run release check in the background when toggling the setting (#169)
* Run release check in the background when toggling the setting

* change var name

* use new err variable
2023-12-18 17:19:11 -08:00
sawka
f2eb383cc3 add special case for conda activate/deactivate as well to rtnstate detection 2023-12-18 15:07:13 -08:00
sawka
8d71f5538c update rtnstate detection, support blocks, and binary expressions 2023-12-18 15:02:55 -08:00
sawka
7a37fdb942 create new contexts for goroutine calls 2023-12-18 14:41:53 -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
sawka
d8d19ea035 bump to version v0.5.2 2023-12-17 23:58:09 -08:00
Mike Sawka
21ab82e2e2
Implement a Sidebar for Tabs (#157)
* work on basic sidebar layout

* fix more golang warnings

* sidebar open/close

* add ability to set width of split

* sidebar add and remove, set width, etc.

* almost working sidebar implementation -- still needs height/width, input control, and bug with initial add, but getting there

* add isSidebarOpen() method

* fix resize jump -- must set width in error handler as well (before window is loaded)

* sidebar UI touchups and help

* more sidebar progress, render more like regular lines, just in the right column

* merge

* move migration to 26

* simplify sidebar types

* checkpoint

* proxy things through parent screen object for sidebar

* checkpoint, add/remove from sidebar

* work on add/remove icons for sidebar

* fix height calculation, remove close button

* bring back close button when no line is selected

* add sidebar flag to run command to run new command output in sidebar

* implement 'sidebar' kwarg in eval.  this lets sidebar work for slashcommands as well that produce lines (codeedit, mdview, etc.)

* prettier

* minor fixes

* working on resizing.  must exclude sidebar entries and send separate resize events based on size of sidebar (implement exclude / include for resize)

* fix sidebar terminal command resizing

* add sidebar header (toggles for half/partial width and close).  add hotkey to open/close sidebar (Cmd-Ctrl-S).  more robust calculation for sidebar width. add width validation.  minimum sidebar width is 200px.  other fixes, etc.
2023-12-17 23:46:53 -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
Evan Simkowitz
b733724c7d
Add sidebar banner when new release is available (#147)
* Server impl

* add update check setting

* add commands

* fix capitalization of commands

* apply suggestions

* add migration and fix backend bugs

* Add sidebar banner

* remove installedversion, add 5s timeout

* add icon, capture and log errors from release check

* missing return nil

* remove highlight

* remove commented less

* do not fail releasecheckoncommand if release check operation fails

* remove debug condition

* fix update on auto check, move banner display logic into frontend

* remove unnecessary import

* simplify null check

* clean up the invoking of the releasechecker
2023-12-15 17:43:54 -08:00
Red J Adaya
ea9cb37de1
drag and drop support for tabs (#146)
* back-end implementation. initial ui implementation

* rough implementation of drag and drop

* wrap with AnimatePresence

* persist screen order

* cleanup

* return all screens when updating indices

* remove y axis anitation

* remove debugging code

* chain filtering and sorting logic

* remove unused var

* fix issue where tabs shift to left on hover

* fix tabElem scroll into view regression

* clear scrollIntoViewTimeout when component unmounts

* remove borken style prop

* completely remove animation related props

* scroll into view only when there's a new tab

* minor comment fix

* resolvePosInt() to resolve index

* move tab width const to magiclayout.ts

* move back scroll into view code as it was before

* clear timout

* refactor setTimeout

* remov debugging codes

* format cmdrunner.go

* move clearTimeout

* remove wheel event listener
2023-12-14 21:50:47 -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
Cole Lashley
535fd0d7d9
added openaibaseurl parameter to client:set (#141) 2023-12-13 14:03:22 -08:00
Evan Simkowitz
1feffc8a11
address comment, clean up tests 2023-12-12 20:36:16 -08:00
Evan Simkowitz
414937911e
remove nolint 2023-12-12 17:40:05 -08:00
Evan Simkowitz
5d39815dea
refactor a bit 2023-12-12 17:39:19 -08:00
Evan Simkowitz
96f636c2da
Fix potential overflow in promptenc arithmetic 2023-12-12 16:51:19 -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
Sylvie Crowe
e79dcaf910
fix ability to log into ssh with key and password (#130)
* fix ability to log into ssh with key and password

A previous refactor to the ssh password system broke the ability to use
key+password to log in. This change handles key+password as a special
case allowing it to be handled separately.

* clean up unnecessary print

My last change left in a debug print that wasn't necessary in the code.
This has been removed.
2023-12-12 14:17:53 -08:00
Evan Simkowitz
e6186cd694
Fixing linting errors in unused keygen function (#135)
* Fixing missing parameter error in unused keygen function

* applying error formatting linter suggestions

* fixing more linting suggestions
2023-12-12 14:17:03 -08:00
sawka
ce4b6d413c fix remaining warnings in workspace 2023-12-08 13:39:13 -08:00
Sylvie Crowe
87bf3f7a65
allow @ symbol in user for ssh connections (#129)
* allow @ symbol in user for ssh connections

Previously, the @ symbol was only used as a way to either:
- separate the user from the host
- separate "sudo" from the user

This change expands this to allow the username part of
sudo@username@host or username@host to contain any number of @ symbols
in addition to the ones previously allowed. Host is not allowed to
contain an @ symbol as per the usual definition.

* clean up regex changes

Moved the dash in the regex pattern to the end to make it explicitly
clear that it isn't part of a range.

Removed the hostNameRe regex as it is unused.
2023-12-07 18:33:16 -08:00
sawka
0ece51e690 remove more go warnings 2023-12-05 10:49:30 -08:00
sawka
724a68393a fix some go errors/warnings 2023-12-05 10:43:57 -08:00
Red J Adaya
0c756838e0
Tab Settings (#117)
* use Modal component

* icons selector

* do not limit icons in the backend
2023-12-04 09:52:59 -08:00
sawka
fc79da776c merge main into dev-0.5.1 2023-12-01 19:58:59 -08:00
sawka
24499cb0b5 change pterm variable name to wterm 2023-12-01 15:21:24 -08:00
sawka
b9e12b2623 bump version to v0.5.1 2023-11-30 10:06:06 -08:00
Sylvie Crowe
86a86bc756
Update clear so it no longer archives Running Commands (#110)
* fix clear so it doesn't archive running commands

Clear previously archived every command that existed in the current tab.
This change alters this behavior so the commands with a status of running
or detached are not archived by clear.  As things currently stand,
detached is not used so the only immediate effect will be with running
commands. As before, the clear command only affects the current tab.

* remove unnecessary print

A print statement for debug still existed in the ArchiveScreenLines
function. It has been removed.

* remove isWebShare from ArchiveScreenLines

The isWebShare feature is currently unused and there is not a plan to
add it back soon. For this reason, it has been removed from the
ArchiveScreenLines function.

* clean up query formatting
2023-11-29 18:29:44 -08:00
Luke (Zgroza) Klimek
98b373d401
Adjust the username regex - '_' character (#94)
* adjust the username regex - '_' character

* also allow dot in username regex (sawka)
2023-11-27 12:44:53 -08:00
sawka
64203e7823 update username regex to include dots and underscores 2023-11-25 11:30:42 -08:00
sawka
d9c7b61c91 also add nvm and virtualenv 2023-11-16 23:54:27 -08:00
sawka
0017946bbb add asdf to default rtnstate commands 2023-11-16 23:51:02 -08:00
sawka
ad0f11c097 allow terminal font sizes up to 24px 2023-11-16 22:49:59 -08:00
sawka
7da7d06f09 add a defer/recover to scws WriteJson 2023-11-10 13:36:37 -08:00
sawka
dd49e43579 update screen -> tab in user facing messages. waveshell var / ignore. fix bug with external urls 2023-11-10 12:31:31 -08:00
sawka
d61c8c05a6 SIGKILL will also kill waveshell. clear PendingStateCmds and WaitingCmds on disconnect (remote.go) 2023-11-09 18:29:11 -08:00
sawka
f4ac642afa fix bug where pendingStateCmds were cross screen boundaries. now screenid is part of the pendingStateCmd key 2023-11-09 17:47:24 -08:00
sawka
1a566d06aa gc was collecting the lockfile early causing it not to work. fixed with runtime.KeepAlive 2023-11-09 16:26:44 -08:00
sawka
68731f45a2 make binary paths consistent between dev/prod. add 'eval' as a rtnstate command. fix waveterm.lock file 2023-11-09 16:08:32 -08:00
sawka
1be2716f6e add square icon back, fix spacing somewhat 2023-11-07 16:15:54 -08:00
Red J Adaya
847de1fc60
new tab flow (#60)
* init

* init

* error handling

* use css

* minor improvements

* fix some issues and tabicon init

* show error indicator when empty and is required

* debounce input

* fix decorator linting issue

* icon system init

* fix bugs

* color custom icons and fix regression

* remove debugging code

* remove @tab-magenta. fix formatting.

* swap magenta for mint

* change tab color order
2023-11-07 00:04:25 -08:00
sawka
38a1f95115 migrate DB WAL file as well as DB file. make dev leftnav color more subtle 2023-11-02 14:05:43 -07:00
sawka
f2baa59af6 fix default workspace creation bug. fix no workspace message 2023-11-01 23:41:04 -07:00
sawka
a7c2d440b2 new tab colors. also re-implement tab gradients according to figma file 2023-11-01 22:38:37 -07:00
sawka
afc5bbd212
Update Data Directories and Environment Variables (#59)
* phase 1 of wave runtime migration.  update waveterm_dev, build vars, waveterm_app_path.  fix errors with plugins readmes and screenshot directories.  use asset loaders in webpack.  fix window-empty styles.  wave-migrate script.  remove unused scripthaus commands.  other fixes

* waveterm_home directory.  lots of internal scbase prompt names to wave

* update waveterm.lock file

* change wave data directories.  remove welcome modal code

* update waveterm.db name

* fix Wave menu (add back default items).  Update TOS modal words

* fix typescript errors
2023-11-01 01:26:19 -07:00
Red J Adaya
e7b58c1077
user oboarding flow (#54)
* init

* telemetry toggle

* finish styling and functionality

* remove unused style

* rever some styles

* use goroutine in sending telementry updates

* remove wave-modal class from AlertModal

* icons and button state fixes

* minor change with goroutines

* use default cursor not not-allowed
2023-10-30 22:39:51 -07:00
Red J Adaya
e0cd8516b8
update color tab names (#49)
* change color names and values

* migrations

* update tab colors in fe

* set to default instead of null

* minor server fixes
2023-10-28 13:14:20 -07:00
sawka
04cdab6f74 add metabarecmds into command completion 2023-10-26 00:01:52 -07:00
sawka
267b035fc8
remove autoinstall options from GUI, always set autoinstall flag, db migration to set autoinstall for all remotes (#48) 2023-10-25 22:07:00 -07:00
sawka
ce033c616f bump versions to v0.5.0, update package.json for Wave 2023-10-24 09:29:00 -07:00
anandamarsh
6016302814
PE 125 new tab flow (#43)
* please sync

* can select connection. now need add conection

* latest for discussion

* solved "autoselect connection" issue

* ready for PR

* pair programming, fix some issues with new tab flow

* final updates for new connection flow.  integrate add new connection with error messages.  add an option to cr to not create the line/history (non-interactive use)

---------

Co-authored-by: sawka
2023-10-23 23:22:18 -07:00
Red J Adaya
046d219555
add license notice (#37) 2023-10-16 21:31:13 -07:00
sawka
7c11296a94 add go.work for helping with VSCode gopls 2023-10-16 19:17:44 -07:00
sawka
266fc498c7 new paths for getting waveterm running with monorepo 2023-10-16 14:02:22 -07:00
sawka
18a44086fc rename imports for wavesrv 2023-10-16 13:30:10 -07:00
sawka
77fee42365 move to wavesrv directory to prepare for merge to waveterm 2023-10-16 13:19:34 -07:00