Documentation ¶
Overview ¶
in-memory storage for waveterm server
Index ¶
- Constants
- Variables
- func AddInfoMsgUpdateError(update *scbus.ModelUpdatePacketType, errStr string)
- func AddLineUpdate(update *scbus.ModelUpdatePacketType, newLine *LineType, newCmd *CmdType)
- func AddScreenUpdate(update *scbus.ModelUpdatePacketType, newScreen *ScreenType)
- func AppendToCmdPtyBlob(ctx context.Context, screenId string, lineId string, data []byte, pos int64) (*scbus.PtyDataUpdatePacketType, error)
- func ArchiveScreen(ctx context.Context, sessionId string, screenId string) (scbus.UpdatePacket, error)
- func ArchiveScreenLines(ctx context.Context, screenId string) (*scbus.ModelUpdatePacketType, error)
- func ArchiveSession(ctx context.Context, sessionId string) (*scbus.ModelUpdatePacketType, error)
- func ClearCmdPtyFile(ctx context.Context, screenId string, lineId string) error
- func CloseDB()
- func CountScreenLines(ctx context.Context, screenId string) (int, error)
- func CountScreenUpdates(ctx context.Context) (int, error)
- func CountScreenWebShares(ctx context.Context) (int, error)
- func CreateCmdPtyFile(ctx context.Context, screenId string, lineId string, maxSize int64) error
- func DeleteLinesByIds(ctx context.Context, screenId string, lineIds []string) error
- func DeletePtyOutFile(ctx context.Context, screenId string, lineId string) error
- func DeleteScreen(ctx context.Context, screenId string, sessionDel bool, ...) (*scbus.ModelUpdatePacketType, error)
- func DeleteScreenDir(ctx context.Context, screenId string) error
- func DeleteScreenLines(ctx context.Context, screenId string) (*scbus.ModelUpdatePacketType, error)
- func DeleteSession(ctx context.Context, sessionId string) (scbus.UpdatePacket, error)
- func DeleteWebPtyPos(ctx context.Context, screenId string, lineId string) error
- func EnsureLocalRemote(ctx context.Context) error
- func FeStateFromShellState(state *packet.ShellState) map[string]string
- func FindLineIdByArg(ctx context.Context, screenId string, lineArg string) (string, error)
- func FullSessionDiskSize() (map[string]SessionDiskSizeType, error)
- func GetActiveSessionId(ctx context.Context) (string, error)
- func GetAllImportedRemotes(ctx context.Context) (map[string]*RemoteType, error)
- func GetCurStateDiffFromPtr(ctx context.Context, ssPtr *packet.ShellStatePtr) (*packet.ShellStateDiff, error)
- func GetCurrentIndicatorState() ([]*ScreenStatusIndicatorType, []*ScreenNumRunningCommandsType)
- func GetDB(ctx context.Context) (*sqlx.DB, error)
- func GetDBBackupName() string
- func GetDBName() string
- func GetDBVersion(ctx context.Context) (int, error)
- func GetDBWALBackupName() string
- func GetDBWALName() string
- func GetFirstSessionId(ctx context.Context) (string, error)
- func GetFullState(ctx context.Context, ssPtr packet.ShellStatePtr) (*packet.ShellState, error)
- func GetLineCmdByLineId(ctx context.Context, screenId string, lineId string) (*LineType, *CmdType, error)
- func GetRemoteActiveShells(ctx context.Context, remoteId string) ([]string, error)
- func GetRemoteState(ctx context.Context, sessionId string, screenId string, ...) (*packet.ShellState, *packet.ShellStatePtr, error)
- func GetRemoteStatePtr(ctx context.Context, sessionId string, screenId string, ...) (*packet.ShellStatePtr, error)
- func GetScreenSelectedLineId(ctx context.Context, screenId string) (string, error)
- func GetSessionCount(ctx context.Context) (int, error)
- func GetStateBase(ctx context.Context, baseHash string) (*packet.ShellState, error)
- func GetStateBaseVersion(ctx context.Context, baseHash string) (string, error)
- func GetStateDiff(ctx context.Context, diffHash string) (*packet.ShellStateDiff, error)
- func GetWebPtyPos(ctx context.Context, screenId string, lineId string) (int64, error)
- func GoDeleteScreenDirs(screenIds ...string)
- func HangupAllRunningCmds(ctx context.Context) error
- func IncrementNumRunningCmds(screenId string, delta int)
- func IncrementNumRunningCmds_Update(update *scbus.ModelUpdatePacketType, screenId string, delta int)
- func InfoMsgUpdate(infoMsgFmt string, args ...interface{}) *scbus.ModelUpdatePacketType
- func InsertLine(ctx context.Context, line *LineType, cmd *CmdType) error
- func InsertScreen(ctx context.Context, sessionId string, origScreenName string, ...) (*scbus.ModelUpdatePacketType, error)
- func InsertSessionWithName(ctx context.Context, sessionName string, activate bool) (*scbus.ModelUpdatePacketType, string, string, error)
- func IsValidConnectMode(mode string) bool
- func MakeMigrate() (*migrate.Migrate, error)
- func MaybeInsertPtyPosUpdate(ctx context.Context, screenId string, lineId string) error
- func MigrateCommandOpts(opts []string) error
- func MigrateDown() error
- func MigrateGoto(n uint) error
- func MigratePrintVersion() error
- func MigrateUp(targetVersion uint) error
- func MigrateUpStep(m *migrate.Migrate, newVersion uint) error
- func MigrateVersion(m *migrate.Migrate) (uint, bool, error)
- func NotifyUpdateWriter()
- func NumScreens(ctx context.Context) (int, error)
- func NumSessions(ctx context.Context) (int, error)
- func ReIndexSessions(ctx context.Context, sessionId string, newIndex int) error
- func ReInitFocus(ctx context.Context) error
- func ReadFullPtyOutFile(ctx context.Context, screenId string, lineId string) (int64, []byte, error)
- func ReadPtyOutFile(ctx context.Context, screenId string, lineId string, offset int64, ...) (int64, []byte, error)
- func RemoveScreenUpdate(ctx context.Context, updateId int64) error
- func RemoveScreenUpdates(ctx context.Context, updateIds []int64) error
- func ResetStatusIndicator(screenId string) error
- func ResetStatusIndicator_Update(update *scbus.ModelUpdatePacketType, screenId string) error
- func RunMigration13() error
- func RunMigration20() error
- func RunMigration30() error
- func ScreenMemAddCmdInfoChatMessage(screenId string, msg *packet.OpenAICmdInfoChatMessage)
- func ScreenMemClearCmdInfoChat(screenId string)
- func ScreenMemGetCmdInfoMessageCount(screenId string) int
- func ScreenMemIncrementNumRunningCommands(screenId string, delta int) int
- func ScreenMemInitCmdInfoChat(screenId string)
- func ScreenMemSetCmdInputText(screenId string, sp utilfn.StrWithPos, seqNum int)
- func ScreenMemSetIndicatorLevel(screenId string, level StatusIndicatorLevel)
- func ScreenMemUpdateCmdInfoChatMessage(screenId string, messageID int, msg *packet.OpenAICmdInfoChatMessage) error
- func ScreenUpdateViewOpts(ctx context.Context, screenId string, viewOpts ScreenViewOptsType) error
- func ScreenWebShareStart(ctx context.Context, screenId string, shareOpts ScreenWebShareOpts) error
- func ScreenWebShareStop(ctx context.Context, screenId string) error
- func SetActiveSessionId(ctx context.Context, sessionId string) error
- func SetClientOpts(ctx context.Context, clientOpts ClientOptsType) error
- func SetLineArchivedById(ctx context.Context, screenId string, lineId string, archived bool) error
- func SetReleaseInfo(ctx context.Context, releaseInfo ReleaseInfoType) error
- func SetScreenIdx(ctx context.Context, sessionId string, screenId string, newScreenIdx int) error
- func SetScreenName(ctx context.Context, sessionId string, screenId string, name string) error
- func SetSessionName(ctx context.Context, sessionId string, name string) error
- func SetStatusIndicatorLevel(ctx context.Context, screenId string, level StatusIndicatorLevel, force bool) error
- func SetStatusIndicatorLevel_Update(ctx context.Context, update *scbus.ModelUpdatePacketType, screenId string, ...) error
- func SetWebPtyPos(ctx context.Context, screenId string, lineId string, ptyPos int64) error
- func SetWinSize(ctx context.Context, winSize ClientWinSizeType) error
- func StatCmdPtyFile(ctx context.Context, screenId string, lineId string) (*cirfile.Stat, error)
- func StoreStateBase(ctx context.Context, state *packet.ShellState) error
- func StoreStateDiff(ctx context.Context, diff *packet.ShellStateDiff) error
- func SwitchScreenById(ctx context.Context, sessionId string, screenId string) (*scbus.ModelUpdatePacketType, error)
- func TryMigrateUp() error
- func UnArchiveScreen(ctx context.Context, sessionId string, screenId string) error
- func UnArchiveSession(ctx context.Context, sessionId string, activate bool) (*scbus.ModelUpdatePacketType, error)
- func UpdateClientFeOpts(ctx context.Context, feOpts FeOptsType) error
- func UpdateClientOpenAIOpts(ctx context.Context, aiOpts OpenAIOptsType) error
- func UpdateCmdDoneInfo(ctx context.Context, update *scbus.ModelUpdatePacketType, ck base.CommandKey, ...) error
- func UpdateCmdForRestart(ctx context.Context, ck base.CommandKey, ts int64, cmdPid int, remotePid int, ...) error
- func UpdateCmdRtnState(ctx context.Context, ck base.CommandKey, statePtr packet.ShellStatePtr) error
- func UpdateCmdStartInfo(ctx context.Context, ck base.CommandKey, cmdPid int, waveshellPid int) error
- func UpdateCmdTermOpts(ctx context.Context, screenId string, lineId string, termOpts TermOpts) error
- func UpdateCurRemote(ctx context.Context, screenId string, remotePtr RemotePtrType) error
- func UpdateLineHeight(ctx context.Context, screenId string, lineId string, heightVal int) error
- func UpdateLineRenderer(ctx context.Context, screenId string, lineId string, renderer string) error
- func UpdateLineStar(ctx context.Context, screenId string, lineId string, starVal int) error
- func UpdateLineState(ctx context.Context, screenId string, lineId string, lineState map[string]any) error
- func UpdateRemoteStateVars(ctx context.Context, remoteId string, stateVars map[string]string) error
- func UpdateWithAddNewOpenAICmdInfoPacket(ctx context.Context, screenId string, pk *packet.OpenAICmdInfoChatMessage) *scbus.ModelUpdatePacketType
- func UpdateWithClearOpenAICmdInfo(screenId string) *scbus.ModelUpdatePacketType
- func UpdateWithCurrentOpenAICmdInfoChat(screenId string, update *scbus.ModelUpdatePacketType) *scbus.ModelUpdatePacketType
- func UpdateWithUpdateOpenAICmdInfoPacket(ctx context.Context, screenId string, messageID int, ...) (*scbus.ModelUpdatePacketType, error)
- func UpdateWriterCheckMoreData()
- func UpsertRemote(ctx context.Context, r *RemoteType) error
- func WithTx(ctx context.Context, fn func(tx *TxWrap) error) error
- func WithTxRtn[RT any](ctx context.Context, fn func(tx *TxWrap) (RT, error)) (RT, error)
- func WithTxRtn3[RT1 any, RT2 any](ctx context.Context, fn func(tx *TxWrap) (RT1, RT2, error)) (RT1, RT2, error)
- type ActiveSessionIdUpdate
- type AlertMessageType
- type ClearInfoUpdate
- type ClientData
- type ClientOptsType
- type ClientWinSizeType
- type CmdDoneDataValues
- type CmdLineUpdate
- type CmdPtr
- type CmdType
- type ConnectUpdate
- type FeOptsType
- type FeStateType
- type InfoMsgType
- type InteractiveUpdate
- type LayoutType
- type LineType
- func AddCmdLine(ctx context.Context, screenId string, userId string, cmd *CmdType, ...) (*LineType, error)
- func AddCommentLine(ctx context.Context, screenId string, userId string, commentText string) (*LineType, error)
- func AddOpenAILine(ctx context.Context, screenId string, userId string, cmd *CmdType) (*LineType, error)
- func GetLineById(ctx context.Context, screenId string, lineId string) (*LineType, error)
- type LineUpdate
- type OpenAIChoiceType
- type OpenAICmdInfoChatStore
- type OpenAICmdInfoChatUpdate
- type OpenAIOptsType
- type OpenAIResponse
- type OpenAIUsage
- type PowerMonitorEventType
- type ReleaseInfoType
- type RemoteEditType
- type RemoteInstance
- func GetRIsForScreen(ctx context.Context, sessionId string, screenId string) ([]*RemoteInstance, error)
- func GetRemoteInstance(ctx context.Context, sessionId string, screenId string, ...) (*RemoteInstance, error)
- func ScreenReset(ctx context.Context, screenId string) ([]*RemoteInstance, error)
- func UpdateRemoteState(ctx context.Context, sessionId string, screenId string, ...) (*RemoteInstance, error)
- type RemoteOptsType
- type RemotePtrType
- type RemoteRuntimeState
- func (state RemoteRuntimeState) ExpandHomeDir(pathStr string) (string, error)
- func (state RemoteRuntimeState) GetBaseDisplayName() string
- func (state RemoteRuntimeState) GetDisplayName(rptr *RemotePtrType) string
- func (RemoteRuntimeState) GetType() string
- func (state RemoteRuntimeState) IsConnected() bool
- type RemoteType
- func GetAllRemotes(ctx context.Context) ([]*RemoteType, error)
- func GetLocalRemote(ctx context.Context) (*RemoteType, error)
- func GetRemoteByAlias(ctx context.Context, alias string) (*RemoteType, error)
- func GetRemoteByCanonicalName(ctx context.Context, cname string) (*RemoteType, error)
- func GetRemoteById(ctx context.Context, remoteId string) (*RemoteType, error)
- func UpdateRemote(ctx context.Context, remoteId string, editMap map[string]interface{}) (*RemoteType, error)
- type RemoteViewType
- type ResolveItem
- type SSHOpts
- type ScreenAnchorType
- type ScreenCreateOpts
- type ScreenLinesType
- type ScreenMemState
- type ScreenNumRunningCommandsType
- type ScreenOptsType
- type ScreenSidebarOptsType
- type ScreenStatusIndicatorType
- type ScreenTombstoneType
- type ScreenType
- func FixupScreenSelectedLine(ctx context.Context, screenId string) (*ScreenType, error)
- func GetScreenById(ctx context.Context, screenId string) (*ScreenType, error)
- func GetSessionScreens(ctx context.Context, sessionId string) ([]*ScreenType, error)
- func HangupCmd(ctx context.Context, ck base.CommandKey) (*ScreenType, error)
- func HangupRunningCmdsByRemoteId(ctx context.Context, remoteId string) ([]*ScreenType, error)
- func UpdateScreen(ctx context.Context, screenId string, editMap map[string]interface{}) (*ScreenType, error)
- func UpdateScreenFocusForDoneCmd(ctx context.Context, screenId string, lineId string) (*ScreenType, error)
- type ScreenUpdateType
- type ScreenViewOptsType
- type ScreenWebShareOpts
- type SessionDiskSizeType
- type SessionStatsType
- type SessionTombstoneType
- type SessionType
- func GetAllSessions(ctx context.Context) ([]*SessionType, error)
- func GetBareSessionById(ctx context.Context, sessionId string) (*SessionType, error)
- func GetBareSessions(ctx context.Context) ([]*SessionType, error)
- func GetSessionById(ctx context.Context, id string) (*SessionType, error)
- func GetSessionByName(ctx context.Context, name string) (*SessionType, error)
- func MakeSessionUpdateForRemote(sessionId string, ri *RemoteInstance) SessionType
- type SidebarValueType
- type SingleConnDBGetter
- type StateBase
- type StateDiff
- type StatusIndicatorLevel
- type TermOpts
- type TxWrap
Constants ¶
const ( RemoteField_Alias = "alias" // string RemoteField_ConnectMode = "connectmode" // string RemoteField_SSHKey = "sshkey" // string RemoteField_SSHPassword = "sshpassword" // string RemoteField_Color = "color" // string RemoteField_ShellPref = "shellpref" // string )
const ( ScreenField_AnchorLine = "anchorline" // int ScreenField_AnchorOffset = "anchoroffset" // int ScreenField_SelectedLine = "selectedline" // int ScreenField_Focus = "focustype" // string ScreenField_TabColor = "tabcolor" // string ScreenField_TabIcon = "tabicon" // string ScreenField_PTerm = "pterm" // string ScreenField_Name = "name" // string )
const ( LineTypeCmd = "cmd" LineTypeText = "text" LineTypeOpenAI = "openai" )
const ( LineState_Source = "prompt:source" LineState_File = "prompt:file" LineState_FileUrl = "wave:fileurl" LineState_Min = "wave:min" LineState_Template = "template" LineState_Mode = "mode" LineState_Lang = "lang" LineState_Minimap = "minimap" )
const ( MainViewSession = "session" MainViewBookmarks = "bookmarks" MainViewHistory = "history" MainViewConnections = "connections" MainViewSettings = "clientsettings" )
const ( CmdStatusRunning = "running" CmdStatusDetached = "detached" CmdStatusError = "error" CmdStatusDone = "done" CmdStatusHangup = "hangup" CmdStatusUnknown = "unknown" // used for history items where we don't have a status )
const ( OpenAIRoleSystem = "system" OpenAIRoleUser = "user" OpenAIRoleAssistant = "assistant" )
const ( RemoteAuthTypeNone = "none" RemoteAuthTypePassword = "password" RemoteAuthTypeKey = "key" RemoteAuthTypeKeyPassword = "key+password" )
const ( SSHConfigSrcTypeManual = "waveterm-manual" SSHConfigSrcTypeImport = "sshconfig-import" )
const ()
TODO: move to webshare package once sstore code is more modular
const ( ConnectModeStartup = "startup" ConnectModeAuto = "auto" ConnectModeManual = "manual" )
const ( RemoteTypeSsh = "ssh" RemoteTypeOpenAI = "openai" )
const ( ScreenFocusInput = "input" ScreenFocusCmd = "cmd" )
const ( CmdStoreTypeSession = "session" CmdStoreTypeScreen = "screen" )
const ( UpdateType_ScreenNew = "screen:new" UpdateType_ScreenDel = "screen:del" UpdateType_ScreenSelectedLine = "screen:selectedline" UpdateType_ScreenName = "screen:sharename" UpdateType_LineNew = "line:new" UpdateType_LineDel = "line:del" UpdateType_LineRenderer = "line:renderer" UpdateType_LineContentHeight = "line:contentheight" UpdateType_LineState = "line:state" UpdateType_CmdStatus = "cmd:status" UpdateType_CmdTermOpts = "cmd:termopts" UpdateType_CmdExitCode = "cmd:exitcode" UpdateType_CmdDurationMs = "cmd:durationms" UpdateType_CmdRtnState = "cmd:rtnstate" UpdateType_PtyPos = "pty:pos" )
const ( RemoteStatus_Connected = "connected" RemoteStatus_Connecting = "connecting" RemoteStatus_Disconnected = "disconnected" RemoteStatus_Error = "error" )
const APITokenSentinel = "--apitoken--"
const CmdLineSpecialMigration = 20
const (
CmdRendererOpenAI = "openai"
)
const CmdScreenSpecialMigration = 13
const DBFileName = "waveterm.db"
const DBFileNameBackup = "backup.waveterm.db"
const DBWALFileName = "waveterm.db-wal"
const DBWALFileNameBackup = "backup.waveterm.db-wal"
const DefaultCwd = "~"
const DefaultSessionName = "default"
const DefaultSudoTimeout = 5
const (
LayoutFull = "full"
)
const LineNoHeight = -1
const LocalRemoteAlias = "local"
const MaxLineStateSize = 4 * 1024 // 4k for now, can raise if needed
const MaxMigration = 31
const MigratePrimaryScreenVersion = 9
const MigrationChunkSize = 10
const RISpecialMigration = 30
const ShellTypePref_Detect = "detect"
defined here and not in packet.go since this value should never be passed to waveshell (it should always get resolved prior to sending a run packet)
Variables ¶
var MemLock *sync.Mutex = &sync.Mutex{}
global lock for all memory operations memory ops are very fast, so this is not a bottleneck
var ScreenMemStore map[string]*ScreenMemState = make(map[string]*ScreenMemState) // map of screenid -> ScreenMemState
var WebScreenPtyPosDelIntent = make(map[string]bool) // map[screenid + ":" + lineid] -> bool
var WebScreenPtyPosLock = &sync.Mutex{}
Functions ¶
func AddInfoMsgUpdateError ¶
func AddInfoMsgUpdateError(update *scbus.ModelUpdatePacketType, errStr string)
only sets InfoError if InfoError is not already set
func AddLineUpdate ¶
func AddLineUpdate(update *scbus.ModelUpdatePacketType, newLine *LineType, newCmd *CmdType)
func AddScreenUpdate ¶
func AddScreenUpdate(update *scbus.ModelUpdatePacketType, newScreen *ScreenType)
func AppendToCmdPtyBlob ¶
func ArchiveScreen ¶
func ArchiveScreenLines ¶
func ArchiveSession ¶
func ClearCmdPtyFile ¶
func CreateCmdPtyFile ¶
func DeleteLinesByIds ¶
func DeletePtyOutFile ¶
func DeleteScreen ¶
func DeleteScreen(ctx context.Context, screenId string, sessionDel bool, update *scbus.ModelUpdatePacketType) (*scbus.ModelUpdatePacketType, error)
if sessionDel is passed, we do *not* delete the screen directory (session delete will handle that)
func DeleteScreenLines ¶
func DeleteSession ¶
func DeleteWebPtyPos ¶
func EnsureLocalRemote ¶
func FeStateFromShellState ¶
func FeStateFromShellState(state *packet.ShellState) map[string]string
func FindLineIdByArg ¶
special "E" returns last unarchived line, "EA" returns last line (even if archived)
func FullSessionDiskSize ¶
func FullSessionDiskSize() (map[string]SessionDiskSizeType, error)
func GetAllImportedRemotes ¶
func GetAllImportedRemotes(ctx context.Context) (map[string]*RemoteType, error)
func GetCurStateDiffFromPtr ¶
func GetCurStateDiffFromPtr(ctx context.Context, ssPtr *packet.ShellStatePtr) (*packet.ShellStateDiff, error)
func GetCurrentIndicatorState ¶
func GetCurrentIndicatorState() ([]*ScreenStatusIndicatorType, []*ScreenNumRunningCommandsType)
func GetDBBackupName ¶
func GetDBBackupName() string
func GetDBWALBackupName ¶
func GetDBWALBackupName() string
func GetDBWALName ¶
func GetDBWALName() string
func GetFirstSessionId ¶
does not include archived, finds lowest sessionidx (for resetting active session)
func GetFullState ¶
func GetFullState(ctx context.Context, ssPtr packet.ShellStatePtr) (*packet.ShellState, error)
returns error when not found
func GetLineCmdByLineId ¶
func GetRemoteActiveShells ¶
func GetRemoteState ¶
func GetRemoteState(ctx context.Context, sessionId string, screenId string, remotePtr RemotePtrType) (*packet.ShellState, *packet.ShellStatePtr, error)
func GetRemoteStatePtr ¶
func GetRemoteStatePtr(ctx context.Context, sessionId string, screenId string, remotePtr RemotePtrType) (*packet.ShellStatePtr, error)
func GetScreenSelectedLineId ¶
func GetSessionCount ¶
counts non-archived sessions
func GetStateBase ¶
func GetStateBaseVersion ¶
func GetStateDiff ¶
func GetWebPtyPos ¶
func GoDeleteScreenDirs ¶
func GoDeleteScreenDirs(screenIds ...string)
func HangupAllRunningCmds ¶
func IncrementNumRunningCmds ¶
func IncrementNumRunningCmds_Update ¶
func IncrementNumRunningCmds_Update(update *scbus.ModelUpdatePacketType, screenId string, delta int)
func InfoMsgUpdate ¶
func InfoMsgUpdate(infoMsgFmt string, args ...interface{}) *scbus.ModelUpdatePacketType
func InsertScreen ¶
func InsertScreen(ctx context.Context, sessionId string, origScreenName string, opts ScreenCreateOpts, activate bool) (*scbus.ModelUpdatePacketType, error)
func InsertSessionWithName ¶
func InsertSessionWithName(ctx context.Context, sessionName string, activate bool) (*scbus.ModelUpdatePacketType, string, string, error)
returns (update, newSessionId, newScreenId, error) if sessionName == "", it will be generated
func IsValidConnectMode ¶
func MakeMigrate ¶
func MakeMigrate() (*migrate.Migrate, error)
func MaybeInsertPtyPosUpdate ¶
func MigrateCommandOpts ¶
func MigrateDown ¶
func MigrateDown() error
func MigrateGoto ¶
func MigratePrintVersion ¶
func MigratePrintVersion() error
func MigrateUpStep ¶
func MigrateVersion ¶
returns curVersion, dirty, error
func NotifyUpdateWriter ¶
func NotifyUpdateWriter()
func ReIndexSessions ¶
func ReInitFocus ¶
func ReadFullPtyOutFile ¶
returns (real-offset, data, err)
func ReadPtyOutFile ¶
func ReadPtyOutFile(ctx context.Context, screenId string, lineId string, offset int64, maxSize int64) (int64, []byte, error)
returns (real-offset, data, err)
func ResetStatusIndicator ¶
Resets the in-memory status indicator for the given screenId to StatusIndicatorLevel_None and pushes the new value to the FE
func ResetStatusIndicator_Update ¶
func ResetStatusIndicator_Update(update *scbus.ModelUpdatePacketType, screenId string) error
Resets the in-memory status indicator for the given screenId to StatusIndicatorLevel_None and adds it to the ModelUpdate
func RunMigration13 ¶
func RunMigration13() error
func RunMigration20 ¶
func RunMigration20() error
func RunMigration30 ¶
func RunMigration30() error
we're going to mark any invalid basestate versions as "invalid" so we can give a better error message for the FE and prompt a reset
func ScreenMemAddCmdInfoChatMessage ¶
func ScreenMemAddCmdInfoChatMessage(screenId string, msg *packet.OpenAICmdInfoChatMessage)
func ScreenMemClearCmdInfoChat ¶
func ScreenMemClearCmdInfoChat(screenId string)
func ScreenMemInitCmdInfoChat ¶
func ScreenMemInitCmdInfoChat(screenId string)
func ScreenMemSetCmdInputText ¶
func ScreenMemSetCmdInputText(screenId string, sp utilfn.StrWithPos, seqNum int)
func ScreenMemSetIndicatorLevel ¶
func ScreenMemSetIndicatorLevel(screenId string, level StatusIndicatorLevel)
Set the indicator to the given level, regardless of the current indicator level.
func ScreenMemUpdateCmdInfoChatMessage ¶
func ScreenMemUpdateCmdInfoChatMessage(screenId string, messageID int, msg *packet.OpenAICmdInfoChatMessage) error
func ScreenUpdateViewOpts ¶
func ScreenUpdateViewOpts(ctx context.Context, screenId string, viewOpts ScreenViewOptsType) error
func ScreenWebShareStart ¶
func ScreenWebShareStart(ctx context.Context, screenId string, shareOpts ScreenWebShareOpts) error
func SetClientOpts ¶
func SetClientOpts(ctx context.Context, clientOpts ClientOptsType) error
func SetLineArchivedById ¶
func SetReleaseInfo ¶
func SetReleaseInfo(ctx context.Context, releaseInfo ReleaseInfoType) error
func SetScreenIdx ¶
newScreenIdx is 1-indexed
func SetScreenName ¶
func SetStatusIndicatorLevel ¶
func SetStatusIndicatorLevel(ctx context.Context, screenId string, level StatusIndicatorLevel, force bool) error
Sets the in-memory status indicator for the given screenId to the given value and pushes the new value to the FE
func SetStatusIndicatorLevel_Update ¶
func SetStatusIndicatorLevel_Update(ctx context.Context, update *scbus.ModelUpdatePacketType, screenId string, level StatusIndicatorLevel, force bool) error
Sets the in-memory status indicator for the given screenId to the given value and adds it to the ModelUpdate. By default, the active screen will be ignored when updating status. To force a status update for the active screen, set force=true.
func SetWebPtyPos ¶
func SetWinSize ¶
func SetWinSize(ctx context.Context, winSize ClientWinSizeType) error
func StatCmdPtyFile ¶
func StoreStateBase ¶
func StoreStateBase(ctx context.Context, state *packet.ShellState) error
func StoreStateDiff ¶
func StoreStateDiff(ctx context.Context, diff *packet.ShellStateDiff) error
func SwitchScreenById ¶
func TryMigrateUp ¶
func TryMigrateUp() error
func UnArchiveScreen ¶
func UnArchiveSession ¶
func UpdateClientFeOpts ¶
func UpdateClientFeOpts(ctx context.Context, feOpts FeOptsType) error
func UpdateClientOpenAIOpts ¶
func UpdateClientOpenAIOpts(ctx context.Context, aiOpts OpenAIOptsType) error
func UpdateCmdDoneInfo ¶
func UpdateCmdDoneInfo(ctx context.Context, update *scbus.ModelUpdatePacketType, ck base.CommandKey, donePk CmdDoneDataValues, status string) error
func UpdateCmdForRestart ¶
func UpdateCmdRtnState ¶
func UpdateCmdRtnState(ctx context.Context, ck base.CommandKey, statePtr packet.ShellStatePtr) error
func UpdateCmdStartInfo ¶
func UpdateCmdTermOpts ¶
func UpdateCurRemote ¶
func UpdateCurRemote(ctx context.Context, screenId string, remotePtr RemotePtrType) error
func UpdateLineHeight ¶
func UpdateLineRenderer ¶
func UpdateLineStar ¶
func UpdateLineState ¶
func UpdateRemoteStateVars ¶
func UpdateWithAddNewOpenAICmdInfoPacket ¶
func UpdateWithAddNewOpenAICmdInfoPacket(ctx context.Context, screenId string, pk *packet.OpenAICmdInfoChatMessage) *scbus.ModelUpdatePacketType
func UpdateWithClearOpenAICmdInfo ¶
func UpdateWithClearOpenAICmdInfo(screenId string) *scbus.ModelUpdatePacketType
func UpdateWithCurrentOpenAICmdInfoChat ¶
func UpdateWithCurrentOpenAICmdInfoChat(screenId string, update *scbus.ModelUpdatePacketType) *scbus.ModelUpdatePacketType
func UpdateWithUpdateOpenAICmdInfoPacket ¶
func UpdateWithUpdateOpenAICmdInfoPacket(ctx context.Context, screenId string, messageID int, pk *packet.OpenAICmdInfoChatMessage) (*scbus.ModelUpdatePacketType, error)
func UpdateWriterCheckMoreData ¶
func UpdateWriterCheckMoreData()
func UpsertRemote ¶
func UpsertRemote(ctx context.Context, r *RemoteType) error
Types ¶
type ActiveSessionIdUpdate ¶
type ActiveSessionIdUpdate string
func (ActiveSessionIdUpdate) GetType ¶
func (ActiveSessionIdUpdate) GetType() string
type AlertMessageType ¶
type AlertMessageType struct { Title string `json:"title,omitempty"` Message string `json:"message"` Confirm bool `json:"confirm,omitempty"` Markdown bool `json:"markdown,omitempty"` }
func (AlertMessageType) GetType ¶
func (AlertMessageType) GetType() string
type ClearInfoUpdate ¶
type ClearInfoUpdate bool
func (ClearInfoUpdate) GetType ¶
func (ClearInfoUpdate) GetType() string
type ClientData ¶
type ClientData struct { ClientId string `json:"clientid"` UserId string `json:"userid"` UserPrivateKeyBytes []byte `json:"-"` UserPublicKeyBytes []byte `json:"-"` UserPrivateKey *ecdsa.PrivateKey `json:"-" dbmap:"-"` UserPublicKey *ecdsa.PublicKey `json:"-" dbmap:"-"` ActiveSessionId string `json:"activesessionid"` WinSize ClientWinSizeType `json:"winsize"` ClientOpts ClientOptsType `json:"clientopts"` FeOpts FeOptsType `json:"feopts"` CmdStoreType string `json:"cmdstoretype"` DBVersion int `json:"dbversion" dbmap:"-"` OpenAIOpts *OpenAIOptsType `json:"openaiopts,omitempty" dbmap:"openaiopts"` ReleaseInfo ReleaseInfoType `json:"releaseinfo"` }
func EnsureClientData ¶
func EnsureClientData(ctx context.Context) (*ClientData, error)
func (*ClientData) Clean ¶
func (cdata *ClientData) Clean() *ClientData
func (ClientData) GetType ¶
func (ClientData) GetType() string
func (ClientData) UseDBMap ¶
func (ClientData) UseDBMap()
type ClientOptsType ¶
type ClientOptsType struct { NoTelemetry bool `json:"notelemetry,omitempty"` NoReleaseCheck bool `json:"noreleasecheck,omitempty"` AcceptedTos int64 `json:"acceptedtos,omitempty"` ConfirmFlags map[string]bool `json:"confirmflags,omitempty"` MainSidebar *SidebarValueType `json:"mainsidebar,omitempty"` RightSidebar *SidebarValueType `json:"rightsidebar,omitempty"` GlobalShortcut string `json:"globalshortcut,omitempty"` GlobalShortcutEnabled bool `json:"globalshortcutenabled,omitempty"` WebGL bool `json:"webgl,omitempty"` AutocompleteEnabled bool `json:"autocompleteenabled,omitempty"` }
type ClientWinSizeType ¶
type CmdDoneDataValues ¶
type CmdLineUpdate ¶
type CmdLineUpdate utilfn.StrWithPos
func (CmdLineUpdate) GetType ¶
func (CmdLineUpdate) GetType() string
type CmdType ¶
type CmdType struct { ScreenId string `json:"screenid"` LineId string `json:"lineid"` Remote RemotePtrType `json:"remote"` CmdStr string `json:"cmdstr"` RawCmdStr string `json:"rawcmdstr"` FeState map[string]string `json:"festate"` StatePtr packet.ShellStatePtr `json:"state"` TermOpts TermOpts `json:"termopts"` OrigTermOpts TermOpts `json:"origtermopts"` Status string `json:"status"` CmdPid int `json:"cmdpid"` RemotePid int `json:"remotepid"` RestartTs int64 `json:"restartts,omitempty"` DoneTs int64 `json:"donets"` ExitCode int `json:"exitcode"` DurationMs int `json:"durationms"` RunOut []packet.PacketType `json:"runout,omitempty"` RtnState bool `json:"rtnstate,omitempty"` RtnStatePtr packet.ShellStatePtr `json:"rtnstateptr,omitempty"` Remove bool `json:"remove,omitempty"` // not persisted to DB Restarted bool `json:"restarted,omitempty"` // not persisted to DB }
func GetCmdByScreenId ¶
func GetRunningScreenCmds ¶
type ConnectUpdate ¶
type ConnectUpdate struct { Sessions []*SessionType `json:"sessions,omitempty"` Screens []*ScreenType `json:"screens,omitempty"` Remotes []*RemoteRuntimeState `json:"remotes,omitempty"` ScreenStatusIndicators []*ScreenStatusIndicatorType `json:"screenstatusindicators,omitempty"` ScreenNumRunningCommands []*ScreenNumRunningCommandsType `json:"screennumrunningcommands,omitempty"` ActiveSessionId string `json:"activesessionid,omitempty"` TermThemes *configstore.ConfigReturn `json:"termthemes,omitempty"` }
func GetConnectUpdate ¶
func GetConnectUpdate(ctx context.Context) (*ConnectUpdate, error)
Get all sessions and screens, including remotes
func (ConnectUpdate) GetType ¶
func (ConnectUpdate) GetType() string
type FeOptsType ¶
type FeOptsType struct { TermFontSize int `json:"termfontsize,omitempty"` TermFontFamily string `json:"termfontfamily,omitempty"` Theme string `json:"theme,omitempty"` TermThemeSettings map[string]string `json:"termthemesettings"` SudoPwStore string `json:"sudopwstore,omitempty"` SudoPwTimeoutMs int `json:"sudopwtimeoutms,omitempty"` SudoPwTimeout int `json:"sudopwtimeout,omitempty"` NoSudoPwClearOnSleep bool `json:"nosudopwclearonsleep,omitempty"` }
type FeStateType ¶
type InfoMsgType ¶
type InfoMsgType struct { InfoTitle string `json:"infotitle"` InfoError string `json:"infoerror,omitempty"` InfoErrorCode string `json:"infoerrorcode,omitempty"` InfoMsg string `json:"infomsg,omitempty"` InfoMsgHtml bool `json:"infomsghtml,omitempty"` InfoComps []string `json:"infocomps,omitempty"` InfoCompsMore bool `json:"infocompssmore,omitempty"` InfoLines []string `json:"infolines,omitempty"` TimeoutMs int64 `json:"timeoutms,omitempty"` }
func (InfoMsgType) GetType ¶
func (InfoMsgType) GetType() string
type InteractiveUpdate ¶
type InteractiveUpdate bool
func (InteractiveUpdate) GetType ¶
func (InteractiveUpdate) GetType() string
type LayoutType ¶
type LayoutType struct { Type string `json:"type"` Parent string `json:"parent,omitempty"` ZIndex int64 `json:"zindex,omitempty"` Float bool `json:"float,omitempty"` Top string `json:"top,omitempty"` Bottom string `json:"bottom,omitempty"` Left string `json:"left,omitempty"` Right string `json:"right,omitempty"` Width string `json:"width,omitempty"` Height string `json:"height,omitempty"` }
func (*LayoutType) Scan ¶
func (l *LayoutType) Scan(val interface{}) error
type LineType ¶
type LineType struct { ScreenId string `json:"screenid"` UserId string `json:"userid"` LineId string `json:"lineid"` Ts int64 `json:"ts"` LineNum int64 `json:"linenum"` LineNumTemp bool `json:"linenumtemp,omitempty"` LineLocal bool `json:"linelocal"` LineType string `json:"linetype"` LineState map[string]any `json:"linestate"` Renderer string `json:"renderer,omitempty"` Text string `json:"text,omitempty"` Ephemeral bool `json:"ephemeral,omitempty"` ContentHeight int64 `json:"contentheight,omitempty"` Star bool `json:"star,omitempty"` Archived bool `json:"archived,omitempty"` Remove bool `json:"remove,omitempty"` }
func AddCmdLine ¶
func AddCommentLine ¶
func AddOpenAILine ¶
func GetLineById ¶
can return nil, nil if line is not found
type LineUpdate ¶
func (LineUpdate) GetType ¶
func (LineUpdate) GetType() string
type OpenAIChoiceType ¶
type OpenAICmdInfoChatStore ¶
type OpenAICmdInfoChatStore struct { MessageCount int `json:"messagecount"` Messages []*packet.OpenAICmdInfoChatMessage `json:"messages"` }
func ScreenMemDeepCopyCmdInfoChatStore ¶
func ScreenMemDeepCopyCmdInfoChatStore(store *OpenAICmdInfoChatStore) *OpenAICmdInfoChatStore
func ScreenMemGetCmdInfoChat ¶
func ScreenMemGetCmdInfoChat(screenId string) *OpenAICmdInfoChatStore
type OpenAICmdInfoChatUpdate ¶
type OpenAICmdInfoChatUpdate []*packet.OpenAICmdInfoChatMessage
func (OpenAICmdInfoChatUpdate) GetType ¶
func (OpenAICmdInfoChatUpdate) GetType() string
type OpenAIOptsType ¶
type OpenAIResponse ¶
type OpenAIResponse struct { Model string `json:"model"` Created int64 `json:"created"` Usage *OpenAIUsage `json:"usage,omitempty"` Choices []OpenAIChoiceType `json:"choices,omitempty"` }
type OpenAIUsage ¶
type PowerMonitorEventType ¶
type PowerMonitorEventType struct {
Status string `json:"status"`
}
type ReleaseInfoType ¶
type ReleaseInfoType struct {
LatestVersion string `json:"latestversion,omitempty"`
}
type RemoteEditType ¶
type RemoteInstance ¶
type RemoteInstance struct { RIId string `json:"riid"` Name string `json:"name"` SessionId string `json:"sessionid"` ScreenId string `json:"screenid"` RemoteOwnerId string `json:"remoteownerid"` RemoteId string `json:"remoteid"` FeState map[string]string `json:"festate"` ShellType string `json:"shelltype"` StateBaseHash string `json:"-"` StateDiffHashArr []string `json:"-"` // only for updates Remove bool `json:"remove,omitempty"` }
func GetRIsForScreen ¶
func GetRemoteInstance ¶
func GetRemoteInstance(ctx context.Context, sessionId string, screenId string, remotePtr RemotePtrType) (*RemoteInstance, error)
func ScreenReset ¶
func ScreenReset(ctx context.Context, screenId string) ([]*RemoteInstance, error)
returns riids of deleted RIs
func UpdateRemoteState ¶
func UpdateRemoteState(ctx context.Context, sessionId string, screenId string, remotePtr RemotePtrType, feState FeStateType, stateBase *packet.ShellState, stateDiff *packet.ShellStateDiff) (*RemoteInstance, error)
func (*RemoteInstance) FromMap ¶
func (ri *RemoteInstance) FromMap(m map[string]interface{}) bool
func (*RemoteInstance) ToMap ¶
func (ri *RemoteInstance) ToMap() map[string]interface{}
type RemoteOptsType ¶
type RemoteOptsType struct {
Color string `json:"color"`
}
type RemotePtrType ¶
type RemotePtrType = scpacket.RemotePtrType
type RemoteRuntimeState ¶
type RemoteRuntimeState struct { RemoteType string `json:"remotetype"` RemoteId string `json:"remoteid"` RemoteAlias string `json:"remotealias,omitempty"` RemoteCanonicalName string `json:"remotecanonicalname"` RemoteVars map[string]string `json:"remotevars"` Status string `json:"status"` ConnectTimeout int `json:"connecttimeout,omitempty"` CountdownActive bool `json:"countdownactive"` ErrorStr string `json:"errorstr,omitempty"` InstallStatus string `json:"installstatus"` InstallErrorStr string `json:"installerrorstr,omitempty"` NeedsWaveshellUpgrade bool `json:"needswaveshellupgrade,omitempty"` NoInitPk bool `json:"noinitpk,omitempty"` AuthType string `json:"authtype,omitempty"` ConnectMode string `json:"connectmode"` AutoInstall bool `json:"autoinstall"` Archived bool `json:"archived,omitempty"` RemoteIdx int64 `json:"remoteidx"` SSHConfigSrc string `json:"sshconfigsrc"` UName string `json:"uname"` WaveshellVersion string `json:"waveshellversion"` WaitingForPassword bool `json:"waitingforpassword,omitempty"` Local bool `json:"local,omitempty"` IsSudo bool `json:"issudo,omitempty"` RemoteOpts *RemoteOptsType `json:"remoteopts,omitempty"` CanComplete bool `json:"cancomplete,omitempty"` ShellPref string `json:"shellpref,omitempty"` DefaultShellType string `json:"defaultshelltype,omitempty"` }
func (RemoteRuntimeState) ExpandHomeDir ¶
func (state RemoteRuntimeState) ExpandHomeDir(pathStr string) (string, error)
func (RemoteRuntimeState) GetBaseDisplayName ¶
func (state RemoteRuntimeState) GetBaseDisplayName() string
func (RemoteRuntimeState) GetDisplayName ¶
func (state RemoteRuntimeState) GetDisplayName(rptr *RemotePtrType) string
func (RemoteRuntimeState) GetType ¶
func (RemoteRuntimeState) GetType() string
func (RemoteRuntimeState) IsConnected ¶
func (state RemoteRuntimeState) IsConnected() bool
type RemoteType ¶
type RemoteType struct { RemoteId string `json:"remoteid"` RemoteType string `json:"remotetype"` RemoteAlias string `json:"remotealias"` RemoteCanonicalName string `json:"remotecanonicalname"` RemoteOpts *RemoteOptsType `json:"remoteopts"` LastConnectTs int64 `json:"lastconnectts"` RemoteIdx int64 `json:"remoteidx"` Archived bool `json:"archived"` // SSH fields Local bool `json:"local"` RemoteUser string `json:"remoteuser"` RemoteHost string `json:"remotehost"` ConnectMode string `json:"connectmode"` AutoInstall bool `json:"autoinstall"` SSHOpts *SSHOpts `json:"sshopts"` StateVars map[string]string `json:"statevars"` SSHConfigSrc string `json:"sshconfigsrc"` ShellPref string `json:"shellpref"` // bash, zsh, or detect // OpenAI fields (unused) OpenAIOpts *OpenAIOptsType `json:"openaiopts,omitempty"` }
func GetAllRemotes ¶
func GetAllRemotes(ctx context.Context) ([]*RemoteType, error)
func GetLocalRemote ¶
func GetLocalRemote(ctx context.Context) (*RemoteType, error)
func GetRemoteByAlias ¶
func GetRemoteByAlias(ctx context.Context, alias string) (*RemoteType, error)
func GetRemoteByCanonicalName ¶
func GetRemoteByCanonicalName(ctx context.Context, cname string) (*RemoteType, error)
func GetRemoteById ¶
func GetRemoteById(ctx context.Context, remoteId string) (*RemoteType, error)
func UpdateRemote ¶
func UpdateRemote(ctx context.Context, remoteId string, editMap map[string]interface{}) (*RemoteType, error)
editMap: alias, connectmode, autoinstall, sshkey, color, sshpassword (from constants) note that all validation should have already happened outside of this function
func (*RemoteType) FromMap ¶
func (r *RemoteType) FromMap(m map[string]interface{}) bool
func (*RemoteType) GetName ¶
func (r *RemoteType) GetName() string
func (*RemoteType) IsLocal ¶
func (r *RemoteType) IsLocal() bool
func (*RemoteType) IsSudo ¶
func (r *RemoteType) IsSudo() bool
func (*RemoteType) ToMap ¶
func (r *RemoteType) ToMap() map[string]interface{}
type RemoteViewType ¶
type RemoteViewType struct { RemoteShowAll bool `json:"remoteshowall,omitempty"` PtyRemoteId string `json:"ptyremoteid,omitempty"` RemoteEdit *RemoteEditType `json:"remoteedit,omitempty"` }
func (RemoteViewType) GetType ¶
func (RemoteViewType) GetType() string
type ResolveItem ¶
func GetLineResolveItems ¶
func GetLineResolveItems(ctx context.Context, screenId string) ([]ResolveItem, error)
type SSHOpts ¶
type SSHOpts struct { Local bool `json:"local,omitempty"` IsSudo bool `json:"issudo,omitempty"` SSHHost string `json:"sshhost"` SSHUser string `json:"sshuser"` SSHOptsStr string `json:"sshopts,omitempty"` SSHIdentity string `json:"sshidentity,omitempty"` SSHPort int `json:"sshport,omitempty"` SSHPassword string `json:"sshpassword,omitempty"` }
func (SSHOpts) GetAuthType ¶
type ScreenAnchorType ¶
type ScreenCreateOpts ¶
type ScreenCreateOpts struct { BaseScreenId string CopyRemote bool CopyCwd bool CopyEnv bool RtnScreenId *string }
func (ScreenCreateOpts) HasCopy ¶
func (sco ScreenCreateOpts) HasCopy() bool
type ScreenLinesType ¶
type ScreenLinesType struct { ScreenId string `json:"screenid"` Lines []*LineType `json:"lines" dbmap:"-"` Cmds []*CmdType `json:"cmds" dbmap:"-"` }
func GetScreenLinesById ¶
func GetScreenLinesById(ctx context.Context, screenId string) (*ScreenLinesType, error)
func (ScreenLinesType) GetType ¶
func (ScreenLinesType) GetType() string
func (ScreenLinesType) UseDBMap ¶
func (ScreenLinesType) UseDBMap()
type ScreenMemState ¶
type ScreenMemState struct { NumRunningCommands int `json:"numrunningcommands,omitempty"` StatusIndicator StatusIndicatorLevel `json:"statusindicator,omitempty"` CmdInputText utilfn.StrWithPos `json:"cmdinputtext,omitempty"` CmdInputSeqNum int `json:"cmdinputseqnum,omitempty"` AICmdInfoChat *OpenAICmdInfoChatStore `json:"aicmdinfochat,omitempty"` }
func GetScreenMemState ¶
func GetScreenMemState(screenId string) *ScreenMemState
safe because we return a copy
type ScreenNumRunningCommandsType ¶
func (ScreenNumRunningCommandsType) GetType ¶
func (ScreenNumRunningCommandsType) GetType() string
type ScreenOptsType ¶
type ScreenSidebarOptsType ¶
type ScreenStatusIndicatorType ¶
type ScreenStatusIndicatorType struct { ScreenId string `json:"screenid"` Status StatusIndicatorLevel `json:"status"` }
func (ScreenStatusIndicatorType) GetType ¶
func (ScreenStatusIndicatorType) GetType() string
type ScreenTombstoneType ¶
type ScreenTombstoneType struct { ScreenId string `json:"screenid"` SessionId string `json:"sessionid"` Name string `json:"name"` DeletedTs int64 `json:"deletedts"` ScreenOpts ScreenOptsType `json:"screenopts"` }
func (ScreenTombstoneType) GetType ¶
func (ScreenTombstoneType) GetType() string
func (ScreenTombstoneType) UseDBMap ¶
func (ScreenTombstoneType) UseDBMap()
type ScreenType ¶
type ScreenType struct { SessionId string `json:"sessionid"` ScreenId string `json:"screenid"` Name string `json:"name"` ScreenIdx int64 `json:"screenidx"` ScreenOpts ScreenOptsType `json:"screenopts"` ScreenViewOpts ScreenViewOptsType `json:"screenviewopts"` OwnerId string `json:"ownerid"` CurRemote RemotePtrType `json:"curremote"` NextLineNum int64 `json:"nextlinenum"` SelectedLine int64 `json:"selectedline"` Anchor ScreenAnchorType `json:"anchor"` FocusType string `json:"focustype"` Archived bool `json:"archived,omitempty"` ArchivedTs int64 `json:"archivedts,omitempty"` // only for updates Remove bool `json:"remove,omitempty"` }
func FixupScreenSelectedLine ¶
func FixupScreenSelectedLine(ctx context.Context, screenId string) (*ScreenType, error)
returns updated screen (only if updated)
func GetScreenById ¶
func GetScreenById(ctx context.Context, screenId string) (*ScreenType, error)
func GetSessionScreens ¶
func GetSessionScreens(ctx context.Context, sessionId string) ([]*ScreenType, error)
includes archived screens
func HangupCmd ¶
func HangupCmd(ctx context.Context, ck base.CommandKey) (*ScreenType, error)
TODO send update
func HangupRunningCmdsByRemoteId ¶
func HangupRunningCmdsByRemoteId(ctx context.Context, remoteId string) ([]*ScreenType, error)
TODO send update
func UpdateScreen ¶
func (*ScreenType) FromMap ¶
func (s *ScreenType) FromMap(m map[string]interface{}) bool
func (ScreenType) GetType ¶
func (ScreenType) GetType() string
func (*ScreenType) ToMap ¶
func (s *ScreenType) ToMap() map[string]interface{}
type ScreenUpdateType ¶
type ScreenUpdateType struct { UpdateId int64 `json:"updateid"` ScreenId string `json:"screenid"` LineId string `json:"lineid"` UpdateType string `json:"updatetype"` UpdateTs int64 `json:"updatets"` }
func GetScreenUpdates ¶
func GetScreenUpdates(ctx context.Context, maxNum int) ([]*ScreenUpdateType, error)
func (ScreenUpdateType) UseDBMap ¶
func (ScreenUpdateType) UseDBMap()
type ScreenViewOptsType ¶
type ScreenViewOptsType struct {
Sidebar *ScreenSidebarOptsType `json:"sidebar,omitempty"`
}
type ScreenWebShareOpts ¶
type ScreenWebShareOpts struct {}
type SessionDiskSizeType ¶
func SessionDiskSize ¶
func SessionDiskSize(sessionId string) (SessionDiskSizeType, error)
type SessionStatsType ¶
type SessionStatsType struct { SessionId string `json:"sessionid"` NumScreens int `json:"numscreens"` NumArchivedScreens int `json:"numarchivedscreens"` NumLines int `json:"numlines"` NumCmds int `json:"numcmds"` DiskStats SessionDiskSizeType `json:"diskstats"` }
func GetSessionStats ¶
func GetSessionStats(ctx context.Context, sessionId string) (*SessionStatsType, error)
type SessionTombstoneType ¶
type SessionTombstoneType struct { SessionId string `json:"sessionid"` Name string `json:"name"` DeletedTs int64 `json:"deletedts"` }
func (SessionTombstoneType) GetType ¶
func (SessionTombstoneType) GetType() string
func (SessionTombstoneType) UseDBMap ¶
func (SessionTombstoneType) UseDBMap()
type SessionType ¶
type SessionType struct { SessionId string `json:"sessionid"` Name string `json:"name"` SessionIdx int64 `json:"sessionidx"` ActiveScreenId string `json:"activescreenid"` NotifyNum int64 `json:"notifynum"` Archived bool `json:"archived,omitempty"` ArchivedTs int64 `json:"archivedts,omitempty"` Remotes []*RemoteInstance `json:"remotes"` // only for updates Remove bool `json:"remove,omitempty"` }
func GetAllSessions ¶
func GetAllSessions(ctx context.Context) ([]*SessionType, error)
Gets all sessions, including archived
func GetBareSessionById ¶
func GetBareSessionById(ctx context.Context, sessionId string) (*SessionType, error)
func GetBareSessions ¶
func GetBareSessions(ctx context.Context) ([]*SessionType, error)
includes archived sessions
func GetSessionById ¶
func GetSessionById(ctx context.Context, id string) (*SessionType, error)
func GetSessionByName ¶
func GetSessionByName(ctx context.Context, name string) (*SessionType, error)
func MakeSessionUpdateForRemote ¶
func MakeSessionUpdateForRemote(sessionId string, ri *RemoteInstance) SessionType
func (SessionType) GetType ¶
func (SessionType) GetType() string
type SidebarValueType ¶
type SingleConnDBGetter ¶
func (*SingleConnDBGetter) ReleaseDB ¶
func (dbg *SingleConnDBGetter) ReleaseDB(db *sqlx.DB)
type StatusIndicatorLevel ¶
type StatusIndicatorLevel int
const ( StatusIndicatorLevel_None StatusIndicatorLevel = iota StatusIndicatorLevel_Output StatusIndicatorLevel_Success StatusIndicatorLevel_Error )
func ScreenMemCombineIndicatorLevels ¶
func ScreenMemCombineIndicatorLevels(screenId string, level StatusIndicatorLevel) StatusIndicatorLevel
If the new indicator level is higher than the current indicator, update the current indicator. Returns the new indicator level.