Commit Graph

169 Commits

Author SHA1 Message Date
Cole Lashley
4296856cc1
Fixed separator code in config path (#616)
* un quoted separator in config

* addressed review comments
2024-04-29 12:40:36 -07:00
Evan Simkowitz
d0867477ff
add path separator for config dir handler (#613) 2024-04-26 12:08:10 -07:00
Evan Simkowitz
25b77c7fee
Attempt 2 to resolve security warning (#612)
* replace path with filepath

* remove configPath from error

* remove unnecessary printf

* replace more paths with filepath

* remove unnecessary abs path call

* bad commit
2024-04-26 12:00:11 -07:00
Evan Simkowitz
db557e0b69
Validate config dir path to resolve security warning (#611)
* Attempt to validate config path to resolve security warning

* move above fullpath

* make sure path does not reference parent dir
2024-04-26 11:23:09 -07:00
Sylvie Crowe
a449cec33a
Sudo Config Gui (#603)
* feat: add gui elements to configure ssh pw cache

This adds a dropdown for on/off/notimeout, a number entry box for a
timeout value, and a toggle for clearing when the computer sleeps.

* fix: improve password timeout entry

This makes the password timeout more consistent by  using an inline
settings element. It also creates the inline settings element to parse
the input.

* feat: turn sudo password caching on and off

* feat: use configurable sudo timeout

This makes it possible to control how long waveterm stores your sudo
password. Note that if it changes, it immediately clears the cached
passwords.

* fix: clear existing sudo passwords if switched off

When the sudo password store state is changed to "off", all existing
passwords must immediately be cleared automatically.

* feat: allow clearing sudo passwords on suspend

This option makes it so the sudo passwords will be cleared when the
computer falls asleep.  It will never be used in the case where the
password is set to never time out.

* feat: allow notimeout to prevent sudo pw clear

This option allows the sudo timeout to be ignored while it is selected.

* feat: adjust current deadline based on user config

This allows the deadline to update as changes to the config are
happening.

* fix: reject a sudopwtimeout of 0 on the backend

* fix: use the default sudoPwTimeout for empty input

* fix: specify the timeout length is minutes

* fix: store sudopwtimeout in ms instead of minutes

* fix: formatting the default sudo timeout

By changing the order of operations, this no longer shows up as NaN if
the default is used.

* refactor: consolidate inlinesettingstextedit

This removes the number variant and combines them into the same class
with an option to switch between the two behaviors.

* refactor: consolidate textfield and numberfield

This removes the number variant of textfield. The textfield component
can now act as a numberfield when  the optional isNumber prop is true.
2024-04-25 18:19:43 -07:00
Cole Lashley
5e3243564b
Open AI Timeout setting and aliases for AI settings (#590)
* added ai timeout setting

* addressed review comments

* fixed baseurl gating for telemetry

* updated copy

* addressed review comments

* removed prefix for client:show and added units to timeout

* changed timeout to use ms precision
2024-04-25 16:14:37 -07:00
Mike Sawka
21d0dd076b
increase max websocket read limit. protect frontend from exceeding the read limit. limit input size to 10k characters. (#606) 2024-04-25 15:07:41 -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
Red J Adaya
50203a6934
Simplified terminal theming (#570)
* save work

* reusable StyleBlock component

* StyleBlock in elements dir

* root level

* ability to inherit root styles

* change prop from classname to selector

* selector should always be :root

* remove selector prop from StyleBlock

* working

* cleanup

* loadThemeStyles doesn't have to be async

* revert changes in tabs2.less

* remove old implementation

* cleanup

* remove file from another branch

* fix issue where line in history view doesn't reflect the terminal theme

* add key and value validation

* add label to tab settings terminal theme dropdown

* save work

* save work

* save work

* working

* trigger componentDidUpdate when switching tabs and sessions

* cleanup

* save work

* save work

* use UpdatePacket for theme changes as well

* make methods cohesive

* use themes coming from backend

* reload terminal when styel block is unmounted and mounted

* fix validation

* re-render terminal when theme is updated

* remove test styles

* cleanup

* more cleanup

* revert unneeded change

* more cleanup

* fix type

* more cleanup

* render style blocks in the header instead of body using portal

* add ability to reuse and dispose TermThemes instance and file watcher

* remove comment

* minor change

* separate filewatcher as singleton

* do not render app when term theme style blocks aren't rendered first

* only render main when termstyles have been rendered already

* add comment

* use DoUpdate to send themes to front-end

* support to watch subdirectories

* added support for watch subdirectories

* make watcher more flexible so it can be closed anywhere

* cleanup

* undo the app/main split

* use TermThemesType in creating initial value for Themes field

* simplify code

* fix issue where dropdown label doesn't float when the theme selected is Inherit

* remove unsed var

* start watcher in main, merge themes (don't overwrite) on event.

* ensure terminal-themes directory is created on startup

* ah, wait for termThemes to be set (the connect packet needs to have been processed to proceed with rendering)
2024-04-23 23:22:35 -07:00
Mike Sawka
8f93b3e263
activity updates for v0.7.3 (#600)
* adding more activity updates, tabs, workspaces, startup/shutdown

* name change, allow activity updates from FE.  aichat + history opens

* activity updates for non-standard renderers
2024-04-23 17:40:14 -07:00
Sylvie Crowe
8fdcf10cae
fix: ignore computer sleep for telemetry clock (#577)
* fix: ignore computer sleep for telemetry clock

This uses unix time with regular integer comparisons to prevent the
telemetry clock from needing to wait for 8 hours of the program running.
Now, it only needs to wait 8 real-time hours instead.

* drop telemetry time to 4 hours, tick every 10 minutes
2024-04-19 18:26:31 -07:00
Sylvie Crowe
39ee41921f
fix: add a new line when writing to knownhosts (#582)
This fixes issue #476 by ensuring that when waveterm writes to a
knownhosts file, a newline character is appended at the end.
2024-04-18 14:51:11 -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
Knox Lively
f86f010a34
updated the OpenAICloudCompletionTelemetryOffErrorMsg to include instructions for enabling telemetry (#564) 2024-04-09 22:14:42 -06: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
70088afdb5
daystr custom func (#555)
* working on daystr funcs

* daystr custom function
2024-04-05 22:42:22 -07:00
Sylvie Crowe
84cea373a8
SSH Bugfixes Early April 2024 (#551)
* fix: add vix for missing known_hosts file

In a recent cleanup, I accidentally deleted this fix from before. This
adds it back.

* chore: clarify that the ssh should use private key
2024-04-05 10:54:12 -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
a139633375
Send NumRunningCommands updates via the main bus, regardless of where other updates are being sent (#545) 2024-04-02 18:47:54 -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
Red J Adaya
ca5117cda0
Terminal theming (#485)
* init

* use setStyleVar

* backend implementation. scrope level terminal theming.

* only invoke this.applyTermTheme for keys that are updated. command runner for global term theme

* invoke applyTermTheme for global terminal themes as well

* fix nil error

* fix issue were theme can't be found

* fix issue where selected termtheme is not set as default value

* term theme switcher for session

* do not force reload after setting css vars

* fix issues. screenview terminal theme switcher

* remove debugging code

* move getTermThemes to util

* fix global theme reset

* fix workspace theme reset

* fix screenview terminal theme reset issue

* cleanup

* do not apply theme if theme hasn't changed

* do not apply theme if theme hasn't changed in workspace view

* cleanup

* cleanup

* force reload terminal

* fix inconsistency

* fix reset issue

* add a mobx reaction so that theming working when switching sessions

* workig reset

* simplify and cleanup

* refactor

* working global and session terminal theming

* add check

* perf improvement

* more perf improvements

* put reaction componentDidUpdate to make sure ref is already associated to the element

* cleanup

* fix issue where session theme is overriden by global theme on reload

* reduce flickering on reload

* more on reducing flickering on reload

* cleanup

* more cleanup

* fix file not found when no global theme is set

* screen level terminal theming

* update comment

* re-render terminal in history view. cleanup.

* cleanup

* merge main
2024-04-01 23:41:24 -07:00
Mike Sawka
0024f0f3e8
fix xterm.js versions and addon versions (#534)
* make xterm packages consistent

* add serializeAddon, fix varsUpdated
2024-03-29 10:52:18 -07:00
Mike Sawka
8a3d9628ba
add addons-webgl, protected with clientsettings flag (#532) 2024-03-28 23:19:39 -07:00
Mike Sawka
7c2265f3e3
add debug command to see remote-instance state (#531) 2024-03-28 18:53:16 -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
Cole Lashley
4879e90e91
fixed 2 more switches for baseurl (#527) 2024-03-28 13:14:05 -07:00
Cole Lashley
80c781bf4c
added check for no baseurl (#525) 2024-03-28 12:20:58 -07:00
Sylvie Crowe
7b58949027
fix: this prevents possible loops while connecting (#521)
A recent change made it possible to get stuck in a loop when connecting
to a remote. This reverts the part of it that caused this while
retaining the other behavior. This makes it possible to add to blank
known_host files again. It also adds a printout to display when a
connection is complete.
2024-03-27 21:19:35 -07:00
Cole Lashley
404f7eaac0
Ensure config dir and keybindings.json file to remove 404 keybindings file not found console error (#513)
* added ensure dir to config dir

* removed extraneous slashes
2024-03-27 14:55:03 -07:00
Sylvie Crowe
28dd9410fe
fix: properly handle missing knownhosts case (#510)
A bug prevented waveterm from being able to create missing knownhosts
files. This change corrects that.
2024-03-27 14:29:21 -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
Cole Lashley
aca197037d
Up baseurl max length to 50 (#496)
* upped max length

* added client:get and client:info, upped max length of baseurl

* added openai prefix for consistency

* updated client:show command and removed client:get and client:info
2024-03-27 14:00:52 -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
Evan Simkowitz
6065ee931f
Support os-native theming (#495)
* save work

* Add native theme support

* update index

* update var name

* remove comment

* fix code setting

* bump render version on change

* remove themeutil
2024-03-26 19:14:03 -07:00
Evan Simkowitz
a121bd4bb5
Move bookmarks, history, playbook, and telemetry code out of sstore (#493)
* break out telemetry and playbook

* break out bookmarks

* add license disclaimers
2024-03-25 20:20:52 -07:00
Cole Lashley
75a82de5bf
Adding engineered query to chat command (#488)
* added engineered query to chat command

* let ai know responses are rendered in markdown
2024-03-21 18:00:55 -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
Cole Lashley
fb59e094e4
Added formatters for prints (#479) 2024-03-20 16:29:46 -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
Red J Adaya
a32bc10981
Datepicker with dark and light theme support (#397)
* datepicker. add electron-rebuild sa dev dependency

* comments

* use <If> component for conditional renders

* invoke callback on month change

* individual inputs for date parts

* keyboard support for input

* more on keyboard support

* dynamic setting of input width based on their text value

* remove error if fromts is out of range

* format is optional

* undo electron-rebuild
2024-03-18 21:44:11 -07:00
Mike Sawka
631b9b89b9
fix nil rct error (#471) 2024-03-18 21:29:39 -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
Red J Adaya
07e0b53b17
Rght sidebar (#461)
* init

* model

* pass model

* increase snap threshold

* move saving of state to model. backend implementation

* fix wrong clientdata prop

* right header space for right sidebar toggles

* button component refactor

* set default classname to primary

* remove debugging code

* hide trigger for now

* disable right sidebar in production (only show on dev for now)
2024-03-14 22:59:55 -07:00
Sylvie Crowe
bfafb9e490
Ssh Extra Fixes (#459) 2024-03-14 16:50:58 -07:00
Mike Sawka
0f2f6c9cc0
quick media viewer (using new hmac read-file urls) (#451) 2024-03-14 00:49:05 -07:00
Mike Sawka
697f7c0758
fix hmac implementation/typo. read WaveAuthKey and store in scbase instead of main-server (#450) 2024-03-14 00:22:59 -07:00
Mike Sawka
865658aa92
allow hmac authentication for read-file (#449) 2024-03-13 23:59:20 -07:00
Mike Sawka
4c68fc4ceb
pdf viewer (#448)
* checkpoint on pdf viewer

* implement a pdf renderer (fix emain shFrameNavHandler to allow it)
2024-03-13 23:25:11 -07:00